Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 365048

Summary: jetty Http client does not send proxy authentication when requesting a Https-resource through a web-proxy
Product: [RT] Jetty Reporter: Andre Sikma <sikkesoft>
Component: clientAssignee: Thomas Becker <tbecker>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: janb, jetty-inbox, simone.bordet
Version: 7.5.4   
Target Milestone: 7.5.x   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
proposed patch
none
proposed patch none

Description Andre Sikma CLA 2011-11-29 07:59:48 EST
when using the http-client to request a https-resource through a web-proxy that uses (requires) authentication, the proxy authentication header with credentials are not included in the CONNECT request.

Seen with 7.5.1; Code reading learned that the code has not changed

suggested solution:

public class HttpConnection 
....
    private void commitRequest() throws IOException
    {
        ....

-           if (_destination.isProxied() && !HttpMethods.CONNECT.equals(method) && uri.startsWith("/"))
+            if (_destination.isProxied() )
+            {
+            	if ( !HttpMethods.CONNECT.equals(method) && uri.startsWith("/"))
+            	{
                    ...
+                }

                Authentication auth = _destination.getProxyAuthentication();
                if (auth != null)
                    auth.setCredentials(_exchange);
            }
        ....


    }
    ....
Comment 1 Thomas Becker CLA 2011-11-30 13:16:53 EST
Created attachment 207749 [details]
proposed patch

Reviewed the suggested fix. Makes sense. Patch attached.

I didn't test it though. Let me know if I should.
Comment 2 Jan Bartel CLA 2011-12-08 18:04:27 EST
Thomas,

Yes, please do test the patch before we commit it.

thanks
Jan

(In reply to comment #1)
> Created attachment 207749 [details]
> proposed patch
> 
> Reviewed the suggested fix. Makes sense. Patch attached.
> 
> I didn't test it though. Let me know if I should.
Comment 3 Thomas Becker CLA 2012-01-05 11:42:11 EST
Created attachment 209088 [details]
proposed patch

Hey Jan,

I've attached a new patch including a new unit test testing the behaviour.

Cheers,
Thomas
Comment 4 Simone Bordet CLA 2012-01-06 10:20:28 EST
Reviewed the patch, and modified the test to assume it can connect (or skip the test otherwise).