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
d2890778
Commit
d2890778
authored
Aug 18, 2015
by
Michael Müller
Committed by
Alexandre Julliard
Aug 18, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Raw request headers need to be terminated with double \r\n.
parent
99dfc15e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
6 deletions
+26
-6
request.c
dlls/winhttp/request.c
+8
-6
winhttp.c
dlls/winhttp/tests/winhttp.c
+18
-0
No files found.
dlls/winhttp/request.c
View file @
d2890778
...
...
@@ -672,11 +672,8 @@ static BOOL query_headers( request_t *request, DWORD level, LPCWSTR name, LPVOID
if
(
!
(
p
=
headers
))
return
FALSE
;
for
(
len
=
0
;
*
p
;
p
++
)
if
(
*
p
!=
'\r'
)
len
++
;
if
(
!
buffer
||
(
len
+
1
)
*
sizeof
(
WCHAR
)
>
*
buflen
)
{
len
++
;
if
(
!
buffer
||
len
*
sizeof
(
WCHAR
)
>
*
buflen
)
set_last_error
(
ERROR_INSUFFICIENT_BUFFER
);
}
else
{
for
(
p
=
headers
,
q
=
buffer
;
*
p
;
p
++
,
q
++
)
...
...
@@ -688,8 +685,8 @@ static BOOL query_headers( request_t *request, DWORD level, LPCWSTR name, LPVOID
p
++
;
/* skip '\n' */
}
}
*
q
=
0
;
TRACE
(
"returning data: %s
\n
"
,
debugstr_wn
(
buffer
,
len
));
if
(
len
)
len
--
;
ret
=
TRUE
;
}
*
buflen
=
len
*
sizeof
(
WCHAR
);
...
...
@@ -2155,7 +2152,7 @@ static BOOL read_reply( request_t *request )
buflen
=
MAX_REPLY_LEN
;
if
(
!
read_line
(
request
,
buffer
,
&
buflen
))
return
TRUE
;
if
(
!*
buffer
)
b
reak
;
if
(
!*
buffer
)
b
uflen
=
1
;
while
(
len
-
offset
<
buflen
+
crlf_len
)
{
...
...
@@ -2164,6 +2161,11 @@ static BOOL read_reply( request_t *request )
if
(
!
(
tmp
=
heap_realloc
(
raw_headers
,
len
*
sizeof
(
WCHAR
)
)))
return
FALSE
;
request
->
raw_headers
=
raw_headers
=
tmp
;
}
if
(
!*
buffer
)
{
memcpy
(
raw_headers
+
offset
,
crlf
,
sizeof
(
crlf
)
);
break
;
}
MultiByteToWideChar
(
CP_ACP
,
0
,
buffer
,
buflen
,
raw_headers
+
offset
,
buflen
);
if
(
!
(
header
=
parse_header
(
raw_headers
+
offset
)))
break
;
...
...
dlls/winhttp/tests/winhttp.c
View file @
d2890778
...
...
@@ -2126,8 +2126,11 @@ static DWORD CALLBACK server_thread(LPVOID param)
static
void
test_basic_request
(
int
port
,
const
WCHAR
*
verb
,
const
WCHAR
*
path
)
{
static
const
WCHAR
test_header_end_clrf
[]
=
{
'\r'
,
'\n'
,
'\r'
,
'\n'
,
0
};
static
const
WCHAR
test_header_end_raw
[]
=
{
0
,
0
};
HINTERNET
ses
,
con
,
req
;
char
buffer
[
0x100
];
WCHAR
buffer2
[
0x100
];
DWORD
count
,
status
,
size
,
error
,
supported
,
first
,
target
;
BOOL
ret
;
...
...
@@ -2162,6 +2165,21 @@ static void test_basic_request(int port, const WCHAR *verb, const WCHAR *path)
ok
(
first
==
0xdeadbeef
,
"got %x
\n
"
,
first
);
ok
(
target
==
0xdeadbeef
,
"got %x
\n
"
,
target
);
size
=
sizeof
(
buffer2
);
memset
(
buffer2
,
0
,
sizeof
(
buffer2
));
ret
=
WinHttpQueryHeaders
(
req
,
WINHTTP_QUERY_RAW_HEADERS_CRLF
,
NULL
,
buffer2
,
&
size
,
NULL
);
ok
(
ret
,
"failed to query for raw headers: %u
\n
"
,
GetLastError
());
ok
(
!
memcmp
(
buffer2
+
lstrlenW
(
buffer2
)
-
4
,
test_header_end_clrf
,
sizeof
(
test_header_end_clrf
)),
"WinHttpQueryHeaders returned invalid end of header string
\n
"
);
size
=
sizeof
(
buffer2
);
memset
(
buffer2
,
0
,
sizeof
(
buffer2
));
ret
=
WinHttpQueryHeaders
(
req
,
WINHTTP_QUERY_RAW_HEADERS
,
NULL
,
buffer2
,
&
size
,
NULL
);
ok
(
ret
,
"failed to query for raw headers: %u
\n
"
,
GetLastError
());
ok
(
!
memcmp
(
buffer2
+
(
size
/
sizeof
(
WCHAR
))
-
1
,
test_header_end_raw
,
sizeof
(
test_header_end_raw
)),
"WinHttpQueryHeaders returned invalid end of header string
\n
"
);
ok
(
buffer2
[(
size
/
sizeof
(
WCHAR
))
-
2
]
!=
0
,
"returned string has too many NULL characters
\n
"
);
count
=
0
;
memset
(
buffer
,
0
,
sizeof
(
buffer
));
ret
=
WinHttpReadData
(
req
,
buffer
,
sizeof
buffer
,
&
count
);
...
...
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