mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 22:01:31 +02:00
MINOR: cache: add method to cache hash
Current HTTP cache hash contains only the Host header and the url path. That said, request method should also be added to the mix to support caching other request methods on the same URL. IE GET and OPTIONS.
This commit is contained in:
parent
6386481cbb
commit
db92a836f4
16
src/cache.c
16
src/cache.c
@ -1041,9 +1041,9 @@ enum act_parse_ret parse_cache_store(const char **args, int *orig_arg, struct pr
|
|||||||
return ACT_RET_PRS_OK;
|
return ACT_RET_PRS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This produces a sha1 hash of the concatenation of the first
|
/* This produces a sha1 hash of the concatenation of the HTTP method,
|
||||||
* occurrence of the Host header followed by the path component if it
|
* the first occurrence of the Host header followed by the path component
|
||||||
* begins with a slash ('/'). */
|
* if it begins with a slash ('/'). */
|
||||||
int sha1_hosturi(struct stream *s)
|
int sha1_hosturi(struct stream *s)
|
||||||
{
|
{
|
||||||
struct http_txn *txn = s->txn;
|
struct http_txn *txn = s->txn;
|
||||||
@ -1056,6 +1056,16 @@ int sha1_hosturi(struct stream *s)
|
|||||||
|
|
||||||
trash = get_trash_chunk();
|
trash = get_trash_chunk();
|
||||||
ctx.blk = NULL;
|
ctx.blk = NULL;
|
||||||
|
|
||||||
|
switch (txn->meth) {
|
||||||
|
case HTTP_METH_HEAD:
|
||||||
|
case HTTP_METH_GET:
|
||||||
|
chunk_memcat(trash, "GET", 3);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!http_find_header(htx, ist("Host"), &ctx, 0))
|
if (!http_find_header(htx, ist("Host"), &ctx, 0))
|
||||||
return 0;
|
return 0;
|
||||||
chunk_memcat(trash, ctx.value.ptr, ctx.value.len);
|
chunk_memcat(trash, ctx.value.ptr, ctx.value.len);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user