Skip to content

Commit

Permalink
HTTPCLIENT-1061: Proxy-Authorization header gets sent to the target h…
Browse files Browse the repository at this point in the history
…ost when tunneling requests through a proxy that requires authentication

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1074473 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
ok2c committed Feb 25, 2011
1 parent d2670af commit a572756
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions RELEASE_NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Changes since 4.1

* [HTTPCLIENT-1061] Fixed critical bug causing Proxy-Authorization header to be sent to the target
host when tunneling requests through a proxy server that requires authentication.
Contributed by Oleg Kalnichevski <olegk at apache.org>

* [HTTPCLIENT-1056] Fixed bug causing the RequestAuthCache protocol interceptor to generate
an invalid AuthScope instance when looking up user credentials for preemptive authentication.
Contributed by Oleg Kalnichevski <olegk at apache.org>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
import org.apache.http.auth.AuthenticationException;
import org.apache.http.auth.ContextAwareAuthScheme;
import org.apache.http.auth.Credentials;
import org.apache.http.conn.HttpRoutedConnection;
import org.apache.http.conn.routing.HttpRoute;
import org.apache.http.protocol.ExecutionContext;
import org.apache.http.protocol.HttpContext;

/**
Expand Down Expand Up @@ -74,6 +77,13 @@ public void process(final HttpRequest request, final HttpContext context)
return;
}

HttpRoutedConnection conn = (HttpRoutedConnection) context.getAttribute(
ExecutionContext.HTTP_CONNECTION);
HttpRoute route = conn.getRoute();
if (route.isTunnelled()) {
return;
}

// Obtain authentication state
AuthState authState = (AuthState) context.getAttribute(
ClientContext.PROXY_AUTH_STATE);
Expand Down

0 comments on commit a572756

Please sign in to comment.