diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2011-09-19 21:33:52 +0200 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2011-09-19 21:33:52 +0200 |
commit | abd446c2eebe1f96764b6d95f1c6c61ae9bc40b2 (patch) | |
tree | b313bbeebf50fd53369d303824edab57aa69d016 /src/cookies.c | |
parent | b0b0cddaff10b4cff371b8bb7aa21e045f8e3915 (diff) | |
parent | 0caf22a3f7c33578a073cee42c6cfa61f971bc42 (diff) |
merge
Diffstat (limited to 'src/cookies.c')
-rw-r--r-- | src/cookies.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/cookies.c b/src/cookies.c index 7b9062e2..d1451dc1 100644 --- a/src/cookies.c +++ b/src/cookies.c @@ -179,7 +179,7 @@ void a_Cookies_set(Dlist *cookie_strings, const DilloUrl *set_url, /* * Return a string containing cookie data for an HTTP query. */ -char *a_Cookies_get_query(const DilloUrl *request_url) +char *a_Cookies_get_query(const DilloUrl *query_url, const DilloUrl *requester) { char *cmd, *dpip_tag, *query; const char *path; @@ -188,16 +188,25 @@ char *a_Cookies_get_query(const DilloUrl *request_url) if (disabled) return dStrdup(""); - action = Cookies_control_check(request_url); + action = Cookies_control_check(query_url); if (action == COOKIE_DENY) { - _MSG("Cookies: denied GET for %s\n", URL_HOST_(request_url)); + _MSG("Cookies: denied GET for %s\n", URL_HOST_(query_url)); return dStrdup(""); } - path = URL_PATH_(request_url); + + if (requester == NULL) { + /* request made by user */ + } else if (!a_Url_same_organization(query_url, requester)) { + MSG("Cookies: No cookies sent for third-party request by '%s' for " + "'%s'\n", URL_HOST(requester), URL_STR(query_url)); + return dStrdup(""); + } + + path = URL_PATH_(query_url); cmd = a_Dpip_build_cmd("cmd=%s scheme=%s host=%s path=%s", - "get_cookie", URL_SCHEME(request_url), - URL_HOST(request_url), path ? path : "/"); + "get_cookie", URL_SCHEME(query_url), + URL_HOST(query_url), path ? path : "/"); /* Get the answer from cookies.dpi */ _MSG("cookies.c: a_Dpi_send_blocking_cmd cmd = {%s}\n", cmd); |