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
5b98186a
Commit
5b98186a
authored
May 16, 2016
by
Jacek Caban
Committed by
Alexandre Julliard
May 17, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Pass domain to get_cookie_domain as a substring.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f70c9ae8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
9 deletions
+26
-9
cookie.c
dlls/wininet/cookie.c
+10
-9
internet.h
dlls/wininet/internet.h
+16
-0
No files found.
dlls/wininet/cookie.c
View file @
5b98186a
...
...
@@ -92,19 +92,20 @@ static CRITICAL_SECTION_DEBUG cookie_cs_debug =
static
CRITICAL_SECTION
cookie_cs
=
{
&
cookie_cs_debug
,
-
1
,
0
,
0
,
0
,
0
};
static
struct
list
domain_list
=
LIST_INIT
(
domain_list
);
static
cookie_domain_t
*
get_cookie_domain
(
const
WCHAR
*
domain
,
BOOL
create
)
static
cookie_domain_t
*
get_cookie_domain
(
substr_t
domain
,
BOOL
create
)
{
const
WCHAR
*
ptr
=
domain
+
strlenW
(
domain
)
,
*
ptr_end
,
*
subdomain_ptr
;
const
WCHAR
*
ptr
=
domain
.
str
+
domain
.
len
,
*
ptr_end
,
*
subdomain_ptr
;
cookie_domain_t
*
iter
,
*
current_domain
,
*
prev_domain
=
NULL
;
struct
list
*
current_list
=
&
domain_list
;
while
(
1
)
{
for
(
ptr_end
=
ptr
--
;
ptr
>
domain
&&
*
ptr
!=
'.'
;
ptr
--
);
for
(
ptr_end
=
ptr
--
;
ptr
>
domain
.
str
&&
*
ptr
!=
'.'
;
ptr
--
);
subdomain_ptr
=
*
ptr
==
'.'
?
ptr
+
1
:
ptr
;
current_domain
=
NULL
;
LIST_FOR_EACH_ENTRY
(
iter
,
current_list
,
cookie_domain_t
,
entry
)
{
if
(
ptr_end
-
subdomain_ptr
==
iter
->
subdomain_len
&&
!
memcmp
(
subdomain_ptr
,
iter
->
domain
,
iter
->
subdomain_len
))
{
if
(
ptr_end
-
subdomain_ptr
==
iter
->
subdomain_len
&&
!
memcmp
(
subdomain_ptr
,
iter
->
domain
,
iter
->
subdomain_len
*
sizeof
(
WCHAR
)))
{
current_domain
=
iter
;
break
;
}
...
...
@@ -118,7 +119,7 @@ static cookie_domain_t *get_cookie_domain(const WCHAR *domain, BOOL create)
if
(
!
current_domain
)
return
NULL
;
current_domain
->
domain
=
heap_str
dupW
(
subdomain_ptr
);
current_domain
->
domain
=
heap_str
ndupW
(
subdomain_ptr
,
domain
.
str
+
domain
.
len
-
subdomain_ptr
);
if
(
!
current_domain
->
domain
)
{
heap_free
(
current_domain
);
return
NULL
;
...
...
@@ -133,7 +134,7 @@ static cookie_domain_t *get_cookie_domain(const WCHAR *domain, BOOL create)
list_add_tail
(
current_list
,
&
current_domain
->
entry
);
}
if
(
ptr
==
domain
)
if
(
ptr
==
domain
.
str
)
return
current_domain
;
prev_domain
=
current_domain
;
...
...
@@ -147,7 +148,7 @@ static cookie_container_t *get_cookie_container(const WCHAR *domain, const WCHAR
cookie_container_t
*
cookie_container
,
*
iter
;
size_t
path_len
,
len
;
cookie_domain
=
get_cookie_domain
(
domain
,
create
);
cookie_domain
=
get_cookie_domain
(
substrz
(
domain
)
,
create
);
if
(
!
cookie_domain
)
return
NULL
;
...
...
@@ -592,13 +593,13 @@ static DWORD get_cookie(const WCHAR *host, const WCHAR *path, DWORD flags, cooki
while
(
ptr
>
subpath
&&
ptr
[
-
1
]
!=
'/'
)
ptr
--
;
}
while
(
ptr
!=
subpath
);
domain
=
get_cookie_domain
(
host
,
FALSE
);
domain
=
get_cookie_domain
(
substrz
(
host
)
,
FALSE
);
if
(
!
domain
)
{
TRACE
(
"Unknown host %s
\n
"
,
debugstr_w
(
host
));
return
ERROR_NO_MORE_ITEMS
;
}
for
(
domain
=
get_cookie_domain
(
host
,
FALSE
);
domain
;
domain
=
domain
->
parent
)
{
for
(
domain
=
get_cookie_domain
(
substrz
(
host
)
,
FALSE
);
domain
;
domain
=
domain
->
parent
)
{
TRACE
(
"Trying %s domain...
\n
"
,
debugstr_w
(
domain
->
domain
));
LIST_FOR_EACH_ENTRY
(
container
,
&
domain
->
path_list
,
cookie_container_t
,
entry
)
{
...
...
dlls/wininet/internet.h
View file @
5b98186a
...
...
@@ -215,6 +215,22 @@ static inline char *heap_strdupWtoA(LPCWSTR str)
return
ret
;
}
typedef
struct
{
const
WCHAR
*
str
;
size_t
len
;
}
substr_t
;
static
inline
substr_t
substr
(
const
WCHAR
*
str
,
size_t
len
)
{
substr_t
r
=
{
str
,
len
};
return
r
;
}
static
inline
substr_t
substrz
(
const
WCHAR
*
str
)
{
return
substr
(
str
,
strlenW
(
str
));
}
static
inline
void
WININET_find_data_WtoA
(
LPWIN32_FIND_DATAW
dataW
,
LPWIN32_FIND_DATAA
dataA
)
{
dataA
->
dwFileAttributes
=
dataW
->
dwFileAttributes
;
...
...
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