hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kaiser Sose <carlo.bertucc...@live.it>
Subject Internal connection working only behind proxy????
Date Fri, 19 Feb 2010 16:08:13 GMT

Hi all,
I am wondering how to solve a really strange problem. :confused:
I am building a connection manager that makes dozens of requests to
different URI ... some of these requests are "Internal" (services are
internal to my company network) while for some other I need to set the
Proxy. Everything is working good exception made for ONE "Internal" service,
one of them who I shouldn't use the Proxy. If I try to reach this service I
get an awful "ClientProtocolException" but I really don't understand where
is the problem. For this internal service, if I set the proxy, I get an HTTP
200 RESPONSE .. so the INTERNAL SERVICE WORKS ONLY IF I USE A PROXY... in
order to be sure it was not a network problem I tried to reach the service
via browser (both explorer and firefox) and it works even if I don't set the
proxy, so I should reach this service through HttpClient!

mymanagerfunction(uri, usr, pwd) {

            [I do some jobs]

            // HERE I SET THE PROXY
            HttpGet httpget = new HttpGet(uri);
            if ( (!ProxyAddress.equals("")) && (ProxyPort > 0) ) {
                HttpHost aproxy = new HttpHost(ProxyAddress, ProxyPort);
               
httpget.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, aproxy);
            } 
            // HERE I CHECK IF I HAVE TO AUTHENTICATE FOR THIS HOST
            if (!usr.equals("")) {
                    httpclient.getCredentialsProvider().setCredentials(
                                        new
AuthScope(httpget.getURI().getHost(), 80),
                                        new UsernamePasswordCredentials(usr,
pwd));
            }

            if (!ProxyAddress.equals(""))
                System.out.println("PASSING THROUGH PROXY: " +
ProxyAddress);
            else
                System.out.println("NO PROXY");

            HttpResponse response = httpclient.execute(httpget);
}

I am blocked on this specific service and really have no idea of all that!
How can a proxy avoid such exception???? and why both the browsers get the
page passed as uri even if I don't use the proxy?

best regards, and tia :-)
-- 
View this message in context: http://old.nabble.com/Internal-connection-working-only-behind-proxy-----tp27655291p27655291.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message