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

   **[Yannick 
Dylla](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=ydylla)** 
opened 
**[HTTPCORE-607](https://issues.apache.org/jira/browse/HTTPCORE-607?redirect=false)**
 and commented
   
   Hi,
   I think I found a regression or rather a bug. I noticed that 
`httpcore-nio:4.4.11` is always sending a 504 gateway timeout header after a 
connection times out. This also happens with keep alive connections where the 
application code already send a valid response, which then leads to the client 
receiving an unexpected http header. Many clients seam to ignore it but this is 
not valid http.
   
   This behavior was added with 
[HTTPCORE-482](https://issues.apache.org/jira/browse/HTTPCORE-482) and thus 
`httpcore-nio:4.4.6` is the last version that in my opinion works correctly by 
just closing the tcp connection. Maybe a solution is that the connection 
remembers that it already send a response instead of a complete reset and now 
is in keep alive mode?
   
   You can see/reproduce this with the following server & client example while 
capturing their traffic with wireshark.
   1. Start wireshark with the filter: `tcp.srcport == 12345 || tcp.dstport == 
12345`
   2. Start the server ([^KeepAliveExampleServer.java]) which then listens on 
port 12345 with a 10s socket timeout and always responds with "Hello World".
   3. Start the client ([^KeepAliveExampleClient.java]) which will make 3 
requests against the server. The 1st & 2nd request should use the same tcp 
connection. The 3rd should happen after the socket timeout of the server and 
thus open a new tcp connection.
   
   I have also prepared some captures for you, the unwanted http header is in 
packet 12 of  [^httpcore-nio-4.4.11-unwanted-504-header.pcapng]. The capture 
[^httpcore-nio-4.4.6-working.pcapng] shows the expected behavior.
   
   
   ---
   
   **Affects:** 4.4.11, 4.4.12
   
   **Attachments:**
   - 
[httpcore-nio-4.4.11-unwanted-504-header.pcapng](https://issues.apache.org/jira/secure/attachment/12983150/httpcore-nio-4.4.11-unwanted-504-header.pcapng)
 (_3.62 kB_)
   - 
[httpcore-nio-4.4.6-working.pcapng](https://issues.apache.org/jira/secure/attachment/12983149/httpcore-nio-4.4.6-working.pcapng)
 (_3.31 kB_)
   - 
[KeepAliveExampleClient.java](https://issues.apache.org/jira/secure/attachment/12983151/KeepAliveExampleClient.java)
 (_1.61 kB_)
   - 
[KeepAliveExampleServer.java](https://issues.apache.org/jira/secure/attachment/12983152/KeepAliveExampleServer.java)
 (_2.66 kB_)
   
   1 votes, 4 watchers
   


-- 
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