On Wed, 2 Feb 2022 06:18:39 GMT, Jaikiran Pai <j...@openjdk.org> 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 incrementally with one additional 
> commit since the last revision:
> 
>   minor - rename variable in test

src/java.base/share/lib/security/default.policy line 25:

> 23:     permission java.net.SocketPermission "*","connect,resolve";
> 24:     // required if the HTTPClient is configured to use a local bind 
> address
> 25:     permission java.net.SocketPermission "localhost:*","listen,resolve";

Acked: I see that binding a `SocketChannel` will call 
`SecurityManager::checkListen`.
I'd have to double check with `SocketPermission` to verify `"localhost:*"` 
covers all the cases (that is - that it is sufficient to bind on any local 
interface)

src/java.net.http/share/classes/java/net/http/HttpClient.java line 376:

> 374:          * correct {@code localAddr} is passed. Failure to do so can 
> result in
> 375:          * requests sent through the {@code HTTPClient} to fail.
> 376:          *

`{@code HTTPClient}` should probably `{@code HttpClient}` since that's how the 
class is named.

test/jdk/java/net/httpclient/HttpClientLocalAddrTest.java line 73:

> 71:  *      -Djdk.internal.httpclient.debug=true
> 72:  *      HttpClientLocalAddrTest
> 73:  *

Thanks for  running with SecurityManager too.

-------------

PR: https://git.openjdk.java.net/jdk/pull/6690

Reply via email to