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
7bed4534
Commit
7bed4534
authored
Aug 25, 2015
by
Michael Müller
Committed by
Alexandre Julliard
Aug 25, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Set Host header in HttpSendRequestW instead of HttpOpenRequestW.
parent
8a730168
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
17 deletions
+16
-17
http.c
dlls/wininet/http.c
+12
-13
http.c
dlls/wininet/tests/http.c
+4
-4
No files found.
dlls/wininet/http.c
View file @
7bed4534
...
...
@@ -376,6 +376,7 @@ static WCHAR *get_host_header( http_request_t *req )
EnterCriticalSection
(
&
req
->
headers_section
);
if
((
header
=
HTTP_GetHeader
(
req
,
hostW
)))
ret
=
heap_strdupW
(
header
->
lpszValue
);
else
ret
=
heap_strdupW
(
req
->
server
->
canon_host_port
);
LeaveCriticalSection
(
&
req
->
headers_section
);
return
ret
;
}
...
...
@@ -1886,20 +1887,21 @@ static BOOL HTTP_GetRequestURL(http_request_t *req, LPWSTR buf)
static
const
WCHAR
https
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
's'
,
':'
,
'/'
,
'/'
,
0
};
static
const
WCHAR
slash
[]
=
{
'/'
,
0
};
LPHTTPHEADERW
host_header
;
const
WCHAR
*
host
;
LPCWSTR
scheme
;
host_header
=
HTTP_GetHeader
(
req
,
hostW
);
if
(
!
host_header
)
return
FALSE
;
EnterCriticalSection
(
&
req
->
headers_section
);
host_header
=
HTTP_GetHeader
(
req
,
hostW
);
if
(
host_header
)
host
=
host_header
->
lpszValue
;
else
host
=
req
->
server
->
canon_host_port
;
if
(
req
->
hdr
.
dwFlags
&
INTERNET_FLAG_SECURE
)
scheme
=
https
;
else
scheme
=
http
;
strcpyW
(
buf
,
scheme
);
strcatW
(
buf
,
host
_header
->
lpszValue
);
strcatW
(
buf
,
host
);
if
(
req
->
path
[
0
]
!=
'/'
)
strcatW
(
buf
,
slash
);
strcatW
(
buf
,
req
->
path
);
...
...
@@ -2140,16 +2142,12 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe
case
INTERNET_OPTION_URL
:
{
static
const
WCHAR
httpW
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
0
};
WCHAR
url
[
INTERNET_MAX_URL_LENGTH
];
HTTPHEADERW
*
host
;
TRACE
(
"INTERNET_OPTION_URL
\n
"
);
EnterCriticalSection
(
&
req
->
headers_section
);
host
=
HTTP_GetHeader
(
req
,
hostW
);
strcpyW
(
url
,
httpW
);
strcatW
(
url
,
host
->
lpszValue
);
strcatW
(
url
,
req
->
server
->
canon_host_port
);
strcatW
(
url
,
req
->
path
);
LeaveCriticalSection
(
&
req
->
headers_section
);
TRACE
(
"INTERNET_OPTION_URL: %s
\n
"
,
debugstr_w
(
url
));
return
str_to_buffer
(
url
,
buffer
,
size
,
unicode
);
...
...
@@ -3417,8 +3415,6 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *session,
request
->
verb
=
heap_strdupW
(
lpszVerb
&&
*
lpszVerb
?
lpszVerb
:
szGET
);
request
->
version
=
heap_strdupW
(
lpszVersion
&&
*
lpszVersion
?
lpszVersion
:
g_szHttp1_1
);
HTTP_ProcessHeader
(
request
,
hostW
,
request
->
server
->
canon_host_port
,
HTTP_ADDREQ_FLAG_ADD
|
HTTP_ADDHDR_FLAG_REQ
);
if
(
hIC
->
proxy
&&
hIC
->
proxy
[
0
]
&&
!
HTTP_ShouldBypassProxy
(
hIC
,
session
->
hostName
))
HTTP_DealWithProxy
(
hIC
,
session
,
request
);
...
...
@@ -4911,6 +4907,9 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
if
(
!
request
->
verb
)
request
->
verb
=
heap_strdupW
(
szGET
);
HTTP_ProcessHeader
(
request
,
hostW
,
request
->
server
->
canon_host_port
,
HTTP_ADDREQ_FLAG_ADD_IF_NEW
|
HTTP_ADDHDR_FLAG_REQ
);
if
(
dwContentLength
||
strcmpW
(
request
->
verb
,
szGET
))
{
sprintfW
(
contentLengthStr
,
szContentLength
,
dwContentLength
);
...
...
@@ -5121,7 +5120,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
dwBufferSize
=
2048
;
if
(
request
->
status_code
==
HTTP_STATUS_DENIED
)
{
WCHAR
*
host
=
get_host_header
(
reques
t
);
WCHAR
*
host
=
heap_strdupW
(
request
->
server
->
canon_host_por
t
);
DWORD
dwIndex
=
0
;
while
(
HTTP_HttpQueryInfoW
(
request
,
HTTP_QUERY_WWW_AUTHENTICATE
,
szAuthValue
,
&
dwBufferSize
,
&
dwIndex
)
==
ERROR_SUCCESS
)
{
...
...
dlls/wininet/tests/http.c
View file @
7bed4534
...
...
@@ -2979,8 +2979,8 @@ static void test_header_override(int port)
memset
(
buffer
,
0
,
sizeof
(
buffer
));
ret
=
HttpQueryInfoA
(
req
,
HTTP_QUERY_HOST
|
HTTP_QUERY_FLAG_REQUEST_HEADERS
,
buffer
,
&
size
,
&
count
);
err
=
GetLastError
();
todo_wine
ok
(
!
ret
,
"HttpQueryInfo succeeded
\n
"
);
todo_wine
ok
(
err
==
ERROR_HTTP_HEADER_NOT_FOUND
,
"Expected error ERROR_HTTP_HEADER_NOT_FOUND, got %d
\n
"
,
err
);
ok
(
!
ret
,
"HttpQueryInfo succeeded
\n
"
);
ok
(
err
==
ERROR_HTTP_HEADER_NOT_FOUND
,
"Expected error ERROR_HTTP_HEADER_NOT_FOUND, got %d
\n
"
,
err
);
size
=
sizeof
(
buffer
)
-
1
;
memset
(
buffer
,
0
,
sizeof
(
buffer
));
...
...
@@ -3001,12 +3001,12 @@ static void test_header_override(int port)
memset
(
buffer
,
0
,
sizeof
(
buffer
));
ret
=
InternetQueryOptionA
(
req
,
INTERNET_OPTION_URL
,
buffer
,
&
size
);
ok
(
ret
,
"InternetQueryOption failed
\n
"
);
todo_wine
ok
(
!
strcmp
(
full_url
,
buffer
),
"Expected %s, got %s
\n
"
,
full_url
,
buffer
);
ok
(
!
strcmp
(
full_url
,
buffer
),
"Expected %s, got %s
\n
"
,
full_url
,
buffer
);
ret
=
HttpSendRequestA
(
req
,
NULL
,
0
,
NULL
,
0
);
ok
(
ret
,
"HttpSendRequest failed
\n
"
);
test_status_code
_todo
(
req
,
200
);
test_status_code
(
req
,
200
);
InternetCloseHandle
(
req
);
req
=
HttpOpenRequestA
(
con
,
NULL
,
"/test_host_override"
,
NULL
,
NULL
,
NULL
,
INTERNET_FLAG_KEEP_CONNECTION
,
0
);
...
...
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