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:
translatenix
2024-03-21 10:26:07 -07:00
committed by GitHub
parent 60bcd56672
commit deaf6983c4
10 changed files with 105 additions and 16 deletions
@@ -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();
}