Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 365048 - jetty Http client does not send proxy authentication when requesting a Https-resource through a web-proxy
Summary: jetty Http client does not send proxy authentication when requesting a Https-...
Status: RESOLVED FIXED
Alias: None
Product: Jetty
Classification: RT
Component: client (show other bugs)
Version: 7.5.4   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 7.5.x   Edit
Assignee: Thomas Becker CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-29 07:59 EST by Andre Sikma CLA
Modified: 2012-01-06 10:20 EST (History)
3 users (show)

See Also:


Attachments
proposed patch (13.37 KB, text/plain)
2011-11-30 13:16 EST, Thomas Becker CLA
no flags Details
proposed patch (7.57 KB, patch)
2012-01-05 11:42 EST, Thomas Becker CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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).