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
2617fb6d
Commit
2617fb6d
authored
Feb 17, 2008
by
Hans Leidekker
Committed by
Alexandre Julliard
Feb 18, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Handle the "100 Continue" response by ignoring it.
parent
d0033dba
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
30 deletions
+46
-30
http.c
dlls/wininet/http.c
+31
-27
http.c
dlls/wininet/tests/http.c
+15
-3
No files found.
dlls/wininet/http.c
View file @
2617fb6d
...
...
@@ -3020,6 +3020,7 @@ static INT HTTP_GetResponseHeaders(LPWININETHTTPREQW lpwhr)
BOOL
bSuccess
=
FALSE
;
INT
rc
=
0
;
static
const
WCHAR
szCrLf
[]
=
{
'\r'
,
'\n'
,
0
};
static
const
WCHAR
szHundred
[]
=
{
'1'
,
'0'
,
'0'
,
0
};
char
bufferA
[
MAX_REPLY_LEN
];
LPWSTR
status_code
,
status_text
;
DWORD
cchMaxRawHeaders
=
1024
;
...
...
@@ -3034,19 +3035,37 @@ static INT HTTP_GetResponseHeaders(LPWININETHTTPREQW lpwhr)
if
(
!
NETCON_connected
(
&
lpwhr
->
netConnection
))
goto
lend
;
/*
* HACK peek at the buffer
*/
NETCON_recv
(
&
lpwhr
->
netConnection
,
buffer
,
buflen
,
MSG_PEEK
,
&
rc
);
do
{
/*
* HACK peek at the buffer
*/
buflen
=
MAX_REPLY_LEN
;
NETCON_recv
(
&
lpwhr
->
netConnection
,
buffer
,
buflen
,
MSG_PEEK
,
&
rc
);
/*
* We should first receive 'HTTP/1.x nnn OK' where nnn is the status code.
*/
buflen
=
MAX_REPLY_LEN
;
memset
(
buffer
,
0
,
MAX_REPLY_LEN
);
if
(
!
NETCON_getNextLine
(
&
lpwhr
->
netConnection
,
bufferA
,
&
buflen
))
goto
lend
;
MultiByteToWideChar
(
CP_ACP
,
0
,
bufferA
,
buflen
,
buffer
,
MAX_REPLY_LEN
);
/*
* We should first receive 'HTTP/1.x nnn OK' where nnn is the status code.
*/
memset
(
buffer
,
0
,
MAX_REPLY_LEN
);
if
(
!
NETCON_getNextLine
(
&
lpwhr
->
netConnection
,
bufferA
,
&
buflen
))
goto
lend
;
MultiByteToWideChar
(
CP_ACP
,
0
,
bufferA
,
buflen
,
buffer
,
MAX_REPLY_LEN
);
/* split the version from the status code */
status_code
=
strchrW
(
buffer
,
' '
);
if
(
!
status_code
)
goto
lend
;
*
status_code
++=
0
;
/* split the status code from the status text */
status_text
=
strchrW
(
status_code
,
' '
);
if
(
!
status_text
)
goto
lend
;
*
status_text
++=
0
;
TRACE
(
"version [%s] status code [%s] status text [%s]
\n
"
,
debugstr_w
(
buffer
),
debugstr_w
(
status_code
),
debugstr_w
(
status_text
)
);
}
while
(
!
strcmpW
(
status_code
,
szHundred
));
/* ignore "100 Continue" responses */
/* regenerate raw headers */
while
(
cchRawHeaders
+
buflen
+
strlenW
(
szCrLf
)
>
cchMaxRawHeaders
)
...
...
@@ -3060,21 +3079,6 @@ static INT HTTP_GetResponseHeaders(LPWININETHTTPREQW lpwhr)
cchRawHeaders
+=
sizeof
(
szCrLf
)
/
sizeof
(
szCrLf
[
0
])
-
1
;
lpszRawHeaders
[
cchRawHeaders
]
=
'\0'
;
/* split the version from the status code */
status_code
=
strchrW
(
buffer
,
' '
);
if
(
!
status_code
)
goto
lend
;
*
status_code
++=
0
;
/* split the status code from the status text */
status_text
=
strchrW
(
status_code
,
' '
);
if
(
!
status_text
)
goto
lend
;
*
status_text
++=
0
;
TRACE
(
"version [%s] status code [%s] status text [%s]
\n
"
,
debugstr_w
(
buffer
),
debugstr_w
(
status_code
),
debugstr_w
(
status_text
)
);
HTTP_ProcessHeader
(
lpwhr
,
szStatus
,
status_code
,
HTTP_ADDHDR_FLAG_REPLACE
);
...
...
dlls/wininet/tests/http.c
View file @
2617fb6d
...
...
@@ -1305,18 +1305,21 @@ done:
ok
(
InternetCloseHandle
(
hSession
),
"Close session handle failed
\n
"
);
}
static
const
char
contmsg
[]
=
"HTTP/1.1 100 Continue
\r\n
"
;
static
const
char
okmsg
[]
=
"HTTP/1.
0
200 OK
\r\n
"
"HTTP/1.
1
200 OK
\r\n
"
"Server: winetest
\r\n
"
"
\r\n
"
;
static
const
char
notokmsg
[]
=
"HTTP/1.
0
400 Bad Request
\r\n
"
"HTTP/1.
1
400 Bad Request
\r\n
"
"Server: winetest
\r\n
"
"
\r\n
"
;
static
const
char
noauthmsg
[]
=
"HTTP/1.
0
401 Unauthorized
\r\n
"
"HTTP/1.
1
401 Unauthorized
\r\n
"
"Server: winetest
\r\n
"
"
\r\n
"
;
...
...
@@ -1435,6 +1438,14 @@ static DWORD CALLBACK server_thread(LPVOID param)
send
(
c
,
notokmsg
,
sizeof
notokmsg
-
1
,
0
);
}
if
(
strstr
(
buffer
,
"GET /test6"
))
{
send
(
c
,
contmsg
,
sizeof
contmsg
-
1
,
0
);
send
(
c
,
contmsg
,
sizeof
contmsg
-
1
,
0
);
send
(
c
,
okmsg
,
sizeof
okmsg
-
1
,
0
);
send
(
c
,
page1
,
sizeof
page1
-
1
,
0
);
}
if
(
strstr
(
buffer
,
"GET /quit"
))
{
send
(
c
,
okmsg
,
sizeof
okmsg
-
1
,
0
);
...
...
@@ -1663,6 +1674,7 @@ static void test_http_connection(void)
test_proxy_direct
(
si
.
port
);
test_header_handling_order
(
si
.
port
);
test_basic_request
(
si
.
port
,
"POST"
,
"/test5"
);
test_basic_request
(
si
.
port
,
"GET"
,
"/test6"
);
/* 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