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
a584ffb9
Commit
a584ffb9
authored
Jul 21, 2004
by
Robert Shearman
Committed by
Alexandre Julliard
Jul 21, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rewrite cookies to use shared list.h list code.
parent
f1d7b14b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
105 additions
and
177 deletions
+105
-177
cookie.c
dlls/wininet/cookie.c
+105
-177
No files found.
dlls/wininet/cookie.c
View file @
a584ffb9
...
@@ -38,6 +38,8 @@
...
@@ -38,6 +38,8 @@
#include "wine/debug.h"
#include "wine/debug.h"
#include "internet.h"
#include "internet.h"
#include "wine/list.h"
#define RESPONSE_TIMEOUT 30
/* FROM internet.c */
#define RESPONSE_TIMEOUT 30
/* FROM internet.c */
...
@@ -55,8 +57,7 @@ typedef struct _cookie cookie;
...
@@ -55,8 +57,7 @@ typedef struct _cookie cookie;
struct
_cookie
struct
_cookie
{
{
struct
_cookie
*
next
;
struct
list
entry
;
struct
_cookie
*
prev
;
struct
_cookie_domain
*
parent
;
struct
_cookie_domain
*
parent
;
...
@@ -67,25 +68,19 @@ struct _cookie
...
@@ -67,25 +68,19 @@ struct _cookie
struct
_cookie_domain
struct
_cookie_domain
{
{
struct
_cookie_domain
*
next
;
struct
list
entry
;
struct
_cookie_domain
*
prev
;
LPWSTR
lpCookieDomain
;
LPWSTR
lpCookieDomain
;
LPWSTR
lpCookiePath
;
LPWSTR
lpCookiePath
;
cookie
*
cookie_tail
;
struct
list
cookie_list
;
};
};
static
cookie_domain
*
cookieDomainTail
;
static
struct
list
domain_list
=
LIST_INIT
(
domain_list
)
;
static
cookie
*
COOKIE_addCookie
(
cookie_domain
*
domain
,
LPCWSTR
name
,
LPCWSTR
data
);
static
cookie
*
COOKIE_addCookie
(
cookie_domain
*
domain
,
LPCWSTR
name
,
LPCWSTR
data
);
static
cookie
*
COOKIE_findCookie
(
cookie_domain
*
domain
,
LPCWSTR
lpszCookieName
);
static
cookie
*
COOKIE_findCookie
(
cookie_domain
*
domain
,
LPCWSTR
lpszCookieName
);
static
void
COOKIE_deleteCookie
(
cookie
*
deadCookie
,
BOOL
deleteDomain
);
static
void
COOKIE_deleteCookie
(
cookie
*
deadCookie
,
BOOL
deleteDomain
);
static
cookie_domain
*
COOKIE_addDomain
(
LPCWSTR
domain
,
LPCWSTR
path
);
static
cookie_domain
*
COOKIE_addDomain
(
LPCWSTR
domain
,
LPCWSTR
path
);
static
cookie_domain
*
COOKIE_addDomainFromUrl
(
LPCWSTR
lpszUrl
);
static
cookie_domain
*
COOKIE_findNextDomain
(
LPCWSTR
lpszCookieDomain
,
LPCWSTR
lpszCookiePath
,
cookie_domain
*
prev_domain
,
BOOL
allow_partial
);
static
cookie_domain
*
COOKIE_findNextDomainFromUrl
(
LPCWSTR
lpszUrl
,
cookie_domain
*
prev_domain
,
BOOL
allow_partial
);
static
void
COOKIE_deleteDomain
(
cookie_domain
*
deadDomain
);
static
void
COOKIE_deleteDomain
(
cookie_domain
*
deadDomain
);
...
@@ -94,8 +89,7 @@ static cookie *COOKIE_addCookie(cookie_domain *domain, LPCWSTR name, LPCWSTR dat
...
@@ -94,8 +89,7 @@ static cookie *COOKIE_addCookie(cookie_domain *domain, LPCWSTR name, LPCWSTR dat
{
{
cookie
*
newCookie
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
cookie
));
cookie
*
newCookie
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
cookie
));
newCookie
->
next
=
NULL
;
list_init
(
&
newCookie
->
entry
);
newCookie
->
prev
=
NULL
;
newCookie
->
lpCookieName
=
NULL
;
newCookie
->
lpCookieName
=
NULL
;
newCookie
->
lpCookieData
=
NULL
;
newCookie
->
lpCookieData
=
NULL
;
...
@@ -112,9 +106,8 @@ static cookie *COOKIE_addCookie(cookie_domain *domain, LPCWSTR name, LPCWSTR dat
...
@@ -112,9 +106,8 @@ static cookie *COOKIE_addCookie(cookie_domain *domain, LPCWSTR name, LPCWSTR dat
TRACE
(
"added cookie %p (data is %s)
\n
"
,
newCookie
,
debugstr_w
(
data
)
);
TRACE
(
"added cookie %p (data is %s)
\n
"
,
newCookie
,
debugstr_w
(
data
)
);
newCookie
->
prev
=
domain
->
cookie_tail
;
list_add_tail
(
&
domain
->
cookie_list
,
&
newCookie
->
entry
)
;
newCookie
->
parent
=
domain
;
newCookie
->
parent
=
domain
;
domain
->
cookie_tail
=
newCookie
;
return
newCookie
;
return
newCookie
;
}
}
...
@@ -122,11 +115,12 @@ static cookie *COOKIE_addCookie(cookie_domain *domain, LPCWSTR name, LPCWSTR dat
...
@@ -122,11 +115,12 @@ static cookie *COOKIE_addCookie(cookie_domain *domain, LPCWSTR name, LPCWSTR dat
/* finds a cookie in the domain matching the cookie name */
/* finds a cookie in the domain matching the cookie name */
static
cookie
*
COOKIE_findCookie
(
cookie_domain
*
domain
,
LPCWSTR
lpszCookieName
)
static
cookie
*
COOKIE_findCookie
(
cookie_domain
*
domain
,
LPCWSTR
lpszCookieName
)
{
{
cookie
*
searchCookie
=
domain
->
cookie_tail
;
struct
list
*
cursor
;
TRACE
(
"(%p, %s)
\n
"
,
domain
,
debugstr_w
(
lpszCookieName
));
TRACE
(
"(%p, %s)
\n
"
,
domain
,
debugstr_w
(
lpszCookieName
));
while
(
searchCookie
)
LIST_FOR_EACH
(
cursor
,
&
domain
->
cookie_list
)
{
{
cookie
*
searchCookie
=
LIST_ENTRY
(
cursor
,
cookie
,
entry
);
BOOL
candidate
=
TRUE
;
BOOL
candidate
=
TRUE
;
if
(
candidate
&&
lpszCookieName
)
if
(
candidate
&&
lpszCookieName
)
{
{
...
@@ -137,7 +131,6 @@ static cookie *COOKIE_findCookie(cookie_domain *domain, LPCWSTR lpszCookieName)
...
@@ -137,7 +131,6 @@ static cookie *COOKIE_findCookie(cookie_domain *domain, LPCWSTR lpszCookieName)
}
}
if
(
candidate
)
if
(
candidate
)
return
searchCookie
;
return
searchCookie
;
searchCookie
=
searchCookie
->
prev
;
}
}
return
NULL
;
return
NULL
;
}
}
...
@@ -149,18 +142,12 @@ static void COOKIE_deleteCookie(cookie *deadCookie, BOOL deleteDomain)
...
@@ -149,18 +142,12 @@ static void COOKIE_deleteCookie(cookie *deadCookie, BOOL deleteDomain)
HeapFree
(
GetProcessHeap
(),
0
,
deadCookie
->
lpCookieName
);
HeapFree
(
GetProcessHeap
(),
0
,
deadCookie
->
lpCookieName
);
if
(
deadCookie
->
lpCookieData
)
if
(
deadCookie
->
lpCookieData
)
HeapFree
(
GetProcessHeap
(),
0
,
deadCookie
->
lpCookieData
);
HeapFree
(
GetProcessHeap
(),
0
,
deadCookie
->
lpCookieData
);
if
(
deadCookie
->
prev
)
list_remove
(
&
deadCookie
->
entry
);
deadCookie
->
prev
->
next
=
deadCookie
->
next
;
if
(
deadCookie
->
next
)
deadCookie
->
next
->
prev
=
deadCookie
->
prev
;
if
(
deadCookie
==
deadCookie
->
parent
->
cookie_tail
)
/* special case: last cookie, lets remove the domain to save memory */
{
if
(
list_empty
(
&
deadCookie
->
parent
->
cookie_list
)
&&
deleteDomain
)
/* special case: last cookie, lets remove the domain to save memory */
COOKIE_deleteDomain
(
deadCookie
->
parent
);
deadCookie
->
parent
->
cookie_tail
=
deadCookie
->
prev
;
HeapFree
(
GetProcessHeap
(),
0
,
deadCookie
);
if
(
!
deadCookie
->
parent
->
cookie_tail
&&
deleteDomain
)
COOKIE_deleteDomain
(
deadCookie
->
parent
);
}
}
}
/* allocates a domain and adds it to the end */
/* allocates a domain and adds it to the end */
...
@@ -168,9 +155,8 @@ static cookie_domain *COOKIE_addDomain(LPCWSTR domain, LPCWSTR path)
...
@@ -168,9 +155,8 @@ static cookie_domain *COOKIE_addDomain(LPCWSTR domain, LPCWSTR path)
{
{
cookie_domain
*
newDomain
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
cookie_domain
));
cookie_domain
*
newDomain
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
cookie_domain
));
newDomain
->
next
=
NULL
;
list_init
(
&
newDomain
->
entry
);
newDomain
->
prev
=
NULL
;
list_init
(
&
newDomain
->
cookie_list
);
newDomain
->
cookie_tail
=
NULL
;
newDomain
->
lpCookieDomain
=
NULL
;
newDomain
->
lpCookieDomain
=
NULL
;
newDomain
->
lpCookiePath
=
NULL
;
newDomain
->
lpCookiePath
=
NULL
;
...
@@ -185,15 +171,14 @@ static cookie_domain *COOKIE_addDomain(LPCWSTR domain, LPCWSTR path)
...
@@ -185,15 +171,14 @@ static cookie_domain *COOKIE_addDomain(LPCWSTR domain, LPCWSTR path)
lstrcpyW
(
newDomain
->
lpCookiePath
,
path
);
lstrcpyW
(
newDomain
->
lpCookiePath
,
path
);
}
}
newDomain
->
prev
=
cookieDomainTail
;
list_add_tail
(
&
domain_list
,
&
newDomain
->
entry
)
;
cookieDomainTail
=
newDomain
;
TRACE
(
"Adding domain: %p
\n
"
,
newDomain
);
TRACE
(
"Adding domain: %p
\n
"
,
newDomain
);
return
newDomain
;
return
newDomain
;
}
}
static
cookie_domain
*
COOKIE_addDomainFromUrl
(
LPCWSTR
lpszUrl
)
static
void
COOKIE_crackUrlSimple
(
LPCWSTR
lpszUrl
,
LPWSTR
hostName
,
int
hostNameLen
,
LPWSTR
path
,
int
pathLen
)
{
{
WCHAR
hostName
[
2048
],
path
[
2048
];
URL_COMPONENTSW
UrlComponents
;
URL_COMPONENTSW
UrlComponents
;
UrlComponents
.
lpszExtraInfo
=
NULL
;
UrlComponents
.
lpszExtraInfo
=
NULL
;
...
@@ -202,119 +187,59 @@ static cookie_domain *COOKIE_addDomainFromUrl(LPCWSTR lpszUrl)
...
@@ -202,119 +187,59 @@ static cookie_domain *COOKIE_addDomainFromUrl(LPCWSTR lpszUrl)
UrlComponents
.
lpszUrlPath
=
path
;
UrlComponents
.
lpszUrlPath
=
path
;
UrlComponents
.
lpszUserName
=
NULL
;
UrlComponents
.
lpszUserName
=
NULL
;
UrlComponents
.
lpszHostName
=
hostName
;
UrlComponents
.
lpszHostName
=
hostName
;
UrlComponents
.
dwHostNameLength
=
2048
;
UrlComponents
.
dwHostNameLength
=
hostNameLen
;
UrlComponents
.
dwUrlPathLength
=
2048
;
UrlComponents
.
dwUrlPathLength
=
pathLen
;
InternetCrackUrlW
(
lpszUrl
,
0
,
0
,
&
UrlComponents
);
InternetCrackUrlW
(
lpszUrl
,
0
,
0
,
&
UrlComponents
);
TRACE
(
"Url cracked. Domain: %s, Path: %s.
\n
"
,
debugstr_w
(
UrlComponents
.
lpszHostName
),
debugstr_w
(
UrlComponents
.
lpszUrlPath
));
/* hack for now - FIXME - There seems to be a bug in InternetCrackUrl?? */
UrlComponents
.
lpszUrlPath
=
NULL
;
return
COOKIE_addDomain
(
UrlComponents
.
lpszHostName
,
UrlComponents
.
lpszUrlPath
);
}
}
/*
find a domain. domain must match if its not NULL. path must match if it
s not NULL */
/*
match a domain. domain must match if the domain is not NULL. path must match if the path i
s not NULL */
static
cookie_domain
*
COOKIE_findNext
Domain
(
LPCWSTR
lpszCookieDomain
,
LPCWSTR
lpszCookiePath
,
static
BOOL
COOKIE_match
Domain
(
LPCWSTR
lpszCookieDomain
,
LPCWSTR
lpszCookiePath
,
cookie_domain
*
prev_d
omain
,
BOOL
allow_partial
)
cookie_domain
*
searchD
omain
,
BOOL
allow_partial
)
{
{
cookie_domain
*
searchDomain
;
TRACE
(
"searching on domain %p
\n
"
,
searchDomain
);
if
(
lpszCookieDomain
)
if
(
prev_domain
)
{
if
(
!
prev_domain
->
prev
)
{
{
TRACE
(
"no more domains available, it would seem.
\n
"
);
if
(
!
searchDomain
->
lpCookieDomain
)
return
NULL
;
return
FALSE
;
}
searchDomain
=
prev_domain
->
prev
;
}
else
searchDomain
=
cookieDomainTail
;
while
(
searchDomain
)
{
BOOL
candidate
=
TRUE
;
TRACE
(
"searching on domain %p
\n
"
,
searchDomain
);
if
(
candidate
&&
lpszCookieDomain
)
{
if
(
candidate
&&
!
searchDomain
->
lpCookieDomain
)
candidate
=
FALSE
;
TRACE
(
"candidate! (%p)
\n
"
,
searchDomain
->
lpCookieDomain
);
TRACE
(
"comparing domain %s with %s
\n
"
,
TRACE
(
"comparing domain %s with %s
\n
"
,
debugstr_w
(
lpszCookieDomain
),
debugstr_w
(
lpszCookieDomain
),
debugstr_w
(
searchDomain
->
lpCookieDomain
));
debugstr_w
(
searchDomain
->
lpCookieDomain
));
if
(
candidate
&&
allow_partial
&&
!
strstrW
(
lpszCookieDomain
,
searchDomain
->
lpCookieDomain
))
candidate
=
FALSE
;
if
(
allow_partial
&&
!
strstrW
(
lpszCookieDomain
,
searchDomain
->
lpCookieDomain
))
else
if
(
candidate
&&
!
allow_partial
&&
return
FALSE
;
lstrcmpW
(
lpszCookieDomain
,
searchDomain
->
lpCookieDomain
)
!=
0
)
else
if
(
!
allow_partial
&&
lstrcmpW
(
lpszCookieDomain
,
searchDomain
->
lpCookieDomain
)
!=
0
)
candidate
=
FALSE
;
return
FALSE
;
}
}
if
(
candidate
&&
lpszCookiePath
)
if
(
lpszCookiePath
)
{
{
TRACE
(
"comparing paths
\n
"
);
TRACE
(
"comparing paths: %s with %s
\n
"
,
debugstr_w
(
lpszCookiePath
),
debugstr_w
(
searchDomain
->
lpCookiePath
));
if
(
candidate
&&
!
searchDomain
->
lpCookiePath
)
if
(
!
searchDomain
->
lpCookiePath
)
candidate
=
FALSE
;
return
FALSE
;
if
(
candidate
&&
if
(
strcmpW
(
lpszCookiePath
,
searchDomain
->
lpCookiePath
))
strcmpW
(
lpszCookiePath
,
searchDomain
->
lpCookiePath
))
return
FALSE
;
candidate
=
FALSE
;
}
if
(
candidate
)
{
TRACE
(
"returning the domain %p
\n
"
,
searchDomain
);
return
searchDomain
;
}
}
searchDomain
=
searchDomain
->
prev
;
return
TRUE
;
}
TRACE
(
"found no domain, returning NULL
\n
"
);
return
NULL
;
}
static
cookie_domain
*
COOKIE_findNextDomainFromUrl
(
LPCWSTR
lpszUrl
,
cookie_domain
*
previous_domain
,
BOOL
allow_partial
)
{
WCHAR
hostName
[
2048
],
path
[
2048
];
URL_COMPONENTSW
UrlComponents
;
UrlComponents
.
lpszExtraInfo
=
NULL
;
UrlComponents
.
lpszPassword
=
NULL
;
UrlComponents
.
lpszScheme
=
NULL
;
UrlComponents
.
lpszUrlPath
=
path
;
UrlComponents
.
lpszUserName
=
NULL
;
UrlComponents
.
lpszHostName
=
hostName
;
UrlComponents
.
dwHostNameLength
=
2048
;
UrlComponents
.
dwUrlPathLength
=
2048
;
InternetCrackUrlW
(
lpszUrl
,
0
,
0
,
&
UrlComponents
);
TRACE
(
"Url cracked. Domain: %s, Path: %s.
\n
"
,
debugstr_w
(
UrlComponents
.
lpszHostName
),
debugstr_w
(
UrlComponents
.
lpszUrlPath
));
/* hack for now - FIXME - There seems to be a bug in InternetCrackUrl?? */
UrlComponents
.
lpszUrlPath
=
NULL
;
return
COOKIE_findNextDomain
(
UrlComponents
.
lpszHostName
,
UrlComponents
.
lpszUrlPath
,
previous_domain
,
allow_partial
);
}
}
/* remove a domain from the list and delete it */
/* remove a domain from the list and delete it */
static
void
COOKIE_deleteDomain
(
cookie_domain
*
deadDomain
)
static
void
COOKIE_deleteDomain
(
cookie_domain
*
deadDomain
)
{
{
while
(
deadDomain
->
cookie_tail
)
struct
list
*
cursor
;
COOKIE_deleteCookie
(
deadDomain
->
cookie_tail
,
FALSE
);
while
((
cursor
=
list_tail
(
&
deadDomain
->
cookie_list
)))
{
COOKIE_deleteCookie
(
LIST_ENTRY
(
cursor
,
cookie
,
entry
),
FALSE
);
list_remove
(
cursor
);
}
if
(
deadDomain
->
lpCookieDomain
)
if
(
deadDomain
->
lpCookieDomain
)
HeapFree
(
GetProcessHeap
(),
0
,
deadDomain
->
lpCookieDomain
);
HeapFree
(
GetProcessHeap
(),
0
,
deadDomain
->
lpCookieDomain
);
if
(
deadDomain
->
lpCookiePath
)
if
(
deadDomain
->
lpCookiePath
)
HeapFree
(
GetProcessHeap
(),
0
,
deadDomain
->
lpCookiePath
);
HeapFree
(
GetProcessHeap
(),
0
,
deadDomain
->
lpCookiePath
);
if
(
deadDomain
->
prev
)
deadDomain
->
prev
->
next
=
deadDomain
->
next
;
if
(
deadDomain
->
next
)
deadDomain
->
next
->
prev
=
deadDomain
->
prev
;
if
(
cookieDomainTail
==
deadDomain
)
list_remove
(
&
deadDomain
->
entry
);
cookieDomainTail
=
deadDomain
->
prev
;
HeapFree
(
GetProcessHeap
(),
0
,
deadDomain
);
HeapFree
(
GetProcessHeap
(),
0
,
deadDomain
);
}
}
...
@@ -334,58 +259,50 @@ static void COOKIE_deleteDomain(cookie_domain *deadDomain)
...
@@ -334,58 +259,50 @@ static void COOKIE_deleteDomain(cookie_domain *deadDomain)
BOOL
WINAPI
InternetGetCookieW
(
LPCWSTR
lpszUrl
,
LPCWSTR
lpszCookieName
,
BOOL
WINAPI
InternetGetCookieW
(
LPCWSTR
lpszUrl
,
LPCWSTR
lpszCookieName
,
LPWSTR
lpCookieData
,
LPDWORD
lpdwSize
)
LPWSTR
lpCookieData
,
LPDWORD
lpdwSize
)
{
{
cookie_domain
*
cookiesDomain
=
NULL
;
struct
list
*
cursor
;
cookie
*
thisCookie
;
int
cnt
=
0
,
domain_count
=
0
;
int
cnt
=
0
,
domain_count
=
0
;
/* Ok, this is just ODD!. During my tests, it appears M$ like to send out
int
cookie_count
=
0
;
* a cookie called 'MtrxTracking' to some urls. Also returns it from InternetGetCookie.
WCHAR
hostName
[
2048
],
path
[
2048
];
* I'm not exactly sure what to make of this, so its here for now.
* It'd be nice to know what exactly is going on, M$ tracking users? Does this need
* to be unique? Should I generate a random number here? etc.
*/
static
const
WCHAR
TrackingString
[]
=
{
'M'
,
't'
,
'r'
,
'x'
,
'T'
,
'r'
,
'a'
,
'c'
,
'k'
,
'i'
,
'n'
,
'g'
,
'I'
,
'D'
,
'='
,
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'0'
,
'1'
,
0
};
static
const
WCHAR
szps
[]
=
{
'%'
,
's'
,
0
};
TRACE
(
"(%s, %s, %p, %p)
\n
"
,
debugstr_w
(
lpszUrl
),
debugstr_w
(
lpszCookieName
),
TRACE
(
"(%s, %s, %p, %p)
\n
"
,
debugstr_w
(
lpszUrl
),
debugstr_w
(
lpszCookieName
),
lpCookieData
,
lpdwSize
);
lpCookieData
,
lpdwSize
);
if
(
lpCookieData
)
COOKIE_crackUrlSimple
(
lpszUrl
,
hostName
,
sizeof
(
hostName
)
/
sizeof
(
hostName
[
0
]),
path
,
sizeof
(
path
)
/
sizeof
(
path
[
0
]));
cnt
+=
snprintfW
(
lpCookieData
+
cnt
,
*
lpdwSize
-
cnt
,
szps
,
TrackingString
);
else
cnt
+=
strlenW
(
TrackingString
);
while
((
cookiesDomain
=
COOKIE_findNextDomainFromUrl
(
lpszUrl
,
cookiesDomain
,
TRUE
))
)
LIST_FOR_EACH
(
cursor
,
&
domain_list
)
{
{
domain_count
++
;
cookie_domain
*
cookiesDomain
=
LIST_ENTRY
(
cursor
,
cookie_domain
,
entry
);
TRACE
(
"found domain %p
\n
"
,
cookiesDomain
);
if
(
COOKIE_matchDomain
(
hostName
,
NULL
/* FIXME: path */
,
cookiesDomain
,
TRUE
))
{
thisCookie
=
cookiesDomain
->
cookie_tail
;
struct
list
*
cursor
;
if
(
lpCookieData
==
NULL
)
/* return the size of the buffer required to lpdwSize */
domain_count
++
;
{
TRACE
(
"found domain %p
\n
"
,
cookiesDomain
);
while
(
thisCookie
)
{
LIST_FOR_EACH
(
cursor
,
&
cookiesDomain
->
cookie_list
)
cnt
+=
2
;
/* '; ' */
{
cnt
+=
strlenW
(
thisCookie
->
lpCookieName
);
cookie
*
thisCookie
=
LIST_ENTRY
(
cursor
,
cookie
,
entry
);
cnt
+=
1
;
/* = */
if
(
lpCookieData
==
NULL
)
/* return the size of the buffer required to lpdwSize */
cnt
+=
strlenW
(
thisCookie
->
lpCookieData
);
{
if
(
cookie_count
!=
0
)
thisCookie
=
thisCookie
->
prev
;
cnt
+=
2
;
/* '; ' */
}
cnt
+=
strlenW
(
thisCookie
->
lpCookieName
);
}
cnt
+=
1
;
/* = */
while
(
thisCookie
)
cnt
+=
strlenW
(
thisCookie
->
lpCookieData
);
{
}
static
const
WCHAR
szsc
[]
=
{
';'
,
' '
,
0
};
else
static
const
WCHAR
szpseq
[]
=
{
'%'
,
's'
,
'='
,
'%'
,
's'
,
0
};
{
cnt
+=
snprintfW
(
lpCookieData
+
cnt
,
*
lpdwSize
-
cnt
,
szsc
);
static
const
WCHAR
szsc
[]
=
{
';'
,
' '
,
0
};
cnt
+=
snprintfW
(
lpCookieData
+
cnt
,
*
lpdwSize
-
cnt
,
szpseq
,
static
const
WCHAR
szpseq
[]
=
{
'%'
,
's'
,
'='
,
'%'
,
's'
,
0
};
thisCookie
->
lpCookieName
,
if
(
cookie_count
!=
0
)
thisCookie
->
lpCookieData
);
cnt
+=
snprintfW
(
lpCookieData
+
cnt
,
*
lpdwSize
-
cnt
,
szsc
);
cnt
+=
snprintfW
(
lpCookieData
+
cnt
,
*
lpdwSize
-
cnt
,
szpseq
,
thisCookie
=
thisCookie
->
prev
;
thisCookie
->
lpCookieName
,
}
thisCookie
->
lpCookieData
);
TRACE
(
"Cookie: %s=%s
\n
"
,
debugstr_w
(
thisCookie
->
lpCookieName
),
debugstr_w
(
thisCookie
->
lpCookieData
));
}
cookie_count
++
;
}
}
}
}
if
(
lpCookieData
==
NULL
)
if
(
lpCookieData
==
NULL
)
{
{
...
@@ -478,8 +395,10 @@ BOOL WINAPI InternetGetCookieA(LPCSTR lpszUrl, LPCSTR lpszCookieName,
...
@@ -478,8 +395,10 @@ BOOL WINAPI InternetGetCookieA(LPCSTR lpszUrl, LPCSTR lpszCookieName,
BOOL
WINAPI
InternetSetCookieW
(
LPCWSTR
lpszUrl
,
LPCWSTR
lpszCookieName
,
BOOL
WINAPI
InternetSetCookieW
(
LPCWSTR
lpszUrl
,
LPCWSTR
lpszCookieName
,
LPCWSTR
lpCookieData
)
LPCWSTR
lpCookieData
)
{
{
cookie_domain
*
thisCookieDomain
=
NULL
;
cookie
*
thisCookie
;
cookie
*
thisCookie
;
cookie_domain
*
thisCookieDomain
;
WCHAR
hostName
[
2048
],
path
[
2048
];
struct
list
*
cursor
;
TRACE
(
"(%s,%s,%s)
\n
"
,
debugstr_w
(
lpszUrl
),
TRACE
(
"(%s,%s,%s)
\n
"
,
debugstr_w
(
lpszUrl
),
debugstr_w
(
lpszCookieName
),
debugstr_w
(
lpCookieData
));
debugstr_w
(
lpszCookieName
),
debugstr_w
(
lpCookieData
));
...
@@ -516,8 +435,17 @@ BOOL WINAPI InternetSetCookieW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName,
...
@@ -516,8 +435,17 @@ BOOL WINAPI InternetSetCookieW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName,
return
ret
;
return
ret
;
}
}
if
(
!
(
thisCookieDomain
=
COOKIE_findNextDomainFromUrl
(
lpszUrl
,
NULL
,
FALSE
)))
COOKIE_crackUrlSimple
(
lpszUrl
,
hostName
,
sizeof
(
hostName
)
/
sizeof
(
hostName
[
0
]),
path
,
sizeof
(
path
)
/
sizeof
(
path
[
0
]));
thisCookieDomain
=
COOKIE_addDomainFromUrl
(
lpszUrl
);
LIST_FOR_EACH
(
cursor
,
&
domain_list
)
{
thisCookieDomain
=
LIST_ENTRY
(
cursor
,
cookie_domain
,
entry
);
if
(
COOKIE_matchDomain
(
hostName
,
NULL
/* FIXME: path */
,
thisCookieDomain
,
FALSE
))
break
;
thisCookieDomain
=
NULL
;
}
if
(
!
thisCookieDomain
)
thisCookieDomain
=
COOKIE_addDomain
(
hostName
,
path
);
if
((
thisCookie
=
COOKIE_findCookie
(
thisCookieDomain
,
lpszCookieName
)))
if
((
thisCookie
=
COOKIE_findCookie
(
thisCookieDomain
,
lpszCookieName
)))
COOKIE_deleteCookie
(
thisCookie
,
FALSE
);
COOKIE_deleteCookie
(
thisCookie
,
FALSE
);
...
...
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