You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Kamil Páral <ri...@gmail.com> on 2008/04/09 11:06:51 UTC

HTTP packets instead of TCP packets

Hello,
I'm developing a small application for getting webpages over GET and 
posting filled-in web forms over POST requests. Initially I have used 
standard Java 6 API, but it was problematic and buggy, so I have 
switched to Commons HttpClient 3.1, which works perfect. I have one 
problem though.

With standard Java 6 API my users were able to define HTTP proxy (via 
system properties) and everything worked. With Commons HttpClient it 
does not. I have observed the network traffic with Wireshark and found 
that standard Java 6 API sends HTTP packets only, but Commons HttpClient 
uses pure TCP packets very often (as a request to server and as a 
response from the server). Therefore with your library, the HTTP proxy 
simply does not apply. But a lot of users don't have possibility to use 
SOCKS proxy (for general TCP), just HTTP. For these users my program now 
does not work.

I would like to ask if there is some option to convince the Commons 
HttpClient to use real HTTP packets and not just TCP ones. This would 
enable many of my users to use HTTP proxy again.

Thank you for any help.
Kamil Páral

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


Re: HTTP packets instead of TCP packets

Posted by Biju P <bi...@tcs.com>.
Hi Kamil, 

You may try the below code. It detects the proxy settings from System 
Properties and if it is "manual", it extracts the proxy list and configure 
accordingly. It works fine with IE, but no idea about other browsers.

HttpClient client = new HttpClient();
if(System.getProperty("javaplugin.proxy.config.type").trim()=="manual")
{
        String 
strProxyList=System.getProperty("javaplugin.proxy.config.list");
        if(strProxyList!=null && strProxyList.trim()!="")
        {
                String 
strHttpProxy=strProxyList.substring(strProxyList.indexOf("http=")+5, 
strProxyList.indexOf(',',strProxyList.indexOf("http=")+5)).trim();
 
client.getHostConfiguration().setProxy(strHttpProxy.substring(0,strHttpProxy.indexOf(':')), 
Integer.parseInt(strHttpProxy.substring(strHttpProxy.indexOf(':')+1)));
                client.getState().setProxyCredentials("", 
strHttpProxy.substring(0,strHttpProxy.indexOf(':')), new 
UsernamePasswordCredentials("myusername", "mypassword"));
          }
}

Regards,
Biju P M
Mailto: biju.p@tcs.com



Kamil Páral <ri...@gmail.com> 
04/16/2008 03:55 PM
Please respond to
"HttpClient User Discussion" <ht...@hc.apache.org>


To
httpclient-users@hc.apache.org
cc

Subject
Re: HTTP packets instead of TCP packets






Kamil Páral wrote:
> Noone really knows, how to have HTTP proxy working with Commons 
> HttpClient 3.1?
>
If somebody got any idea, please CC me also to my email, I'm 
unsubscribing from the list. Thanks.

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


ForwardSourceID:NT000042A2 
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you



Re: HTTP packets instead of TCP packets

Posted by Kamil Páral <ri...@gmail.com>.
Kamil Páral wrote:
> Noone really knows, how to have HTTP proxy working with Commons 
> HttpClient 3.1?
>
If somebody got any idea, please CC me also to my email, I'm 
unsubscribing from the list. Thanks.

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


Re: HTTP packets instead of TCP packets

Posted by Kamil Páral <ri...@gmail.com>.
Kamil Páral wrote:
> Hello,
> I'm developing a small application for getting webpages over GET and 
> posting filled-in web forms over POST requests. Initially I have used 
> standard Java 6 API, but it was problematic and buggy, so I have 
> switched to Commons HttpClient 3.1, which works perfect. I have one 
> problem though.
>
> With standard Java 6 API my users were able to define HTTP proxy (via 
> system properties) and everything worked. With Commons HttpClient it 
> does not. I have observed the network traffic with Wireshark and found 
> that standard Java 6 API sends HTTP packets only, but Commons 
> HttpClient uses pure TCP packets very often (as a request to server 
> and as a response from the server). Therefore with your library, the 
> HTTP proxy simply does not apply. But a lot of users don't have 
> possibility to use SOCKS proxy (for general TCP), just HTTP. For these 
> users my program now does not work.
>
> I would like to ask if there is some option to convince the Commons 
> HttpClient to use real HTTP packets and not just TCP ones. This would 
> enable many of my users to use HTTP proxy again.
>
> Thank you for any help.
> Kamil Páral

Noone really knows, how to have HTTP proxy working with Commons 
HttpClient 3.1?


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