RFR: 8292876: Do not include the deprecated userinfo component of the URI in HTTP/2 headers [v4]
Aleksei Efimov
aefimov at openjdk.org
Mon Oct 10 18:13:34 UTC 2022
On Mon, 10 Oct 2022 17:01:51 GMT, Darragh Clarke <duke at openjdk.org> wrote:
>> Changed the way the `:authority` pseudo header is set to only include host and, if available, port.
>> I added a test to cover this change that consists of a HttpClient that makes a request which contains userInfo, the test passes if the request is carried out with the userInfo not being added to the `:authority` header.
>>
>>
>> ### Tests
>> I ran Tier 1 - Tier 3 tests, as well as paying special attention to the http client tests to make sure they consistently passed
>
> Darragh Clarke has updated the pull request incrementally with one additional commit since the last revision:
>
> changed test to junit, use URIBuilder
Changes requested by aefimov (Committer).
test/jdk/java/net/httpclient/http2/UserInfoTest.java line 74:
> 72: }
> 73:
> 74: public void main() throws Exception {
This method needs to be annotated with `org.junit.jupiter.api.Test`. Without this annotation it won't be executed.
test/jdk/java/net/httpclient/http2/UserInfoTest.java line 88:
> 86:
> 87: URI uri = URIBuilder.newBuilder()
> 88: .userInfo("user")
You need to specify "https" scheme here (`.scheme("https")`) - without it `newBuilder(uri)` will fail with `java.lang.IllegalArgumentException: URI with undefined scheme`.
test/jdk/java/net/httpclient/http2/UserInfoTest.java line 91:
> 89: .loopback()
> 90: .port(port)
> 91: .buildUnchecked();
Minor: I think `build()` would be enough here since the test method throws an `Exception`.
test/jdk/java/net/httpclient/http2/UserInfoTest.java line 101:
> 99: HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
> 100:
> 101: if (response.statusCode() != 200) {
Maybe you could use here one of junit assertions from `org.junit.jupiter.api.Assertions` to check for status code
-------------
PR: https://git.openjdk.org/jdk/pull/10592
More information about the net-dev
mailing list