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 0E11E200B85 for ; Thu, 1 Sep 2016 00:25:08 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 09CB5160AB5; Wed, 31 Aug 2016 22:25:08 +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 29147160AB4 for ; Thu, 1 Sep 2016 00:25:07 +0200 (CEST) Received: (qmail 21814 invoked by uid 500); 31 Aug 2016 22:25:05 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 21801 invoked by uid 99); 31 Aug 2016 22:25:05 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Aug 2016 22:25:05 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 7E2F9CA190 for ; Wed, 31 Aug 2016 22:25:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.001 X-Spam-Level: X-Spam-Status: No, score=-0.001 tagged_above=-999 required=6.31 tests=[SPF_PASS=-0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id ABMgf7jhRN58 for ; Wed, 31 Aug 2016 22:25:02 +0000 (UTC) Received: from thor.wissensbank.com (thor.wissensbank.com [81.169.250.120]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id D8FB85F30B for ; Wed, 31 Aug 2016 22:25:01 +0000 (UTC) Received: from thor.wissensbank.com (localhost [127.0.0.1]) by thor.wissensbank.com (Postfix) with ESMTP id 9D6A715A608D5 for ; Thu, 1 Sep 2016 00:24:54 +0200 (CEST) Received: by thor.wissensbank.com (Postfix, from userid 500) id 8F71215A60F25; Thu, 1 Sep 2016 00:24:54 +0200 (CEST) Received: from [192.168.245.129] (8.150.14.62.static.jazztel.es [62.14.150.8]) (Authenticated sender: andre.warnier@ice-sa.com) by thor.wissensbank.com (Postfix) with ESMTPA id 9D1AF15A608D5 for ; Thu, 1 Sep 2016 00:24:53 +0200 (CEST) From: =?UTF-8?Q?Andr=c3=a9_Warnier_=28tomcat=29?= Subject: Re: Why is Tomcat sending "Connection: close?" To: users@tomcat.apache.org References: <57C6FD79.30003@ice-sa.com> Message-ID: <57C75927.9020306@ice-sa.com> Date: Thu, 1 Sep 2016 00:24:39 +0200 User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP archived-at: Wed, 31 Aug 2016 22:25:08 -0000 Hi. Please do not top-post your responses on this list. See : http://tomcat.apache.org/lists.html#tomcat-users # 6) > > > -----Original Message----- > From: Andr Warnier (tomcat) [mailto:aw@ice-sa.com] > Sent: Wednesday, August 31, 2016 10:53 AM > To: users@tomcat.apache.org > Subject: Re: Why is Tomcat sending "Connection: close?" > > On 31.08.2016 17:50, John.E.Gregg@wellsfargo.com wrote: >> All, >> >> I'm using Tomcat 7.0.70 and am having trouble understanding why Tomcat is sending "Connection: close" in the response header as often as it is. With almost no load on the server, I get "Connection: close" pretty much every time. The client is sending "Connection: keep-alive" but it doesn't seem to matter. HTTP protocol is 1.1 and response code is 200. >> >> In other cases I've seen Tomcat behave exactly the way the doc says the below config should behave (100 requests per connection as long as the timeout is not exceeded) but not this time. >> >> Any idea why this is occurring or where to look to debug it? I've tried setting breakpoints in AbstractHttp11Processor where "Connection: close" is set, but it's not hit. >> >> Thanks >> >> John >> >> Here is my connector config: >> >> > protocol="HTTP/1.1" >> SSLEnabled="true" >> maxThreads="80" >> maxKeepAliveRequests="100" >> keepAliveTimeout="10000" >> scheme="https" >> secure="true" >> clientAuth="true" >> sslProtocol="TLS" >> sslEnabledProtocols="TLSv1,TLSv1.1,TLSv1.2,SSLv2Hello,SSLv3" >> keystoreFile="${keystoreFile}" >> keystorePass="${keystorePassword}" >> keyAlias="test" >> truststoreFile="${truststoreFile}" >> truststorePass="${truststorePassword}" >> allowUnsafeLegacyRenegotiation="false" >> ciphers="SSL_DH_DSS_WITH_3DES_EDE_CBC_SHA, >> SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, SSL_DHE_RSA_WITH_3DES_EDE_ CBC_SHA, >> SSL_DH_RSA_WITH_3DES_EDE_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA, >> SSL_RSA_WITH_RC4_128_SHA, TLS_DHE_DSS_WITH_AES _128_CBC_SHA, >> TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, >> TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_ >> ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, >> TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_EC DSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WIT H_3DES_EDE_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDH_RSA_WITH_3DES_EDE_C BC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH _AES_256_CBC_SHA" >> /> >> > > Sorry to ask, but are you positive that there is *nothing* between the browser and Tomcat ? (I mean like a firewall, proxy server, etc..) > > > No, unfortunately not. I put "%{Connection}i %{Connection}o" in the log config and get "Keep-Alive close." IOW the client sends Keep-Alive but Tomcat responds with close. > There are a number of scenarios in which a webserver - not only Tomcat - would send a "Connection: close" header in a response, and close the connection after sending the response. For the gory details, see https://tools.ietf.org/html/rfc7230#section-6.3 etc.. Simplified : - if a webserver knows in advance the size of the response body, then it would normally send a "Content-length: xxx" header, followed by a response body of exactly that length. In such a case also, it should normally honor the keep-alive request of the client, and not close the connection - if the server does not know in advance the size of the response body (e.g. it is generated dynamically by a script or servlet or such), then it cannot send a Content-length header in advance, and it has 2 choices : a) use a "Transfer-encoding: chunked" method, whereby the response body is "packaged" in successive "chunks", each with a header giving its chunk length, the sequence being terminated by a zero-length chunk (which tells the client that this response is finished) or b) if it cannot use (or is forbidden to use) the above for some reason, then the only way is to send the response body as it arrives from whatever generates it, and when that body ends, and it has sent the whole body to the client, close the connection. The closing of the connection then acts for the client as a signal that the response to this request is finished (as there would be no way for the client otherwise to know if there is more to come or not). In such a case, if the webserver were to know in advance that this is the case (before sending the first chunk of the response body to the client), it would be good practice for the server to also send a "Connection: close" in the headers of the response. So, assuming at first that there is no related bug in the Tomcat 7 code, would it be conceivable that the webapp would somehow generate its response in such a way that a) Tomcat does not know in advance the size of that response and b) Tomcat is prevented from using the "Content-encoding: chunked" method ? I found for example this which might be relevant : http://stackoverflow.com/questions/6299432/how-do-disable-transfer-encoding-in-tomcat-6 --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org