From db441cf58f03396315fb8ae507c1f6fd3a1ed742 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 4 Jul 2014 14:45:34 +0200 Subject: [PATCH] wininet: Added support for INTERNET_COOKIE_HTTPONLY flag to InternetGetCookieEx. --- dlls/wininet/cookie.c | 7 +++++-- dlls/wininet/http.c | 4 ++-- dlls/wininet/internet.h | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/dlls/wininet/cookie.c b/dlls/wininet/cookie.c index 36e0f60467f..0af8c38dafe 100644 --- a/dlls/wininet/cookie.c +++ b/dlls/wininet/cookie.c @@ -531,7 +531,7 @@ static void COOKIE_deleteDomain(cookie_domain *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 }; @@ -590,6 +590,9 @@ DWORD get_cookie(const WCHAR *host, const WCHAR *path, WCHAR *cookie_data, DWORD continue; } + if((cookie_iter->flags & INTERNET_COOKIE_HTTPONLY) && !(flags & INTERNET_COOKIE_HTTPONLY)) + continue; + if (cookie_count) cnt += 2; /* '; ' */ cnt += name_len = strlenW(cookie_iter->lpCookieName); @@ -686,7 +689,7 @@ BOOL WINAPI InternetGetCookieExW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName, return FALSE; } - res = get_cookie(host, path, lpCookieData, lpdwSize); + res = get_cookie(host, path, lpCookieData, lpdwSize, flags); if(res != ERROR_SUCCESS) SetLastError(res); return res == ERROR_SUCCESS; diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index af57d9e9cb1..ffd31e69010 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -4186,7 +4186,7 @@ static void HTTP_InsertCookies(http_request_t *request) if(!host) 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; size = sizeof(cookieW) + cookie_size * sizeof(WCHAR) + sizeof(szCrLf); @@ -4194,7 +4194,7 @@ static void HTTP_InsertCookies(http_request_t *request) return; 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); HTTP_HttpAddRequestHeadersW(request, cookies, strlenW(cookies), HTTP_ADDREQ_FLAG_REPLACE); diff --git a/dlls/wininet/internet.h b/dlls/wininet/internet.h index 233c40c3ff7..2647f98fa8a 100644 --- a/dlls/wininet/internet.h +++ b/dlls/wininet/internet.h @@ -420,7 +420,7 @@ DWORD HTTP_Connect(appinfo_t*,LPCWSTR, BOOL GetAddress(LPCWSTR lpszServerName, INTERNET_PORT nServerPort, 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; void INTERNET_SetLastError(DWORD dwError) DECLSPEC_HIDDEN; -- 2.11.4.GIT