diff options
author | corvid <corvid@lavabit.com> | 2009-12-30 06:38:20 +0000 |
---|---|---|
committer | corvid <corvid@lavabit.com> | 2009-12-30 06:38:20 +0000 |
commit | 8e9f32b0e94670410c2b390f7ba9e06ca0a78a76 (patch) | |
tree | 0a9bd317b889ef68fffafe893a2a27cbd676592c /dpi/cookies.c | |
parent | da2b99e1c2a34d6c1f6f45a84e359b3cbbcd7dc4 (diff) |
cookies with longer paths go first in header
Diffstat (limited to 'dpi/cookies.c')
-rw-r--r-- | dpi/cookies.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/dpi/cookies.c b/dpi/cookies.c index 5641e878..785e4282 100644 --- a/dpi/cookies.c +++ b/dpi/cookies.c @@ -1202,7 +1202,20 @@ static char *Cookies_get(char *url_host, char *url_path, } /* Check if the cookie matches the requesting URL */ if (Cookies_match(cookie, url_port, path, is_ssl)) { - dList_append(matching_cookies, cookie); + int j; + CookieData_t *curr; + uint_t path_length = strlen(cookie->path); + + /* "If multiple cookies satisfy the criteria [to be sent in a + * query], they are ordered in the Cookie header such that those + * with more specific Path attributes precede those with less + * specific." + */ + for (j = 0; + (curr = dList_nth_data(matching_cookies, j)) && + strlen(curr->path) >= path_length; + j++) ; + dList_insert_pos(matching_cookies, cookie, j); } } } |