Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 3A1D3200CDF for ; Thu, 17 Aug 2017 16:14:09 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 388DB16AF6C; Thu, 17 Aug 2017 14:14:09 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 7E5EA16AF68 for ; Thu, 17 Aug 2017 16:14:08 +0200 (CEST) Received: (qmail 21997 invoked by uid 500); 17 Aug 2017 14:14:05 -0000 Mailing-List: contact commits-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list commits@hc.apache.org Received: (qmail 21988 invoked by uid 99); 17 Aug 2017 14:14:05 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Aug 2017 14:14:05 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C27AAE0618; Thu, 17 Aug 2017 14:14:05 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: olegk@apache.org To: commits@hc.apache.org Message-Id: <6fe40a22a86a44edbb6293d737ba6c55@git.apache.org> X-Mailer: ASF-Git Admin Mailer 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 +0000 (UTC) archived-at: Thu, 17 Aug 2017 14:14:09 -0000 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 Authored: Wed Aug 16 16:54:24 2017 -0600 Committer: Oleg Kalnichevski 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; }