Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
9a741bf3
Commit
9a741bf3
authored
May 19, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
May 19, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Moved getting cookie from known host to separated function.
parent
aca2385d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
82 deletions
+78
-82
cookie.c
dlls/wininet/cookie.c
+78
-82
No files found.
dlls/wininet/cookie.c
View file @
9a741bf3
...
@@ -260,114 +260,110 @@ static void COOKIE_deleteDomain(cookie_domain *deadDomain)
...
@@ -260,114 +260,110 @@ static void COOKIE_deleteDomain(cookie_domain *deadDomain)
HeapFree
(
GetProcessHeap
(),
0
,
deadDomain
);
HeapFree
(
GetProcessHeap
(),
0
,
deadDomain
);
}
}
/***********************************************************************
static
BOOL
get_cookie
(
const
WCHAR
*
host
,
const
WCHAR
*
path
,
WCHAR
*
cookie_data
,
DWORD
*
size
)
* InternetGetCookieW (WININET.@)
*
* Retrieve cookie from the specified url
*
* It should be noted that on windows the lpszCookieName parameter is "not implemented".
* So it won't be implemented here.
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOL
WINAPI
InternetGetCookieW
(
LPCWSTR
lpszUrl
,
LPCWSTR
lpszCookieName
,
LPWSTR
lpCookieData
,
LPDWORD
lpdwSize
)
{
{
BOOL
ret
;
unsigned
cnt
=
0
,
len
,
domain_count
=
0
,
cookie_count
=
0
;
struct
list
*
cursor
;
cookie_domain
*
domain
;
unsigned
int
cnt
=
0
,
domain_count
=
0
,
cookie_count
=
0
;
WCHAR
hostName
[
2048
],
path
[
2048
];
FILETIME
tm
;
FILETIME
tm
;
TRACE
(
"(%s, %s, %p, %p)
\n
"
,
debugstr_w
(
lpszUrl
),
debugstr_w
(
lpszCookieName
),
GetSystemTimeAsFileTime
(
&
tm
);
lpCookieData
,
lpdwSize
);
if
(
!
lpszUrl
)
LIST_FOR_EACH_ENTRY
(
domain
,
&
domain_list
,
cookie_domain
,
entry
)
{
{
struct
list
*
cursor
,
*
cursor2
;
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
hostName
[
0
]
=
0
;
if
(
!
COOKIE_matchDomain
(
host
,
path
,
domain
,
TRUE
))
ret
=
COOKIE_crackUrlSimple
(
lpszUrl
,
hostName
,
sizeof
(
hostName
)
/
sizeof
(
hostName
[
0
]),
path
,
sizeof
(
path
)
/
sizeof
(
path
[
0
]));
continue
;
if
(
!
ret
||
!
hostName
[
0
])
return
FALSE
;
GetSystemTimeAsFileTime
(
&
tm
);
LIST_FOR_EACH
(
cursor
,
&
domain_list
)
domain_count
++
;
{
TRACE
(
"found domain %p
\n
"
,
domain
);
cookie_domain
*
cookiesDomain
=
LIST_ENTRY
(
cursor
,
cookie_domain
,
entry
);
if
(
COOKIE_matchDomain
(
hostName
,
path
,
cookiesDomain
,
TRUE
))
{
struct
list
*
cursor
,
*
cursor2
;
domain_count
++
;
TRACE
(
"found domain %p
\n
"
,
cookiesDomain
);
LIST_FOR_EACH_SAFE
(
cursor
,
cursor2
,
&
cookiesDomain
->
cookie_list
)
LIST_FOR_EACH_SAFE
(
cursor
,
cursor2
,
&
domain
->
cookie_list
)
{
cookie
*
cookie_iter
=
LIST_ENTRY
(
cursor
,
cookie
,
entry
);
/* check for expiry */
if
((
cookie_iter
->
expiry
.
dwLowDateTime
!=
0
||
cookie_iter
->
expiry
.
dwHighDateTime
!=
0
)
&&
CompareFileTime
(
&
tm
,
&
cookie_iter
->
expiry
)
>
0
)
{
{
cookie
*
thisCookie
=
LIST_ENTRY
(
cursor
,
cookie
,
entry
);
TRACE
(
"Found expired cookie. deleting
\n
"
);
/* check for expiry */
COOKIE_deleteCookie
(
cookie_iter
,
FALSE
);
if
((
thisCookie
->
expiry
.
dwLowDateTime
!=
0
||
thisCookie
->
expiry
.
dwHighDateTime
!=
0
)
&&
CompareFileTime
(
&
tm
,
&
thisCookie
->
expiry
)
>
0
)
continue
;
{
}
TRACE
(
"Found expired cookie. deleting
\n
"
);
COOKIE_deleteCookie
(
thisCookie
,
FALSE
);
continue
;
}
if
(
lpCookieData
==
NULL
)
/* return the size of the buffer required to lpdwSize */
if
(
!
cookie_data
)
{
/* return the size of the buffer required to lpdwSize */
{
if
(
cookie_count
)
unsigned
int
len
;
cnt
+=
2
;
/* '; ' */
cnt
+=
strlenW
(
cookie_iter
->
lpCookieName
);
if
(
cookie_count
)
cnt
+=
2
;
/* '; ' */
if
((
len
=
strlenW
(
cookie_iter
->
lpCookieData
)))
{
cnt
+=
strlenW
(
thisCookie
->
lpCookieName
);
cnt
+=
1
;
/* = */
if
((
len
=
strlenW
(
thisCookie
->
lpCookieData
)))
cnt
+=
len
;
{
cnt
+=
1
;
/* = */
cnt
+=
len
;
}
}
}
else
}
else
{
{
static
const
WCHAR
szsc
[]
=
{
';'
,
' '
,
0
};
static
const
WCHAR
szsc
[]
=
{
';'
,
' '
,
0
};
static
const
WCHAR
szname
[]
=
{
'%'
,
's'
,
0
};
static
const
WCHAR
szname
[]
=
{
'%'
,
's'
,
0
};
static
const
WCHAR
szdata
[]
=
{
'='
,
'%'
,
's'
,
0
};
static
const
WCHAR
szdata
[]
=
{
'='
,
'%'
,
's'
,
0
};
if
(
cookie_count
)
cnt
+=
snprintfW
(
lpCookieData
+
cnt
,
*
lpdwS
ize
-
cnt
,
szsc
);
if
(
cookie_count
)
cnt
+=
snprintfW
(
cookie_data
+
cnt
,
*
s
ize
-
cnt
,
szsc
);
cnt
+=
snprintfW
(
lpCookieData
+
cnt
,
*
lpdwSize
-
cnt
,
szname
,
thisCookie
->
lpCookieName
);
cnt
+=
snprintfW
(
cookie_data
+
cnt
,
*
size
-
cnt
,
szname
,
cookie_iter
->
lpCookieName
);
if
(
thisCookie
->
lpCookieData
[
0
])
if
(
cookie_iter
->
lpCookieData
[
0
])
cnt
+=
snprintfW
(
lpCookieData
+
cnt
,
*
lpdwSize
-
cnt
,
szdata
,
thisCookie
->
lpCookieData
);
cnt
+=
snprintfW
(
cookie_data
+
cnt
,
*
size
-
cnt
,
szdata
,
cookie_iter
->
lpCookieData
);
TRACE
(
"Cookie: %s
\n
"
,
debugstr_w
(
lpCookieData
));
TRACE
(
"Cookie: %s
\n
"
,
debugstr_w
(
cookie_data
));
}
cookie_count
++
;
}
}
cookie_count
++
;
}
}
}
}
if
(
!
domain_count
)
if
(
!
domain_count
)
{
{
TRACE
(
"no cookies found for %s
\n
"
,
debugstr_w
(
host
));
TRACE
(
"no cookies found for %s
\n
"
,
debugstr_w
(
hostName
));
SetLastError
(
ERROR_NO_MORE_ITEMS
);
SetLastError
(
ERROR_NO_MORE_ITEMS
);
return
FALSE
;
return
FALSE
;
}
}
if
(
lpCookieData
==
NULL
)
if
(
!
cookie_data
)
{
{
*
size
=
(
cnt
+
1
)
*
sizeof
(
WCHAR
);
*
lpdwSize
=
(
cnt
+
1
)
*
sizeof
(
WCHAR
);
TRACE
(
"returning %u
\n
"
,
*
size
);
TRACE
(
"returning %u
\n
"
,
*
lpdwSize
);
return
TRUE
;
return
TRUE
;
}
}
*
lpdwSize
=
cnt
+
1
;
*
size
=
cnt
+
1
;
TRACE
(
"Returning %u (from %u domains): %s
\n
"
,
cnt
,
domain_count
,
debugstr_w
(
cookie_data
));
return
cnt
!=
0
;
}
/***********************************************************************
* InternetGetCookieW (WININET.@)
*
* Retrieve cookie from the specified url
*
* It should be noted that on windows the lpszCookieName parameter is "not implemented".
* So it won't be implemented here.
*
* RETURNS
* TRUE on success
* FALSE on failure
*
*/
BOOL
WINAPI
InternetGetCookieW
(
LPCWSTR
lpszUrl
,
LPCWSTR
lpszCookieName
,
LPWSTR
lpCookieData
,
LPDWORD
lpdwSize
)
{
WCHAR
host
[
INTERNET_MAX_HOST_NAME_LENGTH
],
path
[
INTERNET_MAX_PATH_LENGTH
];
BOOL
ret
;
TRACE
(
"(%s, %s, %p, %p)
\n
"
,
debugstr_w
(
lpszUrl
),
debugstr_w
(
lpszCookieName
),
lpCookieData
,
lpdwSize
);
if
(
!
lpszUrl
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
TRACE
(
"Returning %u (from %u domains): %s
\n
"
,
cnt
,
domain_count
,
host
[
0
]
=
0
;
debugstr_w
(
lpCookieData
));
ret
=
COOKIE_crackUrlSimple
(
lpszUrl
,
host
,
sizeof
(
host
)
/
sizeof
(
host
[
0
]),
path
,
sizeof
(
path
)
/
sizeof
(
path
[
0
]));
if
(
!
ret
||
!
host
[
0
])
return
FALSE
;
return
(
cnt
?
TRUE
:
FALSE
);
return
get_cookie
(
host
,
path
,
lpCookieData
,
lpdwSize
);
}
}
...
...
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