Module: wine Branch: master Commit: 103693e43b97d9133ab8d0f9b5cacc8f7c540b81 URL: http://source.winehq.org/git/wine.git/?a=commit;h=103693e43b97d9133ab8d0f9b5...
Author: Piotr Caban piotr@codeweavers.com Date: Wed Apr 24 15:43:31 2013 +0200
wininet: Load persistent cookies from other paths in get_cookie function.
---
dlls/wininet/cookie.c | 29 +++++++++++++++++++++++++++-- 1 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/dlls/wininet/cookie.c b/dlls/wininet/cookie.c index 61aa53b..d20ad26 100644 --- a/dlls/wininet/cookie.c +++ b/dlls/wininet/cookie.c @@ -533,8 +533,11 @@ static void COOKIE_deleteDomain(cookie_domain *deadDomain)
DWORD get_cookie(const WCHAR *host, const WCHAR *path, WCHAR *cookie_data, DWORD *size) { + static const WCHAR empty_path[] = { '/',0 }; + unsigned cnt = 0, len, name_len, domain_count = 0, cookie_count = 0; - WCHAR *ptr = cookie_data; + WCHAR *ptr, subpath[INTERNET_MAX_PATH_LENGTH]; + const WCHAR *p; cookie_domain *domain; FILETIME tm;
@@ -542,8 +545,30 @@ DWORD get_cookie(const WCHAR *host, const WCHAR *path, WCHAR *cookie_data, DWORD
EnterCriticalSection(&cookie_cs);
- load_persistent_cookie(host, path); + len = strlenW(host); + p = host+len; + while(p>host && p[-1]!='.') p--; + while(p != host) { + p--; + while(p>host && p[-1]!='.') p--; + if(p == host) break; + + load_persistent_cookie(p, empty_path); + } + + len = strlenW(path); + assert(len+1 < INTERNET_MAX_PATH_LENGTH); + memcpy(subpath, path, (len+1)*sizeof(WCHAR)); + ptr = subpath+len; + do { + *ptr = 0; + load_persistent_cookie(host, subpath); + + ptr--; + while(ptr>subpath && ptr[-1]!='/') ptr--; + }while(ptr != subpath);
+ ptr = cookie_data; LIST_FOR_EACH_ENTRY(domain, &domain_list, cookie_domain, entry) { struct list *cursor, *cursor2;