Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 46597 invoked from network); 13 Nov 2003 22:25:02 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 13 Nov 2003 22:25:02 -0000 Received: (qmail 22219 invoked by uid 500); 13 Nov 2003 22:24:36 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 22143 invoked by uid 500); 13 Nov 2003 22:24:35 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 22099 invoked by uid 500); 13 Nov 2003 22:24:35 -0000 Received: (qmail 22085 invoked from network); 13 Nov 2003 22:24:35 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 13 Nov 2003 22:24:35 -0000 Received: (qmail 46297 invoked by uid 1624); 13 Nov 2003 22:24:47 -0000 Date: 13 Nov 2003 22:24:47 -0000 Message-ID: <20031113222447.46296.qmail@minotaur.apache.org> From: olegk@apache.org To: jakarta-commons-cvs@apache.org Subject: cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient HttpMethodBase.java HttpMethodDirector.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N olegk 2003/11/13 14:24:47 Modified: httpclient/src/java/org/apache/commons/httpclient HttpMethodBase.java HttpMethodDirector.java Log: PR #24352 (NLTM Proxy and basic host authorization) Fixed the bug causing basic authentication via NLTM Proxy to fail Contributed by Oleg Kalnichevski Reviewed by Michael Becke Revision Changes Path 1.190 +12 -18 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java Index: HttpMethodBase.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java,v retrieving revision 1.189 retrieving revision 1.190 diff -u -r1.189 -r1.190 --- HttpMethodBase.java 5 Nov 2003 20:45:34 -0000 1.189 +++ HttpMethodBase.java 13 Nov 2003 22:24:46 -0000 1.190 @@ -67,7 +67,6 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; -import java.util.Iterator; import org.apache.commons.httpclient.auth.AuthScheme; import org.apache.commons.httpclient.auth.HttpAuthenticator; @@ -1154,6 +1153,14 @@ LOG.trace("enter HttpMethodBase.addCookieRequestHeader(HttpState, " + "HttpConnection)"); + Header[] cookieheaders = getRequestHeaderGroup().getHeaders("Cookie"); + for (int i = 0; i < cookieheaders.length; i++) { + Header cookieheader = cookieheaders[i]; + if (cookieheader.isAutogenerated()) { + getRequestHeaderGroup().removeHeader(cookieheader); + } + } + CookieSpec matcher = CookiePolicy.getCookieSpec(this.params.getCookiePolicy()); Cookie[] cookies = matcher.match(conn.getHost(), conn.getPort(), getPath(), conn.isSecure(), state.getCookies()); @@ -2028,7 +2035,6 @@ throws IOException, HttpException { LOG.trace("enter HttpMethodBase.writeRequestHeaders(HttpState," + "HttpConnection)"); - clearAutogeneratedHeaders(); addRequestHeaders(state, conn); Header[] headers = getRequestHeaders(); @@ -2324,16 +2330,4 @@ this.responseStream = responseStream; } - /** - * Removes all auto-generated headers - */ - protected void clearAutogeneratedHeaders() { - Iterator items = getRequestHeaderGroup().getIterator(); - while (items.hasNext()) { - Header header = (Header)items.next(); - if (header.isAutogenerated()) { - items.remove(); - } - } - } } 1.9 +5 -6 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodDirector.java Index: HttpMethodDirector.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodDirector.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- HttpMethodDirector.java 10 Nov 2003 23:19:49 -0000 1.8 +++ HttpMethodDirector.java 13 Nov 2003 22:24:47 -0000 1.9 @@ -344,7 +344,6 @@ // What is to follow is an ugly hack. // I REALLY hate having to resort to such // an appalling trick - // TODO: Connect method must be redesigned. // The only feasible solution is to split monolithic // HttpMethod into HttpRequest/HttpResponse pair. // That would allow to execute CONNECT method @@ -525,17 +524,17 @@ realmsUsed.add(realm); } + this.method.removeRequestHeader(HttpAuthenticator.WWW_AUTH_RESP); + this.method.removeRequestHeader(HttpAuthenticator.PROXY_AUTH_RESP); try { //remove preemptive header and reauthenticate switch (statusCode) { case HttpStatus.SC_UNAUTHORIZED: - this.method.removeRequestHeader(HttpAuthenticator.WWW_AUTH_RESP); authenticated = HttpAuthenticator.authenticate( authscheme, this.method, this.conn, this.state); this.realm = authscheme.getRealm(); break; case HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED: - this.method.removeRequestHeader(HttpAuthenticator.PROXY_AUTH_RESP); authenticated = HttpAuthenticator.authenticateProxy( authscheme, this.method, this.conn, this.state); this.proxyRealm = authscheme.getRealm(); --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org