Re: RFR: 8209137: Add ability to bind to specific local address to HTTP client [v17]
On Mon, 9 May 2022 13:31:38 GMT, Daniel Fuchs wrote: >> Jaikiran Pai has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains 37 commits: >> >> - Merge latest from master branch >> - add a @build to force jtreg to show consistent test results and add the >> relevant permissions for security manager testing >> - Change the new API to accept an InetAddress instead of an >> InetSocketAddress, after inputs from Michael, Daniel and others >> - Merge latest from master >> - Implement HttpServerAdapters in test as suggested by Daniel >> - fix check when security manager is enabled >> - Add a unit test for the new HttpClient.Builder.localAddress method >> - Implement Daniel's suggestion - only support InetSocketAddress with port 0 >> - Merge latest from master branch >> - Merge latest from master branch >> - ... and 27 more: >> https://git.openjdk.java.net/jdk/compare/b490a58e...d4a19dea > > src/java.net.http/share/classes/java/net/http/HttpClient.java line 398: > >> 396: * >> 397: * @implSpec If the {@link #localAddress(InetAddress) local >> address} is a non-null >> 398: * Internet Protocol address and a security manager is >> installed, then > > Here and in the @throws bellow we could now remove mention of `Internet > Protocol`. > For instance, here we could say > > ... is a non-null address and a security ... Done. Updated this and the other javadoc comment to follow this suggestion. > test/jdk/java/net/httpclient/HttpClientBuilderTest.java line 274: > >> 272: // setting null should work fine >> 273: builder.localAddress(null); >> 274: builder.localAddress(InetAddress.getLoopbackAddress()); > > We probably also need a MockHttpClientBuilder to test the behaviour of the > default implementation (check that it throws UOE). I've now updated this PR to add a new test method which tests the default method implementation of `localAddress`. - PR: https://git.openjdk.java.net/jdk/pull/6690
Re: RFR: 8209137: Add ability to bind to specific local address to HTTP client [v17]
On Mon, 9 May 2022 07:52:29 GMT, Jaikiran Pai wrote: >> This change proposes to implement the enhancement noted in >> https://bugs.openjdk.java.net/browse/JDK-8209137. >> >> The change introduces a new API to allow applications to build a >> `java.net.http.HTTPClient` configured with a specific local address that >> will be used while creating `Socket`(s) for connections. > > Jaikiran Pai has updated the pull request with a new target base due to a > merge or a rebase. The pull request now contains 37 commits: > > - Merge latest from master branch > - add a @build to force jtreg to show consistent test results and add the > relevant permissions for security manager testing > - Change the new API to accept an InetAddress instead of an > InetSocketAddress, after inputs from Michael, Daniel and others > - Merge latest from master > - Implement HttpServerAdapters in test as suggested by Daniel > - fix check when security manager is enabled > - Add a unit test for the new HttpClient.Builder.localAddress method > - Implement Daniel's suggestion - only support InetSocketAddress with port 0 > - Merge latest from master branch > - Merge latest from master branch > - ... and 27 more: > https://git.openjdk.java.net/jdk/compare/b490a58e...d4a19dea Changes requested by dfuchs (Reviewer). src/java.net.http/share/classes/java/net/http/HttpClient.java line 398: > 396: * > 397: * @implSpec If the {@link #localAddress(InetAddress) local > address} is a non-null > 398: * Internet Protocol address and a security manager is > installed, then Here and in the @throws bellow we could now remove mention of `Internet Protocol`. For instance, here we could say ... is a non-null address and a security ... src/java.net.http/share/classes/java/net/http/HttpClient.java line 411: > 409: * the {@link #localAddress(InetAddress) local address} > is an > 410: * Internet Protocol address and the > 411: * security manager's {@link SecurityManager#checkListen > checkListen} ``` ... has been installed and the security manager's {@link SecurityManager#checkListen checkListen} ... test/jdk/java/net/httpclient/HttpClientBuilderTest.java line 274: > 272: // setting null should work fine > 273: builder.localAddress(null); > 274: builder.localAddress(InetAddress.getLoopbackAddress()); We probably also need a MockHttpClientBuilder to test the behaviour of the default implementation (check that it throws UOE). - PR: https://git.openjdk.java.net/jdk/pull/6690
Re: RFR: 8209137: Add ability to bind to specific local address to HTTP client [v17]
> This change proposes to implement the enhancement noted in > https://bugs.openjdk.java.net/browse/JDK-8209137. > > The change introduces a new API to allow applications to build a > `java.net.http.HTTPClient` configured with a specific local address that will > be used while creating `Socket`(s) for connections. Jaikiran Pai has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 37 commits: - Merge latest from master branch - add a @build to force jtreg to show consistent test results and add the relevant permissions for security manager testing - Change the new API to accept an InetAddress instead of an InetSocketAddress, after inputs from Michael, Daniel and others - Merge latest from master - Implement HttpServerAdapters in test as suggested by Daniel - fix check when security manager is enabled - Add a unit test for the new HttpClient.Builder.localAddress method - Implement Daniel's suggestion - only support InetSocketAddress with port 0 - Merge latest from master branch - Merge latest from master branch - ... and 27 more: https://git.openjdk.java.net/jdk/compare/b490a58e...d4a19dea - Changes: https://git.openjdk.java.net/jdk/pull/6690/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk=6690=16 Stats: 530 lines in 11 files changed: 521 ins; 5 del; 4 mod Patch: https://git.openjdk.java.net/jdk/pull/6690.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/6690/head:pull/6690 PR: https://git.openjdk.java.net/jdk/pull/6690