hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r692503 - in /httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/protocol: RequestConnControl.java RequestTargetHost.java
Date Fri, 05 Sep 2008 18:07:12 GMT
Author: olegk
Date: Fri Sep  5 11:07:12 2008
New Revision: 692503

URL: http://svn.apache.org/viewvc?rev=692503&view=rev
Log:
Changed RequestConnControl and RequestTargetHost protocol interceptors to ignore CONNECT methods
(CONNECT methods are not supposed to have Host and Connection request headers) 

Modified:
    httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/protocol/RequestConnControl.java
    httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/protocol/RequestTargetHost.java

Modified: httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/protocol/RequestConnControl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/protocol/RequestConnControl.java?rev=692503&r1=692502&r2=692503&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/protocol/RequestConnControl.java
(original)
+++ httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/protocol/RequestConnControl.java
Fri Sep  5 11:07:12 2008
@@ -57,6 +57,12 @@
         if (request == null) {
             throw new IllegalArgumentException("HTTP request may not be null");
         }
+        
+        String method = request.getRequestLine().getMethod();
+        if (method.equalsIgnoreCase("CONNECT")) {
+            return;
+        }
+        
         if (!request.containsHeader(HTTP.CONN_DIRECTIVE)) {
             // Default policy is to keep connection alive
             // whenever possible

Modified: httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/protocol/RequestTargetHost.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/protocol/RequestTargetHost.java?rev=692503&r1=692502&r2=692503&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/protocol/RequestTargetHost.java
(original)
+++ httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/protocol/RequestTargetHost.java
Fri Sep  5 11:07:12 2008
@@ -67,6 +67,12 @@
         if (context == null) {
             throw new IllegalArgumentException("HTTP context may not be null");
         }
+        
+        String method = request.getRequestLine().getMethod();
+        if (method.equalsIgnoreCase("CONNECT")) {
+            return;
+        }
+        
         if (!request.containsHeader(HTTP.TARGET_HOST)) {
             HttpHost targethost = (HttpHost) context
                 .getAttribute(ExecutionContext.HTTP_TARGET_HOST);



Mime
View raw message