wininet: Added support for INTERNET_COOKIE_HTTPONLY flag to InternetGetCookieEx.

This commit is contained in:
Jacek Caban 2014-07-04 14:45:34 +02:00 committed by Alexandre Julliard
parent 314e295820
commit db441cf58f
3 changed files with 8 additions and 5 deletions

View File

@ -531,7 +531,7 @@ static void COOKIE_deleteDomain(cookie_domain *deadDomain)
heap_free(deadDomain); heap_free(deadDomain);
} }
DWORD get_cookie(const WCHAR *host, const WCHAR *path, WCHAR *cookie_data, DWORD *size) DWORD get_cookie(const WCHAR *host, const WCHAR *path, WCHAR *cookie_data, DWORD *size, DWORD flags)
{ {
static const WCHAR empty_path[] = { '/',0 }; static const WCHAR empty_path[] = { '/',0 };
@ -590,6 +590,9 @@ DWORD get_cookie(const WCHAR *host, const WCHAR *path, WCHAR *cookie_data, DWORD
continue; continue;
} }
if((cookie_iter->flags & INTERNET_COOKIE_HTTPONLY) && !(flags & INTERNET_COOKIE_HTTPONLY))
continue;
if (cookie_count) if (cookie_count)
cnt += 2; /* '; ' */ cnt += 2; /* '; ' */
cnt += name_len = strlenW(cookie_iter->lpCookieName); cnt += name_len = strlenW(cookie_iter->lpCookieName);
@ -686,7 +689,7 @@ BOOL WINAPI InternetGetCookieExW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName,
return FALSE; return FALSE;
} }
res = get_cookie(host, path, lpCookieData, lpdwSize); res = get_cookie(host, path, lpCookieData, lpdwSize, flags);
if(res != ERROR_SUCCESS) if(res != ERROR_SUCCESS)
SetLastError(res); SetLastError(res);
return res == ERROR_SUCCESS; return res == ERROR_SUCCESS;

View File

@ -4186,7 +4186,7 @@ static void HTTP_InsertCookies(http_request_t *request)
if(!host) if(!host)
return; return;
if(get_cookie(host->lpszValue, request->path, NULL, &cookie_size) != ERROR_SUCCESS) if(get_cookie(host->lpszValue, request->path, NULL, &cookie_size, INTERNET_COOKIE_HTTPONLY) != ERROR_SUCCESS)
return; return;
size = sizeof(cookieW) + cookie_size * sizeof(WCHAR) + sizeof(szCrLf); size = sizeof(cookieW) + cookie_size * sizeof(WCHAR) + sizeof(szCrLf);
@ -4194,7 +4194,7 @@ static void HTTP_InsertCookies(http_request_t *request)
return; return;
cnt += sprintfW(cookies, cookieW); cnt += sprintfW(cookies, cookieW);
get_cookie(host->lpszValue, request->path, cookies+cnt, &cookie_size); get_cookie(host->lpszValue, request->path, cookies+cnt, &cookie_size, INTERNET_COOKIE_HTTPONLY);
strcatW(cookies, szCrLf); strcatW(cookies, szCrLf);
HTTP_HttpAddRequestHeadersW(request, cookies, strlenW(cookies), HTTP_ADDREQ_FLAG_REPLACE); HTTP_HttpAddRequestHeadersW(request, cookies, strlenW(cookies), HTTP_ADDREQ_FLAG_REPLACE);

View File

@ -420,7 +420,7 @@ DWORD HTTP_Connect(appinfo_t*,LPCWSTR,
BOOL GetAddress(LPCWSTR lpszServerName, INTERNET_PORT nServerPort, BOOL GetAddress(LPCWSTR lpszServerName, INTERNET_PORT nServerPort,
struct sockaddr *psa, socklen_t *sa_len) DECLSPEC_HIDDEN; struct sockaddr *psa, socklen_t *sa_len) DECLSPEC_HIDDEN;
DWORD get_cookie(const WCHAR*,const WCHAR*,WCHAR*,DWORD*) DECLSPEC_HIDDEN; DWORD get_cookie(const WCHAR*,const WCHAR*,WCHAR*,DWORD*,DWORD) DECLSPEC_HIDDEN;
DWORD set_cookie(const WCHAR*,const WCHAR*,const WCHAR*,const WCHAR*,DWORD) DECLSPEC_HIDDEN; DWORD set_cookie(const WCHAR*,const WCHAR*,const WCHAR*,const WCHAR*,DWORD) DECLSPEC_HIDDEN;
void INTERNET_SetLastError(DWORD dwError) DECLSPEC_HIDDEN; void INTERNET_SetLastError(DWORD dwError) DECLSPEC_HIDDEN;