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
fbc99515
Commit
fbc99515
authored
Apr 24, 2009
by
Hans Leidekker
Committed by
Alexandre Julliard
Apr 24, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Fix parsing of cookies with attributes.
parent
6a5be436
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
5 deletions
+30
-5
cookie.c
dlls/wininet/cookie.c
+21
-5
internet.c
dlls/wininet/tests/internet.c
+9
-0
No files found.
dlls/wininet/cookie.c
View file @
fbc99515
...
...
@@ -447,12 +447,12 @@ static BOOL set_cookie(LPCWSTR domain, LPCWSTR path, LPCWSTR cookie_name, LPCWST
cookie_domain
*
thisCookieDomain
=
NULL
;
cookie
*
thisCookie
;
struct
list
*
cursor
;
LPWSTR
data
;
LPWSTR
data
,
value
;
WCHAR
*
ptr
;
FILETIME
expiry
;
BOOL
expired
=
FALSE
;
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,(
lstrlenW
(
cookie_data
)
+
1
)
*
sizeof
(
WCHAR
));
value
=
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
strlenW
(
cookie_data
)
+
1
)
*
sizeof
(
WCHAR
));
strcpyW
(
data
,
cookie_data
);
memset
(
&
expiry
,
0
,
sizeof
(
expiry
));
...
...
@@ -469,6 +469,10 @@ static BOOL set_cookie(LPCWSTR domain, LPCWSTR path, LPCWSTR cookie_name, LPCWST
if
(
!
(
ptr
=
strchrW
(
ptr
,
';'
)))
break
;
*
ptr
++
=
0
;
value
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
ptr
-
data
)
*
sizeof
(
WCHAR
));
strcpyW
(
value
,
data
);
while
(
*
ptr
==
' '
)
ptr
++
;
/* whitespace */
if
(
strncmpiW
(
ptr
,
szDomain
,
7
)
==
0
)
...
...
@@ -502,11 +506,20 @@ static BOOL set_cookie(LPCWSTR domain, LPCWSTR path, LPCWSTR cookie_name, LPCWST
}
}
else
if
(
strncmpiW
(
ptr
,
szSecure
,
6
)
==
0
)
{
FIXME
(
"secure not handled (%s)
\n
"
,
debugstr_w
(
ptr
));
ptr
+=
strlenW
(
szSecure
);
}
else
if
(
strncmpiW
(
ptr
,
szHttpOnly
,
8
)
==
0
)
{
FIXME
(
"httponly not handled (%s)
\n
"
,
debugstr_w
(
ptr
));
else
ptr
+=
strlenW
(
szHttpOnly
);
}
else
if
(
*
ptr
)
{
FIXME
(
"Unknown additional option %s
\n
"
,
debugstr_w
(
ptr
));
break
;
}
}
LIST_FOR_EACH
(
cursor
,
&
domain_list
)
...
...
@@ -524,6 +537,7 @@ static BOOL set_cookie(LPCWSTR domain, LPCWSTR path, LPCWSTR cookie_name, LPCWST
else
{
HeapFree
(
GetProcessHeap
(),
0
,
data
);
if
(
value
!=
data
)
HeapFree
(
GetProcessHeap
(),
0
,
value
);
return
TRUE
;
}
}
...
...
@@ -532,15 +546,17 @@ static BOOL set_cookie(LPCWSTR domain, LPCWSTR path, LPCWSTR cookie_name, LPCWST
COOKIE_deleteCookie
(
thisCookie
,
FALSE
);
TRACE
(
"setting cookie %s=%s for domain %s path %s
\n
"
,
debugstr_w
(
cookie_name
),
debugstr_w
(
data
),
debugstr_w
(
thisCookieDomain
->
lpCookieDomain
),
debugstr_w
(
thisCookieDomain
->
lpCookiePath
));
debugstr_w
(
value
),
debugstr_w
(
thisCookieDomain
->
lpCookieDomain
),
debugstr_w
(
thisCookieDomain
->
lpCookiePath
));
if
(
!
expired
&&
!
COOKIE_addCookie
(
thisCookieDomain
,
cookie_name
,
data
,
expiry
))
if
(
!
expired
&&
!
COOKIE_addCookie
(
thisCookieDomain
,
cookie_name
,
value
,
expiry
))
{
HeapFree
(
GetProcessHeap
(),
0
,
data
);
if
(
value
!=
data
)
HeapFree
(
GetProcessHeap
(),
0
,
value
);
return
FALSE
;
}
HeapFree
(
GetProcessHeap
(),
0
,
data
);
if
(
value
!=
data
)
HeapFree
(
GetProcessHeap
(),
0
,
value
);
return
TRUE
;
}
...
...
dlls/wininet/tests/internet.c
View file @
fbc99515
...
...
@@ -272,6 +272,8 @@ static void test_complicated_cookie(void)
ok
(
ret
==
TRUE
,
"InternetSetCookie failed
\n
"
);
ret
=
InternetSetCookie
(
"http://www.example.com/bar/"
,
NULL
,
"M=N; domain=.example.com; path=/foo/"
);
ok
(
ret
==
TRUE
,
"InternetSetCookie failed
\n
"
);
ret
=
InternetSetCookie
(
"http://www.example.com/bar/"
,
NULL
,
"O=P; secure; path=/bar"
);
ok
(
ret
==
TRUE
,
"InternetSetCookie failed
\n
"
);
len
=
1024
;
ret
=
InternetGetCookie
(
"http://testing.example.com"
,
NULL
,
buffer
,
&
len
);
...
...
@@ -282,6 +284,7 @@ static void test_complicated_cookie(void)
ok
(
strstr
(
buffer
,
"I=J"
)
!=
NULL
,
"I=J missing
\n
"
);
ok
(
strstr
(
buffer
,
"K=L"
)
==
NULL
,
"K=L present
\n
"
);
ok
(
strstr
(
buffer
,
"M=N"
)
==
NULL
,
"M=N present
\n
"
);
ok
(
strstr
(
buffer
,
"O=P"
)
==
NULL
,
"O=P present
\n
"
);
len
=
1024
;
ret
=
InternetGetCookie
(
"http://testing.example.com/foobar"
,
NULL
,
buffer
,
&
len
);
...
...
@@ -292,6 +295,7 @@ static void test_complicated_cookie(void)
ok
(
strstr
(
buffer
,
"I=J"
)
!=
NULL
,
"I=J missing
\n
"
);
ok
(
strstr
(
buffer
,
"K=L"
)
==
NULL
,
"K=L present
\n
"
);
ok
(
strstr
(
buffer
,
"M=N"
)
==
NULL
,
"M=N present
\n
"
);
ok
(
strstr
(
buffer
,
"O=P"
)
==
NULL
,
"O=P present
\n
"
);
len
=
1024
;
ret
=
InternetGetCookie
(
"http://testing.example.com/foobar/"
,
NULL
,
buffer
,
&
len
);
...
...
@@ -302,6 +306,7 @@ static void test_complicated_cookie(void)
ok
(
strstr
(
buffer
,
"I=J"
)
!=
NULL
,
"I=J missing
\n
"
);
ok
(
strstr
(
buffer
,
"K=L"
)
==
NULL
,
"K=L present
\n
"
);
ok
(
strstr
(
buffer
,
"M=N"
)
==
NULL
,
"M=N present
\n
"
);
ok
(
strstr
(
buffer
,
"O=P"
)
==
NULL
,
"O=P present
\n
"
);
len
=
1024
;
ret
=
InternetGetCookie
(
"http://testing.example.com/foo/bar"
,
NULL
,
buffer
,
&
len
);
...
...
@@ -312,6 +317,7 @@ static void test_complicated_cookie(void)
ok
(
strstr
(
buffer
,
"I=J"
)
!=
NULL
,
"I=J missing
\n
"
);
ok
(
strstr
(
buffer
,
"K=L"
)
==
NULL
,
"K=L present
\n
"
);
ok
(
strstr
(
buffer
,
"M=N"
)
!=
NULL
,
"M=N missing
\n
"
);
ok
(
strstr
(
buffer
,
"O=P"
)
==
NULL
,
"O=P present
\n
"
);
len
=
1024
;
ret
=
InternetGetCookie
(
"http://testing.example.com/barfoo"
,
NULL
,
buffer
,
&
len
);
...
...
@@ -322,6 +328,7 @@ static void test_complicated_cookie(void)
ok
(
strstr
(
buffer
,
"I=J"
)
!=
NULL
,
"I=J missing
\n
"
);
ok
(
strstr
(
buffer
,
"K=L"
)
==
NULL
,
"K=L present
\n
"
);
ok
(
strstr
(
buffer
,
"M=N"
)
==
NULL
,
"M=N present
\n
"
);
ok
(
strstr
(
buffer
,
"O=P"
)
==
NULL
,
"O=P present
\n
"
);
len
=
1024
;
ret
=
InternetGetCookie
(
"http://testing.example.com/barfoo/"
,
NULL
,
buffer
,
&
len
);
...
...
@@ -332,6 +339,7 @@ static void test_complicated_cookie(void)
ok
(
strstr
(
buffer
,
"I=J"
)
!=
NULL
,
"I=J missing
\n
"
);
ok
(
strstr
(
buffer
,
"K=L"
)
==
NULL
,
"K=L present
\n
"
);
ok
(
strstr
(
buffer
,
"M=N"
)
==
NULL
,
"M=N present
\n
"
);
ok
(
strstr
(
buffer
,
"O=P"
)
==
NULL
,
"O=P present
\n
"
);
len
=
1024
;
ret
=
InternetGetCookie
(
"http://testing.example.com/bar/foo"
,
NULL
,
buffer
,
&
len
);
...
...
@@ -342,6 +350,7 @@ static void test_complicated_cookie(void)
ok
(
strstr
(
buffer
,
"I=J"
)
!=
NULL
,
"I=J missing
\n
"
);
ok
(
strstr
(
buffer
,
"K=L"
)
!=
NULL
,
"K=L missing
\n
"
);
ok
(
strstr
(
buffer
,
"M=N"
)
==
NULL
,
"M=N present
\n
"
);
ok
(
strstr
(
buffer
,
"O=P"
)
==
NULL
,
"O=P present
\n
"
);
}
static
void
test_null
(
void
)
...
...
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