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
b069ef42
Commit
b069ef42
authored
Feb 01, 2008
by
Hans Leidekker
Committed by
Alexandre Julliard
Feb 04, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Make sure not to overwrite any caller supplied authorization header.
parent
9bf3355a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
27 deletions
+14
-27
http.c
dlls/wininet/http.c
+10
-26
http.c
dlls/wininet/tests/http.c
+4
-1
No files found.
dlls/wininet/http.c
View file @
b069ef42
...
...
@@ -1187,9 +1187,11 @@ static UINT HTTP_DecodeBase64( LPCWSTR base64, LPSTR bin )
*
* Insert or delete the authorization field in the request header.
*/
static
BOOL
HTTP_InsertAuthorization
ForHeader
(
LPWININETHTTPREQW
lpwhr
,
struct
HttpAuthInfo
*
pAuthInfo
,
LPCWSTR
header
)
static
BOOL
HTTP_InsertAuthorization
(
LPWININETHTTPREQW
lpwhr
,
LPCWSTR
header
,
BOOL
first
)
{
WCHAR
*
authorization
=
NULL
;
struct
HttpAuthInfo
*
pAuthInfo
=
lpwhr
->
pAuthInfo
;
DWORD
flags
;
if
(
pAuthInfo
&&
pAuthInfo
->
auth_data_len
)
{
...
...
@@ -1222,35 +1224,17 @@ static BOOL HTTP_InsertAuthorizationForHeader( LPWININETHTTPREQW lpwhr, struct H
TRACE
(
"Inserting authorization: %s
\n
"
,
debugstr_w
(
authorization
));
HTTP_ProcessHeader
(
lpwhr
,
header
,
authorization
,
HTTP_ADDHDR_FLAG_REPLACE
|
HTTP_ADDHDR_FLAG_REQ
);
/* make sure not to overwrite any caller supplied authorization header */
flags
=
HTTP_ADDHDR_FLAG_REQ
;
flags
|=
first
?
HTTP_ADDHDR_FLAG_ADD_IF_NEW
:
HTTP_ADDHDR_FLAG_REPLACE
;
H
eapFree
(
GetProcessHeap
(),
0
,
authorization
);
H
TTP_ProcessHeader
(
lpwhr
,
header
,
authorization
,
flags
);
HeapFree
(
GetProcessHeap
(),
0
,
authorization
);
return
TRUE
;
}
/***********************************************************************
* HTTP_InsertAuthorization
*
* Insert the authorization field in the request header
*/
static
BOOL
HTTP_InsertAuthorization
(
LPWININETHTTPREQW
lpwhr
)
{
return
HTTP_InsertAuthorizationForHeader
(
lpwhr
,
lpwhr
->
pAuthInfo
,
szAuthorization
);
}
/***********************************************************************
* HTTP_InsertProxyAuthorization
*
* Insert the proxy authorization field in the request header
*/
static
BOOL
HTTP_InsertProxyAuthorization
(
LPWININETHTTPREQW
lpwhr
)
{
return
HTTP_InsertAuthorizationForHeader
(
lpwhr
,
lpwhr
->
pProxyAuthInfo
,
szProxy_Authorization
);
}
/***********************************************************************
* HTTP_DealWithProxy
*/
static
BOOL
HTTP_DealWithProxy
(
LPWININETAPPINFOW
hIC
,
...
...
@@ -2621,8 +2605,8 @@ BOOL WINAPI HTTP_HttpSendRequestW(LPWININETHTTPREQW lpwhr, LPCWSTR lpszHeaders,
lpwhr
->
hdr
.
dwFlags
&
INTERNET_FLAG_KEEP_CONNECTION
?
szKeepAlive
:
szClose
,
HTTP_ADDHDR_FLAG_REQ
|
HTTP_ADDHDR_FLAG_REPLACE
);
HTTP_InsertAuthorization
(
lpwhr
);
HTTP_Insert
ProxyAuthorization
(
lpwhr
);
HTTP_InsertAuthorization
(
lpwhr
,
szAuthorization
,
!
loop_next
);
HTTP_Insert
Authorization
(
lpwhr
,
szProxy_Authorization
,
!
loop_next
);
/* add the headers the caller supplied */
if
(
lpszHeaders
&&
dwHeaderLength
)
...
...
dlls/wininet/tests/http.c
View file @
b069ef42
...
...
@@ -1502,7 +1502,10 @@ static void test_header_handling_order(int port)
request
=
HttpOpenRequest
(
connect
,
NULL
,
"/test3"
,
NULL
,
NULL
,
types
,
INTERNET_FLAG_KEEP_CONNECTION
,
0
);
ok
(
request
!=
NULL
,
"HttpOpenRequest failed
\n
"
);
ret
=
HttpSendRequest
(
request
,
authorization
,
~
0UL
,
NULL
,
0
);
ret
=
HttpAddRequestHeaders
(
request
,
authorization
,
~
0UL
,
HTTP_ADDREQ_FLAG_ADD
);
ok
(
ret
,
"HttpAddRequestHeaders failed
\n
"
);
ret
=
HttpSendRequest
(
request
,
NULL
,
0
,
NULL
,
0
);
ok
(
ret
,
"HttpSendRequest failed
\n
"
);
status
=
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