tempesta-tech / tempesta

All-in-one solution for high performance web content delivery and advanced protection against DDoS and web attacks
https://tempesta-tech.com/
GNU General Public License v2.0
623 stars 103 forks source link

Correct upstream connection closing #2280

Open const-t opened 1 week ago

const-t commented 1 week ago

Commit ef121120ad4b0798b74da56fd19f4b21cd09fa81

Looking this code I can assume following behavior: When error occurred, Tempesta sends error response, however if at this moment new segment will be received it will be passed to tfw_connection_recv() and again to tfw_http_resp_process() that not expected at this moment. Seems here we should mark connection as Conn_Stop.

Need to develop the new test for this issue. The test:

  1. Send 3 requests from 3 different clients.
  2. Prepare 3 pretty large responses. First one invalid, for instance with invalid header.
  3. Send 1 byte segmented response to Tempesta.
  4. Check the first client received valid response and that connections with another two clients was closed.

Also case T_BLOCK in this place looks strange, because tfw_http_parse_resp() must doesn't return T_BLOCK. Please check it out.