On Tue, 2013-10-01 at 13:07 +0000, CHARTIER Valentin wrote:
> Hello all,
> Experimenting http tunneling with org.apache.http.impl.client.ProxyClient 
> with Apache 2.2 configured as a direct proxy.
> Code is just the same as org.apache.http.examples.client.ProxyTunnelDemo.java 
> :
>         ProxyClient proxyClient = new ProxyClient();
>         HttpHost target = new HttpHost("mytargetserver ", 443);
>         HttpHost proxy = new HttpHost("localhost", 8080);
>         UsernamePasswordCredentials credentials = new 
> UsernamePasswordCredentials("user", "pwd");
>         Socket socket = proxyClient.tunnel(proxy, target, credentials);
> 
> Connection attempts are failing with code 502.
> 
> The client log :
> [DEBUG] headers - http-outgoing-0 >> CONNECT mytargetserver:443 HTTP/1.1
> [DEBUG] headers - http-outgoing-0 >> Proxy-Connection: Keep-Alive
> [DEBUG] headers - http-outgoing-0 << HTTP/1.1 400 Bad Request
> [DEBUG] headers - http-outgoing-0 << Date: Tue, 01 Oct 2013 12:32:33 GMT
> [DEBUG] headers - http-outgoing-0 << Server: Apache/2.2.25 (Win32)
> [DEBUG] headers - http-outgoing-0 << Content-Length: 226
> [DEBUG] headers - http-outgoing-0 << Connection: close
> [DEBUG] headers - http-outgoing-0 << Content-Type: text/html; 
> charset=iso-8859-1
> [DEBUG] DefaultManagedHttpClientConnection - http-outgoing-0: Close connection
> 
> The Host header is missing.
> 
> Confirmed by the error log on Apache server side :
> Client sent HTTP/1.1 request without host name (see RFC2616 section 14.23)
> 
> I could fix this issue by adding a RequestTargetHost processor in 
> org.apache.http.impl.client.ProxyClient.java at line 112 :
>         this.httpProcessor = new ImmutableHttpProcessor(new 
> RequestTargetHost(), new RequestClientConnControl(), new RequestUserAgent());
> instead of just
>         this.httpProcessor = new ImmutableHttpProcessor(new 
> RequestClientConnControl(), new RequestUserAgent());
> 
> I didn't see any way of changing the behavior of ProxyClient from the outside 
> so this really looks like a bug to me.
> 
> Anybody experimenting the same ?
> Is there a better way of establishing http tunneling with HttpClient 4.3 ?
> Should the issue be reported ?
> 

Valentin

Please raise a JIRA for this defect.

Oleg

PS: and please subscribe before posting


> Thanks
> Valentin
> 
> 
> This email and any attachments are intended solely for the use of the 
> individual or entity to whom it is addressed and may be confidential and/or 
> privileged.
> 
> If you are not one of the named recipients or have received this email in 
> error,
> 
> (i) you should not read, disclose, or copy it,
> 
> (ii) please notify sender of your receipt by reply email and delete this 
> email and all attachments,
> 
> (iii) Dassault Systemes does not accept or assume any liability or 
> responsibility for any use of or reliance on this email.
> 
> For other languages, go to http://www.3ds.com/terms/email-disclaimer
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 



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

Reply via email to