wininet: Load persistent cookies from other paths in get_cookie function.

This commit is contained in:
Piotr Caban 2013-04-24 15:43:31 +02:00 committed by Alexandre Julliard
parent c9d1a1906e
commit 103693e43b
1 changed files with 27 additions and 2 deletions

View File

@ -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;