hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1143040 - /httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/NHttpClientProtocolHandler.java
Date Tue, 05 Jul 2011 13:09:37 GMT
Author: olegk
Date: Tue Jul  5 13:09:37 2011
New Revision: 1143040

URL: http://svn.apache.org/viewvc?rev=1143040&view=rev
Log:
Throw ProtocolException upon receipt of an intermediate response (1xx) other than 100 (continue)

Modified:
    httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/NHttpClientProtocolHandler.java

Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/NHttpClientProtocolHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/NHttpClientProtocolHandler.java?rev=1143040&r1=1143039&r2=1143040&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/NHttpClientProtocolHandler.java
(original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/NHttpClientProtocolHandler.java
Tue Jul  5 13:09:37 2011
@@ -28,6 +28,7 @@
 package org.apache.http.impl.nio.client;
 
 import java.io.IOException;
+import java.net.ProtocolException;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -251,8 +252,11 @@ class NHttpClientProtocolHandler impleme
             int statusCode = response.getStatusLine().getStatusCode();
             if (statusCode < HttpStatus.SC_OK) {
                 // 1xx intermediate response
-                if (statusCode == HttpStatus.SC_CONTINUE
-                        && httpexchange.getRequestState() == MessageState.ACK) {
+                if (statusCode != HttpStatus.SC_CONTINUE) {
+                    throw new ProtocolException(
+                            "Unexpected response: " + response.getStatusLine());
+                }
+                if (httpexchange.getRequestState() == MessageState.ACK) {
                     int timeout = httpexchange.getTimeout();
                     conn.setSocketTimeout(timeout);
                     conn.requestOutput();



Mime
View raw message