jira-importer opened a new issue, #1205:
URL: https://github.com/apache/httpcomponents-core/issues/1205

   **[Vitalina 
Komarova](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=horyukova)**
 opened 
**[HTTPCORE-684](https://issues.apache.org/jira/browse/HTTPCORE-684?redirect=false)**
 and commented
   
   Hello.
   We use AsyncHttpClient from Apache HttpClient5 (version 5.1).
   We faced an error when connection is unexpectedly closed using TLS, forced 
HTTP/1.1, and nginx version older 1.18.0.
   
   In the log below the server responds with 200 OK and an empty body.
   We can see response headers but connection is prematurely closed.
   
   ```
   [2021-08-16T20:22:50.950+03:00] … [headers] c-0000000000 << HTTP/1.1 200 OK
   [2021-08-16T20:22:50.950+03:00] … [headers] c-0000000000 << Server: nginx
   [2021-08-16T20:22:50.950+03:00] … [headers] c-0000000000 << Date: Mon, 16 
Aug 2021 17:22:50 GMT
   [2021-08-16T20:22:50.951+03:00] … [headers] c-0000000000 << Content-Type: 
text/html; charset=UTF-8
   [2021-08-16T20:22:50.951+03:00] … [headers] c-0000000000 << Connection: close
   [2021-08-16T20:22:50.951+03:00] … [headers] c-0000000000 << Set-Cookie: 
<masked cookie>; expires=Sat, 21-Aug-2021 17:22:50 GMT; Max-Age=432000; path=/
   [2021-08-16T20:22:50.951+03:00] … [headers] c-0000000000 << Expires: Thu, 19 
Nov 1981 08:52:00 GMT
   [2021-08-16T20:22:50.951+03:00] … [headers] c-0000000000 << Cache-Control: 
no-store, no-cache, must-revalidate
   [2021-08-16T20:22:50.951+03:00] … [headers] c-0000000000 << Pragma: no-cache
   [2021-08-16T20:22:50.954+03:00] … [HttpAsyncMainClientExec] ex-0000000001 
consume response HTTP/1.1 200 OK, entity len -9223372036854775807
   [2021-08-16T20:22:50.967+03:00] … [HttpAsyncMainClientExec] ex-0000000001 
execution failed: Connection is closed
   [2021-08-16T20:22:50.968+03:00] … [InternalAbstractHttpAsyncClient] 
ex-0000000001 request failed: Connection is closed
   [2021-08-16T20:22:50.968+03:00] … [PoolingAsyncClientConnectionManager] 
ep-0000000000 close IMMEDIATE
   [2021-08-16T20:22:50.968+03:00] … [DefaultManagedAsyncClientConnection] 
c-0000000000 Shutdown connection IMMEDIATE
   ```
   
   That happens with the almost default configuration of the HTTP client (only 
versionPolicy and tlsStrategy are configured).
   
   To reproduce such behavior all of these conditions must be met:
   1) Server must be accessed via nginx version older 1.18.0 (I tested 1.16.1 
and 1.18.0);
   2) A request contains a body;
   3) A response doesn't contain "Content-Length" header;
   4) TLS is used.
   5) HTTP/1.1 is used.
   
   I think there is a bug. We've tried httpclient5 (classic, version 5.1) and 
AsyncHttpClient (Netty based). Both of them work correctly.
   
   
   
   ---
   
   **Affects:** 5.0.3, 5.1.1
   
   **Attachments:**
   - 
[broken_async_5_1.txt](https://issues.apache.org/jira/secure/attachment/13032806/broken_async_5_1.txt)
 (_15.81 kB_)
   - 
[broken_async_snapshot.txt](https://issues.apache.org/jira/secure/attachment/13032805/broken_async_snapshot.txt)
 (_16.23 kB_)
   - 
[ok_async_without_body_5_1.txt](https://issues.apache.org/jira/secure/attachment/13032808/ok_async_without_body_5_1.txt)
 (_15.74 kB_)
   - 
[ok_sync_5_1.txt](https://issues.apache.org/jira/secure/attachment/13032807/ok_sync_5_1.txt)
 (_9.74 kB_)
   
   **Backported to:** 
[5.1.2](https://github.com/apache/httpcomponents-core/milestone/74?closed=1)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to