Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/winhttp/cookie.c | 7 +++++++ dlls/winhttp/session.c | 4 ++++ dlls/winhttp/winhttp_private.h | 1 + 3 files changed, 12 insertions(+)
Hi Jacek,
diff --git a/dlls/winhttp/cookie.c b/dlls/winhttp/cookie.c index 63cbde7c3d..56c0821f2a 100644 --- a/dlls/winhttp/cookie.c +++ b/dlls/winhttp/cookie.c @@ -286,7 +286,10 @@ BOOL set_cookies( request_t *request, const WCHAR *cookies ) if (!cookie_path && !(cookie_path = strdupW( request->path ))) goto end; if ((p = strrchrW( cookie_path, '/' )) && p != cookie_path) *p = 0;
+ EnterCriticalSection( &session->cs ); ret = add_cookie( session, cookie, cookie_domain, cookie_path ); + LeaveCriticalSection( &session->cs );
I would prefer to do this inside add_cookie, just like you do in add_cookie_headers.
end: if (!ret) free_cookie( cookie ); @@ -303,6 +306,8 @@ BOOL add_cookie_headers( request_t *request ) struct list *domain_cursor; session_t *session = request->connect->session; + EnterCriticalSection( &session->cs );
LIST_FOR_EACH( domain_cursor, &session->cookie_cache ) { domain_t *domain = LIST_ENTRY( domain_cursor, domain_t, entry ); @@ -343,5 +348,7 @@ BOOL add_cookie_headers( request_t *request ) } } }
+ LeaveCriticalSection( &session->cs ); return TRUE;
There's an error return in the middle that should unlock too.