mthmulders commented on pull request #107:
URL: 
https://github.com/apache/maven-integration-testing/pull/107#issuecomment-822739744


   > When the name says `MavenITmng4991NonProxyHostsTest.java` one should be 
vigilant.
   
   I appreciate your vigilance. This is the relevant part of the 
settings-template.xml for MNG-4991:
   
   ```xml
   <mirrors>
     <mirror>
       <id>central</id>
       <!-- NOTE: We need to try and use the proper host name/ip as Java 
generally ignores proxies for "localhost" -->
       <url>http://@localhost@:@port@/</url>
       <mirrorOf>central</mirrorOf>
     </mirror>
   </mirrors>
   <proxies>
     <proxy>
       <active>true</active>
       <protocol>http</protocol>
       <host>localhost</host>
       <port>@proxyPort@</port>
       <nonProxyHosts>@localhost@</nonProxyHosts>
     </proxy>
   </proxies>
   ```
   
   Quoting from [MNG-4991](https://issues.apache.org/jira/browse/MNG-4991):
   
   > each repository will be configured with a proxy, even if the related host 
is excluded via the `<nonProxyHosts />` tag in the settings.xml.
   
   This suggests that the test wants to prove that Maven will **not** use the 
proxy. Next, looking at the Java code, I see:
   - the test spins up a proxy (that will in fact not proxy anything, as the 
`DefaultHandler` always returns 404)
   - the test spins up another Jetty instance, that will return an artifact
   - the test builds a small Maven project and verifies the artifact is indeed 
resolved. If it is resolved, that would be because the proxy is bypassed, QED. 
If Maven would've used the proxy, it would've seen HTTP 404 and the artifact 
would not have been resolved.
   
   But with all this, I still don't know if it matters where the server and the 
repository live. That tiny line of comment suggests
   
   > Java generally ignores proxies for "localhost"
   
   That's something I've never heard of before. It may be true, I don't know. 
But the "generally" is not quite convincing me here. The [Java Networking and 
Proxies](https://docs.oracle.com/javase/8/docs/technotes/guides/net/proxies.html)
 doesn't support that statement - in fact, it even gives an example with 
`-Dhttp.nonProxyHosts="localhost|host.example.com"`. Why would they do that if 
Java indeed ignores proxies for localhost?
   
   So, with all that vigilance, I still don't know whether it matters or not...


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to