mirror of
https://github.com/apple/pkl.git
synced 2026-07-03 03:31:48 +02:00
Follow HTTP redirects (#328)
- Change HttpClient to follow all redirects except HTTPS to HTTP. - Run language snippet tests with --no-cache and real PackageServer instead of pre-seeded cache. This increases HTTP test coverage and enables testing of package redirects. - Change PackageServer to return 301 for request paths starting with /HTTP301/ and 307 for request paths starting with /HTTP307/. - Update some outdated test package checksums that apparently weren't verified.
This commit is contained in:
@@ -22,6 +22,7 @@ import java.lang.invoke.MethodHandles;
|
||||
import java.lang.invoke.MethodType;
|
||||
import java.net.ConnectException;
|
||||
import java.net.URI;
|
||||
import java.net.http.HttpClient.Redirect;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.net.http.HttpResponse.BodyHandler;
|
||||
@@ -81,6 +82,7 @@ final class JdkHttpClient implements HttpClient {
|
||||
java.net.http.HttpClient.newBuilder()
|
||||
.sslContext(createSslContext(certificateFiles, certificateUris))
|
||||
.connectTimeout(connectTimeout)
|
||||
.followRedirects(Redirect.NORMAL)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user