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.

32 lines
1.4 KiB

  1. commit 032cff38c24d8359dc575423a94d19b6ad8bf848
  2. Author: Christopher Faulet <cfaulet@haproxy.com>
  3. Date: Mon Jun 17 11:44:47 2019 +0200
  4. BUG/MEDIUM: h2/htx: Update data length of the HTX when the cookie list is built
  5. When an H2 request is converted into an HTX message, All cookie headers are
  6. grouped into one, each value separated by a semicolon (;). To do so, we add the
  7. header "cookie" with the first value and then we update the value by appending
  8. other cookies. But during this operation, only the size of the HTX block is
  9. updated. And not the data length of the whole HTX message.
  10. It is an old bug and it seems to work by chance till now. But it may lead to
  11. undefined behaviour by time to time.
  12. This patch must be backported to 2.0 and 1.9
  13. (cherry picked from commit 0c6de00d7c842a682bba7586ef34fb10f69ec63c)
  14. Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
  15. diff --git a/src/h2.c b/src/h2.c
  16. index 9681aca5..32c1ef16 100644
  17. --- a/src/h2.c
  18. +++ b/src/h2.c
  19. @@ -737,6 +737,7 @@ int h2_make_htx_request(struct http_hdr *list, struct htx *htx, unsigned int *ms
  20. goto fail;
  21. htx_set_blk_value_len(blk, tl);
  22. + htx->data += vl+2;
  23. *(char *)(htx_get_blk_ptr(htx, blk) + bs + 0) = ';';
  24. *(char *)(htx_get_blk_ptr(htx, blk) + bs + 1) = ' ';
  25. memcpy(htx_get_blk_ptr(htx, blk) + bs + 2, list[ck].v.ptr, vl);