[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-2381?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18019031#comment-18019031
 ] 

Jon Harper edited comment on HTTPCLIENT-2381 at 9/9/25 9:55 AM:
----------------------------------------------------------------

hi [~abernal], I tested and I had the opt out behavior, great !

I noticed two interesting things:
 * Just a note regarding your second statement "No JVM system properties are 
read unless useSystemProperties() is called"
that's not true. I didn't call useSystemProperties() but -DproxyHost 
-DproxyPort=3128 were read. ( the code goes to ProxySelector::getDefault which 
does read the systemproperties 
[https://github.com/arturobernalg/httpcomponents-client/commit/a7030db4642cf348771c37f9b4e190bcbc7e8a8d#diff-d08c7b09d26f3696bbee9660c8190724bfcc5804ea677301dcaa642e2dcb303aR1029]
 )

I don't mind that system properties are read in addition to the environment 
variables, but it's a bigger change I think so I pointed it out.

 * when I used
{code:java}
HttpClients.custom().disableProxyAutodetection().useSystemProperties().build()
{code}
it doesn't read the system properties anymore. Was this intentional ? Not sure 
what is best in this case. But calling disableProxyAutodetection is not "an 
opt-out for legacy behavior", it doesn't behave exactly the same in the current 
state of the code of just replacing "if (useSystemProperties)" with if 
(!disableProxyAutodetection) 
[https://github.com/apache/httpcomponents-client/pull/680/files#diff-d08c7b09d26f3696bbee9660c8190724bfcc5804ea677301dcaa642e2dcb303aL1014-R1033]

I'm pointing this just to help write accurate documentation or help get the 
exact needed behavior.

Cheers,
Jon

 

 


was (Author: jonenst):
hi [~abernal], I tested and I had the opt out behavior, great !

I noticed two interesting things:
 * Just a note regarding your second statement "No JVM system properties are 
read unless useSystemProperties() is called"
that's not true. I didn't call useSystemProperties() but -DproxyHost 
-DproxyPort=3128 were read. ( the code goes to ProxySelector::getDefault which 
does read the systemproperties 
[https://github.com/arturobernalg/httpcomponents-client/commit/a7030db4642cf348771c37f9b4e190bcbc7e8a8d#diff-d08c7b09d26f3696bbee9660c8190724bfcc5804ea677301dcaa642e2dcb303aR1029]
 )

I don't mind that system properties are read in addition to the environment 
variables, but it's a bigger change I think so I pointed it out.
 * when I used
{code:java}
HttpClients.custom().disableProxyAutodetection().useSystemProperties().build()
{code}
it doesn't read the system properties anymore. Was this intentional ? Not sure 
what is best in this case. But calling disableProxyAutodetection is not "an 
opt-out for legacy behavior", it doesn't behave exactly the same in the current 
state of the code of just replacing "if (useSystemProperties)" with if 
(!disableProxyAutodetection) 
[https://github.com/apache/httpcomponents-client/pull/680/files#diff-d08c7b09d26f3696bbee9660c8190724bfcc5804ea677301dcaa642e2dcb303aL1014-R1033]




I'm pointing this just to help write accurate documentation or help get the 
exact needed behavior.

Cheers,
Jon

 

 

> Allow environment proxy settings by default or strongly document this decision
> ------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-2381
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2381
>             Project: HttpComponents HttpClient
>          Issue Type: Wish
>            Reporter: Jon Harper
>            Priority: Minor
>              Labels: volunteers-wanted
>             Fix For: Stuck
>
>          Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Hi,
> projects keep getting burned by the fact that is it impossible to set runtime 
> environment variables to use http proxies. My personal latest frustration is 
> with central-publishing-maven-plugin which is unusable in many companies 
> where using a corporate proxy is mandatory (no direct internet access). This 
> has happened times and times again, for example.
> https://github.com/spring-cloud/spring-cloud-vault/issues/75
> https://github.com/spring-projects/spring-boot/issues/35815
> It seems like every time this happen, people then just add the required code 
> to be able to set an environment variable or a system property, after the 
> initial pain of beeing blocked by this problem.
> Should this project be changed so that by default without code you can use 
> system properties to configure the proxy ? That is have systemProperties=true 
> everywhere and replace useSystemProperties() by disableSystemProperties().
> Using the same system properties as the jdk clients is the simplest, but if 
> needed it would still provide benefit if it were entirely new system 
> properties (so no backwards compatibilty as these properties would never have 
> been set), at least people would be to use proxies without changing some code 
> or worse changing some third party library.
> An alternative would be to add a prominent note in the docs to warn that 
> unless specific code is added, using a proxy is impossible and makes the 
> client unusable in many corporate contexts. Maybe also document why this 
> design decision was made, what are the advantages of doing this so that users 
> at least understand what they gain in exchange for their suffering.
> Thanks in advance,
> Jon



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to