Jacek Caban : wininet: Added support for INTERNET_COOKIE_HTTPONLY flag to InternetGetCookieEx.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jul 4 14:07:33 CDT 2014


Module: wine
Branch: master
Commit: db441cf58f03396315fb8ae507c1f6fd3a1ed742
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=db441cf58f03396315fb8ae507c1f6fd3a1ed742

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Jul  4 14:45:34 2014 +0200

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 36e0f60..0af8c38 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 af57d9e..ffd31e6 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 233c40c..2647f98 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;




More information about the wine-cvs mailing list