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.

45 lines
1.6 KiB

  1. From c1fbbd4a3dd480b4eebbd8b32ca6cdf08791477a Mon Sep 17 00:00:00 2001
  2. From: Willy Tarreau <w@1wt.eu>
  3. Date: Tue, 24 Jun 2014 17:27:02 +0200
  4. Subject: [PATCH] BUG/MEDIUM: http: fetch "base" is not compatible with
  5. set-header
  6. The sample fetch function "base" makes use of the trash which is also
  7. used by set-header/add-header etc... everything which builds a formated
  8. line. So we end up with some junk in the header if base is in use. Let's
  9. fix this as all other fetches by using a trash chunk instead.
  10. This bug was reported by Baptiste Assmann, and also affects 1.5.
  11. (cherry picked from commit 3caf2afabe89fb0ef0886cd1d8ea99ef21ec3491)
  12. ---
  13. src/proto_http.c | 6 ++++--
  14. 1 file changed, 4 insertions(+), 2 deletions(-)
  15. diff --git a/src/proto_http.c b/src/proto_http.c
  16. index 231d49a..5321f7d 100644
  17. --- a/src/proto_http.c
  18. +++ b/src/proto_http.c
  19. @@ -10247,6 +10247,7 @@ smp_fetch_base(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
  20. struct http_txn *txn = l7;
  21. char *ptr, *end, *beg;
  22. struct hdr_ctx ctx;
  23. + struct chunk *temp;
  24. CHECK_HTTP_MESSAGE_FIRST();
  25. @@ -10255,9 +10256,10 @@ smp_fetch_base(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
  26. return smp_fetch_path(px, l4, l7, opt, args, smp, kw);
  27. /* OK we have the header value in ctx.line+ctx.val for ctx.vlen bytes */
  28. - memcpy(trash.str, ctx.line + ctx.val, ctx.vlen);
  29. + temp = get_trash_chunk();
  30. + memcpy(temp->str, ctx.line + ctx.val, ctx.vlen);
  31. smp->type = SMP_T_STR;
  32. - smp->data.str.str = trash.str;
  33. + smp->data.str.str = temp->str;
  34. smp->data.str.len = ctx.vlen;
  35. /* now retrieve the path */
  36. --
  37. 1.8.5.5