Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
b9c2a195
Commit
b9c2a195
authored
Oct 01, 2012
by
Piotr Caban
Committed by
Alexandre Julliard
Oct 01, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Make cookies functions thread-safe.
parent
fc219b0a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
2 deletions
+31
-2
cookie.c
dlls/wininet/cookie.c
+29
-2
internet.c
dlls/wininet/internet.c
+1
-0
internet.h
dlls/wininet/internet.h
+1
-0
No files found.
dlls/wininet/cookie.c
View file @
b9c2a195
...
...
@@ -49,7 +49,6 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
wininet
);
/* FIXME
* Cookies are NOT THREAD SAFE
* Cookies could use A LOT OF MEMORY. We need some kind of memory management here!
*/
...
...
@@ -78,6 +77,14 @@ struct _cookie_domain
struct
list
cookie_list
;
};
static
CRITICAL_SECTION
cookie_cs
;
static
CRITICAL_SECTION_DEBUG
cookie_cs_debug
=
{
0
,
0
,
&
cookie_cs
,
{
&
cookie_cs_debug
.
ProcessLocksList
,
&
cookie_cs_debug
.
ProcessLocksList
},
0
,
0
,
{
(
DWORD_PTR
)(
__FILE__
": cookie_cs"
)
}
};
static
CRITICAL_SECTION
cookie_cs
=
{
&
cookie_cs_debug
,
-
1
,
0
,
0
,
0
,
0
};
static
struct
list
domain_list
=
LIST_INIT
(
domain_list
);
static
cookie
*
COOKIE_addCookie
(
cookie_domain
*
domain
,
LPCWSTR
name
,
LPCWSTR
data
,
...
...
@@ -529,6 +536,8 @@ BOOL get_cookie(const WCHAR *host, const WCHAR *path, WCHAR *cookie_data, DWORD
GetSystemTimeAsFileTime
(
&
tm
);
EnterCriticalSection
(
&
cookie_cs
);
load_persistent_cookie
(
host
,
path
);
LIST_FOR_EACH_ENTRY
(
domain
,
&
domain_list
,
cookie_domain
,
entry
)
{
...
...
@@ -577,6 +586,8 @@ BOOL get_cookie(const WCHAR *host, const WCHAR *path, WCHAR *cookie_data, DWORD
}
}
LeaveCriticalSection
(
&
cookie_cs
);
if
(
!
domain_count
)
{
TRACE
(
"no cookies found for %s
\n
"
,
debugstr_w
(
host
));
SetLastError
(
ERROR_NO_MORE_ITEMS
);
...
...
@@ -825,6 +836,8 @@ BOOL set_cookie(LPCWSTR domain, LPCWSTR path, LPCWSTR cookie_name, LPCWSTR cooki
}
}
EnterCriticalSection
(
&
cookie_cs
);
load_persistent_cookie
(
domain
,
path
);
LIST_FOR_EACH
(
cursor
,
&
domain_list
)
...
...
@@ -843,6 +856,7 @@ BOOL set_cookie(LPCWSTR domain, LPCWSTR path, LPCWSTR cookie_name, LPCWSTR cooki
{
heap_free
(
data
);
if
(
value
!=
data
)
heap_free
(
value
);
LeaveCriticalSection
(
&
cookie_cs
);
return
TRUE
;
}
}
...
...
@@ -866,11 +880,19 @@ BOOL set_cookie(LPCWSTR domain, LPCWSTR path, LPCWSTR cookie_name, LPCWSTR cooki
{
heap_free
(
data
);
if
(
value
!=
data
)
heap_free
(
value
);
LeaveCriticalSection
(
&
cookie_cs
);
return
FALSE
;
}
heap_free
(
data
);
if
(
value
!=
data
)
heap_free
(
value
);
return
!
update_persistent
||
save_persistent_cookie
(
thisCookieDomain
);
if
(
!
update_persistent
||
save_persistent_cookie
(
thisCookieDomain
))
{
LeaveCriticalSection
(
&
cookie_cs
);
return
TRUE
;
}
LeaveCriticalSection
(
&
cookie_cs
);
return
FALSE
;
}
/***********************************************************************
...
...
@@ -1115,3 +1137,8 @@ BOOL WINAPI InternetSetPerSiteCookieDecisionW( LPCWSTR pchHostName, DWORD dwDeci
FIXME
(
"(%s, 0x%08x) stub
\n
"
,
debugstr_w
(
pchHostName
),
dwDecision
);
return
FALSE
;
}
void
free_cookie
(
void
)
{
DeleteCriticalSection
(
&
cookie_cs
);
}
dlls/wininet/internet.c
View file @
b9c2a195
...
...
@@ -315,6 +315,7 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
collect_connections
(
COLLECT_CLEANUP
);
NETCON_unload
();
free_urlcache
();
free_cookie
();
if
(
g_dwTlsErrIndex
!=
TLS_OUT_OF_INDEXES
)
{
...
...
dlls/wininet/internet.h
View file @
b9c2a195
...
...
@@ -553,6 +553,7 @@ server_t *get_server(const WCHAR*,INTERNET_PORT,BOOL);
BOOL
init_urlcache
(
void
)
DECLSPEC_HIDDEN
;
void
free_urlcache
(
void
)
DECLSPEC_HIDDEN
;
void
free_cookie
(
void
)
DECLSPEC_HIDDEN
;
#define MAX_REPLY_LEN 0x5B4
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment