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
189c1ca5
Commit
189c1ca5
authored
Mar 12, 2012
by
Hans Leidekker
Committed by
Alexandre Julliard
Mar 12, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Fix up headers with wrong termination.
parent
29b9237c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
5 deletions
+43
-5
request.c
dlls/winhttp/request.c
+5
-0
winhttp.c
dlls/winhttp/tests/winhttp.c
+38
-5
No files found.
dlls/winhttp/request.c
View file @
189c1ca5
...
@@ -425,6 +425,11 @@ BOOL add_request_headers( request_t *request, LPCWSTR headers, DWORD len, DWORD
...
@@ -425,6 +425,11 @@ BOOL add_request_headers( request_t *request, LPCWSTR headers, DWORD len, DWORD
q
=
p
;
q
=
p
;
while
(
*
q
)
while
(
*
q
)
{
{
if
(
q
[
0
]
==
'\n'
&&
q
[
1
]
==
'\r'
)
{
q
[
0
]
=
'\r'
;
q
[
1
]
=
'\n'
;
}
if
(
q
[
0
]
==
'\r'
&&
q
[
1
]
==
'\n'
)
break
;
if
(
q
[
0
]
==
'\r'
&&
q
[
1
]
==
'\n'
)
break
;
q
++
;
q
++
;
}
}
...
...
dlls/winhttp/tests/winhttp.c
View file @
189c1ca5
...
@@ -1754,11 +1754,6 @@ static const char okmsg[] =
...
@@ -1754,11 +1754,6 @@ static const char okmsg[] =
"Server: winetest
\r\n
"
"Server: winetest
\r\n
"
"
\r\n
"
;
"
\r\n
"
;
static
const
char
notokmsg
[]
=
"HTTP/1.1 400 Bad Request
\r\n
"
"Server: winetest
\r\n
"
"
\r\n
"
;
static
const
char
noauthmsg
[]
=
static
const
char
noauthmsg
[]
=
"HTTP/1.1 401 Unauthorized
\r\n
"
"HTTP/1.1 401 Unauthorized
\r\n
"
"Server: winetest
\r\n
"
"Server: winetest
\r\n
"
...
@@ -1984,6 +1979,43 @@ static void test_no_headers(int port)
...
@@ -1984,6 +1979,43 @@ static void test_no_headers(int port)
WinHttpCloseHandle
(
ses
);
WinHttpCloseHandle
(
ses
);
}
}
static
void
test_bad_header
(
int
port
)
{
static
const
WCHAR
bad_headerW
[]
=
{
'C'
,
'o'
,
'n'
,
't'
,
'e'
,
'n'
,
't'
,
'-'
,
'T'
,
'y'
,
'p'
,
'e'
,
':'
,
' '
,
't'
,
'e'
,
'x'
,
't'
,
'/'
,
'h'
,
't'
,
'm'
,
'l'
,
'\n'
,
'\r'
,
0
};
static
const
WCHAR
text_htmlW
[]
=
{
't'
,
'e'
,
'x'
,
't'
,
'/'
,
'h'
,
't'
,
'm'
,
'l'
,
0
};
static
const
WCHAR
content_typeW
[]
=
{
'C'
,
'o'
,
'n'
,
't'
,
'e'
,
'n'
,
't'
,
'-'
,
'T'
,
'y'
,
'p'
,
'e'
,
0
};
WCHAR
buffer
[
32
];
HINTERNET
ses
,
con
,
req
;
DWORD
index
,
len
;
BOOL
ret
;
ses
=
WinHttpOpen
(
test_useragent
,
0
,
NULL
,
NULL
,
0
);
ok
(
ses
!=
NULL
,
"failed to open session %u
\n
"
,
GetLastError
()
);
con
=
WinHttpConnect
(
ses
,
localhostW
,
port
,
0
);
ok
(
con
!=
NULL
,
"failed to open a connection %u
\n
"
,
GetLastError
()
);
req
=
WinHttpOpenRequest
(
con
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
0
);
ok
(
req
!=
NULL
,
"failed to open a request %u
\n
"
,
GetLastError
()
);
ret
=
WinHttpAddRequestHeaders
(
req
,
bad_headerW
,
~
0u
,
WINHTTP_ADDREQ_FLAG_ADD
);
ok
(
ret
,
"failed to add header %u
\n
"
,
GetLastError
()
);
index
=
0
;
buffer
[
0
]
=
0
;
len
=
sizeof
(
buffer
);
ret
=
WinHttpQueryHeaders
(
req
,
WINHTTP_QUERY_CUSTOM
|
WINHTTP_QUERY_FLAG_REQUEST_HEADERS
,
content_typeW
,
buffer
,
&
len
,
&
index
);
ok
(
ret
,
"failed to query headers %u
\n
"
,
GetLastError
()
);
ok
(
!
lstrcmpW
(
buffer
,
text_htmlW
),
"got %s
\n
"
,
wine_dbgstr_w
(
buffer
)
);
WinHttpCloseHandle
(
req
);
WinHttpCloseHandle
(
con
);
WinHttpCloseHandle
(
ses
);
}
static
void
test_credentials
(
void
)
static
void
test_credentials
(
void
)
{
{
static
WCHAR
userW
[]
=
{
'u'
,
's'
,
'e'
,
'r'
,
0
};
static
WCHAR
userW
[]
=
{
'u'
,
's'
,
'e'
,
'r'
,
0
};
...
@@ -2713,6 +2745,7 @@ START_TEST (winhttp)
...
@@ -2713,6 +2745,7 @@ START_TEST (winhttp)
test_basic_request
(
si
.
port
,
NULL
,
basicW
);
test_basic_request
(
si
.
port
,
NULL
,
basicW
);
test_no_headers
(
si
.
port
);
test_no_headers
(
si
.
port
);
test_basic_authentication
(
si
.
port
);
test_basic_authentication
(
si
.
port
);
test_bad_header
(
si
.
port
);
/* send the basic request again to shutdown the server thread */
/* send the basic request again to shutdown the server thread */
test_basic_request
(
si
.
port
,
NULL
,
quitW
);
test_basic_request
(
si
.
port
,
NULL
,
quitW
);
...
...
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