hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject httpcomponents-core git commit: [HTTPCORE-482] org.apache.http.nio.protocol.HttpAsyncService does returns an empty response when a socket timeout is detected
Date Thu, 17 Aug 2017 14:14:05 GMT
Repository: httpcomponents-core
Updated Branches:
  refs/heads/4.4.x 43b438d28 -> a5f3bb9e9


[HTTPCORE-482] org.apache.http.nio.protocol.HttpAsyncService does
returns an empty response when a socket timeout is detected

Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/a5f3bb9e
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/a5f3bb9e
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/a5f3bb9e

Branch: refs/heads/4.4.x
Commit: a5f3bb9e989a232d864d986d7a1d2145032c59c6
Parents: 43b438d
Author: Gary Gregory <garydgregory@gmail.com>
Authored: Wed Aug 16 16:54:24 2017 -0600
Committer: Oleg Kalnichevski <olegk@apache.org>
Committed: Thu Aug 17 16:12:30 2017 +0200

----------------------------------------------------------------------
 .../main/java/org/apache/http/nio/protocol/HttpAsyncService.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/a5f3bb9e/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
index cc8dc37..4df1905 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
@@ -525,7 +525,7 @@ public class HttpAsyncService implements NHttpServerEventHandler {
     public void timeout(final NHttpServerConnection conn) throws IOException {
         final State state = getState(conn);
         if (state != null) {
-            closeHandlers(state, new SocketTimeoutException());
+            exception(conn, new SocketTimeoutException());
         }
         if (conn.getStatus() == NHttpConnection.ACTIVE) {
             conn.close();
@@ -632,6 +632,8 @@ public class HttpAsyncService implements NHttpServerEventHandler {
             code = HttpStatus.SC_HTTP_VERSION_NOT_SUPPORTED;
         } else if (ex instanceof ProtocolException) {
             code = HttpStatus.SC_BAD_REQUEST;
+        } else if (ex instanceof SocketTimeoutException) {
+            code = HttpStatus.SC_GATEWAY_TIMEOUT;
         } else {
             code = HttpStatus.SC_INTERNAL_SERVER_ERROR;
         }


Mime
View raw message