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.

37 lines
1.6 KiB

  1. commit a8fcdacb8cc0dddec72b1ddc4d9afc92d3684acd
  2. Author: Willy Tarreau <w@1wt.eu>
  3. Date: Fri Aug 2 07:48:47 2019 +0200
  4. BUG/MEDIUM: mux-h2: unbreak receipt of large DATA frames
  5. Recent optimization in commit 4d7a88482 ("MEDIUM: mux-h2: don't try to
  6. read more than needed") broke the receipt of large DATA frames because
  7. it would unconditionally subscribe if there was some room left, thus
  8. preventing any new rx from being done since subscription may only be
  9. done once the end was reached, as indicated by ret == 0.
  10. However, fixing this uncovered that in HTX mode previous versions might
  11. occasionally be affected as well, when an available frame is the same
  12. size as the maximum data that may fit into an HTX buffer, we may end
  13. up reading that whole frame and still subscribe since it's still allowed
  14. to receive, thus causing issues to read the next frame.
  15. This patch will only work for 2.1-dev but a minor adaptation will be
  16. needed for earlier versions (down to 1.9, where subscribe() was added).
  17. (cherry picked from commit 9bc1c95855b9c6300de5ecf3720cbe4b2558c5a1)
  18. Signed-off-by: Willy Tarreau <w@1wt.eu>
  19. diff --git a/src/mux_h2.c b/src/mux_h2.c
  20. index 5bb85181..d605fe94 100644
  21. --- a/src/mux_h2.c
  22. +++ b/src/mux_h2.c
  23. @@ -2766,7 +2766,7 @@ static int h2_recv(struct h2c *h2c)
  24. ret = 0;
  25. } while (ret > 0);
  26. - if (h2_recv_allowed(h2c) && (b_data(buf) < buf->size))
  27. + if (max && !ret && h2_recv_allowed(h2c))
  28. conn->xprt->subscribe(conn, conn->xprt_ctx, SUB_RETRY_RECV, &h2c->wait_event);
  29. if (!b_data(buf)) {