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
7c8df7eb
Commit
7c8df7eb
authored
Dec 08, 2014
by
Michael Müller
Committed by
Alexandre Julliard
Feb 24, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Allow Accept-Encoding for HTTP/1.0 requests.
parent
93f40b2e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
21 deletions
+47
-21
http.c
dlls/wininet/http.c
+2
-20
http.c
dlls/wininet/tests/http.c
+45
-1
No files found.
dlls/wininet/http.c
View file @
7c8df7eb
...
...
@@ -205,7 +205,6 @@ static LPWSTR HTTP_build_req( LPCWSTR *list, int len );
static
DWORD
HTTP_HttpQueryInfoW
(
http_request_t
*
,
DWORD
,
LPVOID
,
LPDWORD
,
LPDWORD
);
static
LPWSTR
HTTP_GetRedirectURL
(
http_request_t
*
req
,
LPCWSTR
lpszUrl
);
static
UINT
HTTP_DecodeBase64
(
LPCWSTR
base64
,
LPSTR
bin
);
static
BOOL
HTTP_VerifyValidHeader
(
http_request_t
*
req
,
LPCWSTR
field
);
static
BOOL
drain_content
(
http_request_t
*
,
BOOL
);
static
CRITICAL_SECTION
connection_pool_cs
;
...
...
@@ -1312,10 +1311,8 @@ static DWORD HTTP_HttpAddRequestHeadersW(http_request_t *request,
pFieldAndValue
=
HTTP_InterpretHttpHeader
(
lpszStart
);
if
(
pFieldAndValue
)
{
res
=
HTTP_VerifyValidHeader
(
request
,
pFieldAndValue
[
0
]);
if
(
res
==
ERROR_SUCCESS
)
res
=
HTTP_ProcessHeader
(
request
,
pFieldAndValue
[
0
],
pFieldAndValue
[
1
],
dwModifier
|
HTTP_ADDHDR_FLAG_REQ
);
res
=
HTTP_ProcessHeader
(
request
,
pFieldAndValue
[
0
],
pFieldAndValue
[
1
],
dwModifier
|
HTTP_ADDHDR_FLAG_REQ
);
HTTP_FreeTokens
(
pFieldAndValue
);
}
...
...
@@ -6309,21 +6306,6 @@ static BOOL HTTP_DeleteCustomHeader(http_request_t *request, DWORD index)
/***********************************************************************
* HTTP_VerifyValidHeader (internal)
*
* Verify the given header is not invalid for the given http request
*
*/
static
BOOL
HTTP_VerifyValidHeader
(
http_request_t
*
request
,
LPCWSTR
field
)
{
/* Accept-Encoding is stripped from HTTP/1.0 requests. It is invalid */
if
(
!
strcmpW
(
request
->
version
,
g_szHttp1_0
)
&&
!
strcmpiW
(
field
,
szAccept_Encoding
))
return
ERROR_HTTP_INVALID_HEADER
;
return
ERROR_SUCCESS
;
}
/***********************************************************************
* IsHostInProxyBypassList (@)
*
* Undocumented
...
...
dlls/wininet/tests/http.c
View file @
7c8df7eb
...
...
@@ -2314,7 +2314,13 @@ static DWORD CALLBACK server_thread(LPVOID param)
}
if
(
strstr
(
buffer
,
"GET /test_premature_disconnect"
))
trace
(
"closing connection
\n
"
);
if
(
strstr
(
buffer
,
"/test_accept_encoding_http10"
))
{
if
(
strstr
(
buffer
,
"Accept-Encoding: gzip"
))
send
(
c
,
okmsg
,
sizeof
okmsg
-
1
,
0
);
else
send
(
c
,
notokmsg
,
sizeof
notokmsg
-
1
,
0
);
}
shutdown
(
c
,
2
);
closesocket
(
c
);
c
=
-
1
;
...
...
@@ -4169,6 +4175,43 @@ static void test_request_content_length(int port)
CloseHandle
(
hCompleteEvent
);
}
static
void
test_accept_encoding
(
int
port
)
{
HINTERNET
ses
,
con
,
req
;
BOOL
ret
;
ses
=
InternetOpenA
(
"winetest"
,
INTERNET_OPEN_TYPE_PRECONFIG
,
NULL
,
NULL
,
0
);
ok
(
ses
!=
NULL
,
"InternetOpen failed
\n
"
);
con
=
InternetConnectA
(
ses
,
"localhost"
,
port
,
NULL
,
NULL
,
INTERNET_SERVICE_HTTP
,
0
,
0
);
ok
(
con
!=
NULL
,
"InternetConnect failed
\n
"
);
req
=
HttpOpenRequestA
(
con
,
"GET"
,
"/test_accept_encoding_http10"
,
"HTTP/1.0"
,
NULL
,
NULL
,
0
,
0
);
ok
(
req
!=
NULL
,
"HttpOpenRequest failed
\n
"
);
ret
=
HttpAddRequestHeadersA
(
req
,
"Accept-Encoding: gzip
\r\n
"
,
~
0u
,
HTTP_ADDREQ_FLAG_REPLACE
|
HTTP_ADDREQ_FLAG_ADD
);
ok
(
ret
,
"HttpAddRequestHeaders failed
\n
"
);
ret
=
HttpSendRequestA
(
req
,
NULL
,
0
,
NULL
,
0
);
ok
(
ret
,
"HttpSendRequestA failed
\n
"
);
test_status_code
(
req
,
200
);
InternetCloseHandle
(
req
);
req
=
HttpOpenRequestA
(
con
,
"GET"
,
"/test_accept_encoding_http10"
,
"HTTP/1.0"
,
NULL
,
NULL
,
0
,
0
);
ok
(
req
!=
NULL
,
"HttpOpenRequest failed
\n
"
);
ret
=
HttpSendRequestA
(
req
,
"Accept-Encoding: gzip"
,
~
0u
,
NULL
,
0
);
ok
(
ret
,
"HttpSendRequestA failed
\n
"
);
test_status_code
(
req
,
200
);
InternetCloseHandle
(
req
);
InternetCloseHandle
(
con
);
InternetCloseHandle
(
ses
);
}
static
void
test_http_connection
(
void
)
{
struct
server_info
si
;
...
...
@@ -4215,6 +4258,7 @@ static void test_http_connection(void)
test_successive_HttpSendRequest
(
si
.
port
);
test_head_request
(
si
.
port
);
test_request_content_length
(
si
.
port
);
test_accept_encoding
(
si
.
port
);
/* send the basic request again to shutdown the server thread */
test_basic_request
(
si
.
port
,
"GET"
,
"/quit"
);
...
...
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