You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.9 KiB

  1. From 3de8e7ab8d9125402cc1a8fb48ee475ee21d7d4c Mon Sep 17 00:00:00 2001
  2. From: Willy Tarreau <w@1wt.eu>
  3. Date: Wed, 25 Nov 2015 20:11:11 +0100
  4. Subject: [PATCH 06/10] BUG/MEDIUM: http: don't enable auto-close on the
  5. response side
  6. There is a bug where "option http-keep-alive" doesn't force a response
  7. to stay in keep-alive if the server sends the FIN along with the response
  8. on the second or subsequent response. The reason is that the auto-close
  9. was forced enabled when recycling the HTTP transaction and it's never
  10. disabled along the response processing chain before the SHUTR gets a
  11. chance to be forwarded to the client side. The MSG_DONE state of the
  12. HTTP response properly disables it but too late.
  13. There's no more reason for enabling auto-close here, because either it
  14. doesn't matter in non-keep-alive modes because the connection is closed,
  15. or it is automatically enabled by process_stream() when it sees there's
  16. no analyser on the stream.
  17. This bug also affects 1.5 so a backport is desired.
  18. (cherry picked from commit 714ea78c9a09fe6a35a1f2d86af8f7fc9abb64d1)
  19. (cherry picked from commit a15091be17f27fcf4e3a84338df1a8b732e396a1)
  20. ---
  21. src/proto_http.c | 6 ++++--
  22. 1 file changed, 4 insertions(+), 2 deletions(-)
  23. diff --git a/src/proto_http.c b/src/proto_http.c
  24. index b32e778..5facfbb 100644
  25. --- a/src/proto_http.c
  26. +++ b/src/proto_http.c
  27. @@ -4946,11 +4946,13 @@ void http_end_txn_clean_session(struct session *s)
  28. s->rep->flags |= CF_EXPECT_MORE;
  29. }
  30. - /* we're removing the analysers, we MUST re-enable events detection */
  31. + /* we're removing the analysers, we MUST re-enable events detection.
  32. + * We don't enable close on the response channel since it's either
  33. + * already closed, or in keep-alive with an idle connection handler.
  34. + */
  35. channel_auto_read(s->req);
  36. channel_auto_close(s->req);
  37. channel_auto_read(s->rep);
  38. - channel_auto_close(s->rep);
  39. /* we're in keep-alive with an idle connection, monitor it */
  40. si_idle_conn(s->req->cons);
  41. --
  42. 2.4.10