cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Kulp (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (CXF-3171) http.proxyHost and http.proxyPort of System properties win when no proxy is required
Date Thu, 07 Apr 2011 22:09:05 GMT

     [ https://issues.apache.org/jira/browse/CXF-3171?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Daniel Kulp resolved CXF-3171.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.3.4
         Assignee: Daniel Kulp


If the host is in the NoProxy list, explicitely use Proxy.NO_PROXY

> http.proxyHost and http.proxyPort of System properties win when no proxy is required
> ------------------------------------------------------------------------------------
>
>                 Key: CXF-3171
>                 URL: https://issues.apache.org/jira/browse/CXF-3171
>             Project: CXF
>          Issue Type: Bug
>          Components: Transports
>    Affects Versions: 2.2, 2.2.1, 2.2.2, 2.2.3, 2.2.4, 2.2.5, 2.2.6, 2.2.7, 2.2.8, 2.2.9,
2.1.10, 2.0.13, 2.2.10, 2.3.0, 2.2.11, 2.2.12, 2.3.1
>            Reporter: N. Tisserand
>            Assignee: Daniel Kulp
>             Fix For: 2.3.4
>
>   Original Estimate: 3h
>  Remaining Estimate: 3h
>
> When VM args "{{-Dhttp.proxyHost=xxxxxxxx -Dhttp.proxyPort=3128}}" are set, there is
no way to connect a webservice directly without passing throuh the proxy xxxxxxxx.
> The client CXF is build as following :
> {code:java|borderStyle=solid}JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
>   factory.setServiceClass(MyWs.class);
>   factory.setAddress(bundle.getProperty("url.web.service"));
>   MyWs instance = (MyWs) factory.create();
>   Client client = ClientProxy.getClient(instance);
>   HTTPConduit conduit = (HTTPConduit) client.getConduit();
>   HTTPClientPolicy httpClientPolicy = conduit.getClient();
>   httpClientPolicy.setAllowChunking(false);
>   
>   // Force NO proxy ?
>   httpClientPolicy.setProxyServer(null);
>   httpClientPolicy.setProxyServerPort(0);
>   // httpClientPolicy.unsetProxyServerPort();  // tried without success
>   conduit.setClient(httpClientPolicy);
> {code}
> When creating the instance with , CXF use HttpURLConnectionFactoryImpl (or HttpsURLConnectionFactory)
to open the url :
> {code:java|borderStyle=solid}    if (proxy != null) {
>       return (HttpURLConnection) url.openConnection(proxy);
>     } else {
>       return (HttpURLConnection) url.openConnection();
>     }
> {code}
> When the variable "{{proxy}}" is null, {{url.openConnection()}} is used, and benifits
of VM args ({{http.proxyHost}} and {{http.proxyPort}}).
> The only solution to bypass the proxy, while keeping existing VM args, is to add a System
property "{{http.nonProxyHosts}}" in order to exclude the host of the proxy. This can be done
with an other VM arg "{{-Dhttp.nonProxyHosts=xxxx}}" or programmatically : {{System.setProperty("http.nonProxyHosts",
"xxxx")}}
> According to http://download.oracle.com/javase/6/docs/technotes/guides/net/proxies.html
(chapter 3 Proxy class) when no proxy is required url.openConnection() should be used like
this :
> {code:java|borderStyle=solid}     url.openConnection(Proxy.NO_PROXY);{code}
> The technote points out : ??"Now, this guarantees you that this specific URL will be
retrieved though a direct connection bypassing any other proxy settings, which can be convenient."??
> I think that using {{url.openConnection(Proxy.NO_PROXY)}} could fix this problem in :
> * org.apache.cxf.transport.http.HttpURLConnectionFactoryImpl.createConnection(Proxy proxy,
URL url)   > line #51  (release 2.3.1)
> * org.apache.cxf.transport.https.HttpsURLConnectionFactory.createConnection(Proxy proxy,
URL url) > line #120 (release 2.3.1)
> (!) WARNING (!) : this issue can conflicts with this other one : [CXF-2839|http://issues.apache.org/jira/browse/CXF-2839]
> A lot of tests will be required.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message