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
656a0358
Commit
656a0358
authored
May 31, 2008
by
Hans Leidekker
Committed by
Alexandre Julliard
Jun 02, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Don't send a "Connection: Close" header.
parent
a6dc4a9a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
13 deletions
+64
-13
http.c
dlls/wininet/http.c
+4
-5
http.c
dlls/wininet/tests/http.c
+60
-8
No files found.
dlls/wininet/http.c
View file @
656a0358
...
@@ -3156,7 +3156,6 @@ BOOL WINAPI HTTP_HttpSendRequestW(LPWININETHTTPREQW lpwhr, LPCWSTR lpszHeaders,
...
@@ -3156,7 +3156,6 @@ BOOL WINAPI HTTP_HttpSendRequestW(LPWININETHTTPREQW lpwhr, LPCWSTR lpszHeaders,
INT
responseLen
;
INT
responseLen
;
BOOL
loop_next
;
BOOL
loop_next
;
INTERNET_ASYNC_RESULT
iar
;
INTERNET_ASYNC_RESULT
iar
;
static
const
WCHAR
szClose
[]
=
{
'C'
,
'l'
,
'o'
,
's'
,
'e'
,
0
};
static
const
WCHAR
szPost
[]
=
{
'P'
,
'O'
,
'S'
,
'T'
,
0
};
static
const
WCHAR
szPost
[]
=
{
'P'
,
'O'
,
'S'
,
'T'
,
0
};
static
const
WCHAR
szContentLength
[]
=
static
const
WCHAR
szContentLength
[]
=
{
'C'
,
'o'
,
'n'
,
't'
,
'e'
,
'n'
,
't'
,
'-'
,
'L'
,
'e'
,
'n'
,
'g'
,
't'
,
'h'
,
':'
,
' '
,
'%'
,
'l'
,
'i'
,
'\r'
,
'\n'
,
0
};
{
'C'
,
'o'
,
'n'
,
't'
,
'e'
,
'n'
,
't'
,
'-'
,
'L'
,
'e'
,
'n'
,
'g'
,
't'
,
'h'
,
':'
,
' '
,
'%'
,
'l'
,
'i'
,
'\r'
,
'\n'
,
0
};
...
@@ -3211,10 +3210,10 @@ BOOL WINAPI HTTP_HttpSendRequestW(LPWININETHTTPREQW lpwhr, LPCWSTR lpszHeaders,
...
@@ -3211,10 +3210,10 @@ BOOL WINAPI HTTP_HttpSendRequestW(LPWININETHTTPREQW lpwhr, LPCWSTR lpszHeaders,
}
}
HTTP_FixURL
(
lpwhr
);
HTTP_FixURL
(
lpwhr
);
HTTP_ProcessHeader
(
lpwhr
,
szConnection
,
if
(
lpwhr
->
hdr
.
dwFlags
&
INTERNET_FLAG_KEEP_CONNECTION
)
lpwhr
->
hdr
.
dwFlags
&
INTERNET_FLAG_KEEP_CONNECTION
?
szKeepAlive
:
szClose
,
{
HTTP_ADDHDR_FLAG_REQ
|
HTTP_ADDHDR_FLAG_REPLACE
);
HTTP_ProcessHeader
(
lpwhr
,
szConnection
,
szKeepAlive
,
HTTP_ADDHDR_FLAG_REQ
|
HTTP_ADDHDR_FLAG_REPLACE
);
}
HTTP_InsertAuthorization
(
lpwhr
,
lpwhr
->
pAuthInfo
,
szAuthorization
);
HTTP_InsertAuthorization
(
lpwhr
,
lpwhr
->
pAuthInfo
,
szAuthorization
);
HTTP_InsertAuthorization
(
lpwhr
,
lpwhr
->
pProxyAuthInfo
,
szProxy_Authorization
);
HTTP_InsertAuthorization
(
lpwhr
,
lpwhr
->
pProxyAuthInfo
,
szProxy_Authorization
);
...
...
dlls/wininet/tests/http.c
View file @
656a0358
...
@@ -1394,7 +1394,6 @@ static DWORD CALLBACK server_thread(LPVOID param)
...
@@ -1394,7 +1394,6 @@ static DWORD CALLBACK server_thread(LPVOID param)
buffer
[
i
-
3
]
==
'\r'
&&
buffer
[
i
-
1
]
==
'\r'
)
buffer
[
i
-
3
]
==
'\r'
&&
buffer
[
i
-
1
]
==
'\r'
)
break
;
break
;
}
}
if
(
strstr
(
buffer
,
"GET /test1"
))
if
(
strstr
(
buffer
,
"GET /test1"
))
{
{
if
(
!
strstr
(
buffer
,
"Content-Length: 0"
))
if
(
!
strstr
(
buffer
,
"Content-Length: 0"
))
...
@@ -1405,7 +1404,6 @@ static DWORD CALLBACK server_thread(LPVOID param)
...
@@ -1405,7 +1404,6 @@ static DWORD CALLBACK server_thread(LPVOID param)
else
else
send
(
c
,
notokmsg
,
sizeof
notokmsg
-
1
,
0
);
send
(
c
,
notokmsg
,
sizeof
notokmsg
-
1
,
0
);
}
}
if
(
strstr
(
buffer
,
"/test2"
))
if
(
strstr
(
buffer
,
"/test2"
))
{
{
if
(
strstr
(
buffer
,
"Proxy-Authorization: Basic bWlrZToxMTAx"
))
if
(
strstr
(
buffer
,
"Proxy-Authorization: Basic bWlrZToxMTAx"
))
...
@@ -1416,7 +1414,6 @@ static DWORD CALLBACK server_thread(LPVOID param)
...
@@ -1416,7 +1414,6 @@ static DWORD CALLBACK server_thread(LPVOID param)
else
else
send
(
c
,
proxymsg
,
sizeof
proxymsg
-
1
,
0
);
send
(
c
,
proxymsg
,
sizeof
proxymsg
-
1
,
0
);
}
}
if
(
strstr
(
buffer
,
"/test3"
))
if
(
strstr
(
buffer
,
"/test3"
))
{
{
if
(
strstr
(
buffer
,
"Authorization: Basic dXNlcjpwd2Q="
))
if
(
strstr
(
buffer
,
"Authorization: Basic dXNlcjpwd2Q="
))
...
@@ -1424,7 +1421,6 @@ static DWORD CALLBACK server_thread(LPVOID param)
...
@@ -1424,7 +1421,6 @@ static DWORD CALLBACK server_thread(LPVOID param)
else
else
send
(
c
,
noauthmsg
,
sizeof
noauthmsg
-
1
,
0
);
send
(
c
,
noauthmsg
,
sizeof
noauthmsg
-
1
,
0
);
}
}
if
(
strstr
(
buffer
,
"/test4"
))
if
(
strstr
(
buffer
,
"/test4"
))
{
{
if
(
strstr
(
buffer
,
"Connection: Close"
))
if
(
strstr
(
buffer
,
"Connection: Close"
))
...
@@ -1432,7 +1428,6 @@ static DWORD CALLBACK server_thread(LPVOID param)
...
@@ -1432,7 +1428,6 @@ static DWORD CALLBACK server_thread(LPVOID param)
else
else
send
(
c
,
notokmsg
,
sizeof
notokmsg
-
1
,
0
);
send
(
c
,
notokmsg
,
sizeof
notokmsg
-
1
,
0
);
}
}
if
(
strstr
(
buffer
,
"POST /test5"
))
if
(
strstr
(
buffer
,
"POST /test5"
))
{
{
if
(
strstr
(
buffer
,
"Content-Length: 0"
))
if
(
strstr
(
buffer
,
"Content-Length: 0"
))
...
@@ -1443,7 +1438,6 @@ static DWORD CALLBACK server_thread(LPVOID param)
...
@@ -1443,7 +1438,6 @@ static DWORD CALLBACK server_thread(LPVOID param)
else
else
send
(
c
,
notokmsg
,
sizeof
notokmsg
-
1
,
0
);
send
(
c
,
notokmsg
,
sizeof
notokmsg
-
1
,
0
);
}
}
if
(
strstr
(
buffer
,
"GET /test6"
))
if
(
strstr
(
buffer
,
"GET /test6"
))
{
{
send
(
c
,
contmsg
,
sizeof
contmsg
-
1
,
0
);
send
(
c
,
contmsg
,
sizeof
contmsg
-
1
,
0
);
...
@@ -1451,7 +1445,6 @@ static DWORD CALLBACK server_thread(LPVOID param)
...
@@ -1451,7 +1445,6 @@ static DWORD CALLBACK server_thread(LPVOID param)
send
(
c
,
okmsg
,
sizeof
okmsg
-
1
,
0
);
send
(
c
,
okmsg
,
sizeof
okmsg
-
1
,
0
);
send
(
c
,
page1
,
sizeof
page1
-
1
,
0
);
send
(
c
,
page1
,
sizeof
page1
-
1
,
0
);
}
}
if
(
strstr
(
buffer
,
"POST /test7"
))
if
(
strstr
(
buffer
,
"POST /test7"
))
{
{
if
(
strstr
(
buffer
,
"Content-Length: 100"
))
if
(
strstr
(
buffer
,
"Content-Length: 100"
))
...
@@ -1462,7 +1455,22 @@ static DWORD CALLBACK server_thread(LPVOID param)
...
@@ -1462,7 +1455,22 @@ static DWORD CALLBACK server_thread(LPVOID param)
else
else
send
(
c
,
notokmsg
,
sizeof
notokmsg
-
1
,
0
);
send
(
c
,
notokmsg
,
sizeof
notokmsg
-
1
,
0
);
}
}
if
(
strstr
(
buffer
,
"/test8"
))
{
if
(
!
strstr
(
buffer
,
"Connection: Close"
)
&&
strstr
(
buffer
,
"Connection: Keep-Alive"
))
send
(
c
,
okmsg
,
sizeof
okmsg
-
1
,
0
);
else
send
(
c
,
notokmsg
,
sizeof
notokmsg
-
1
,
0
);
}
if
(
strstr
(
buffer
,
"/test9"
))
{
if
(
!
strstr
(
buffer
,
"Connection: Close"
)
&&
!
strstr
(
buffer
,
"Connection: Keep-Alive"
))
send
(
c
,
okmsg
,
sizeof
okmsg
-
1
,
0
);
else
send
(
c
,
notokmsg
,
sizeof
notokmsg
-
1
,
0
);
}
if
(
strstr
(
buffer
,
"GET /quit"
))
if
(
strstr
(
buffer
,
"GET /quit"
))
{
{
send
(
c
,
okmsg
,
sizeof
okmsg
-
1
,
0
);
send
(
c
,
okmsg
,
sizeof
okmsg
-
1
,
0
);
...
@@ -1686,6 +1694,49 @@ static void test_header_handling_order(int port)
...
@@ -1686,6 +1694,49 @@ static void test_header_handling_order(int port)
InternetCloseHandle
(
session
);
InternetCloseHandle
(
session
);
}
}
static
void
test_connection_header
(
int
port
)
{
HINTERNET
ses
,
con
,
req
;
DWORD
size
,
status
;
BOOL
ret
;
ses
=
InternetOpen
(
"winetest"
,
INTERNET_OPEN_TYPE_DIRECT
,
NULL
,
NULL
,
0
);
ok
(
ses
!=
NULL
,
"InternetOpen failed
\n
"
);
con
=
InternetConnect
(
ses
,
"localhost"
,
port
,
NULL
,
NULL
,
INTERNET_SERVICE_HTTP
,
0
,
0
);
ok
(
con
!=
NULL
,
"InternetConnect failed
\n
"
);
req
=
HttpOpenRequest
(
con
,
NULL
,
"/test8"
,
NULL
,
NULL
,
NULL
,
INTERNET_FLAG_KEEP_CONNECTION
,
0
);
ok
(
req
!=
NULL
,
"HttpOpenRequest failed
\n
"
);
ret
=
HttpSendRequest
(
req
,
NULL
,
0
,
NULL
,
0
);
ok
(
ret
,
"HttpSendRequest failed
\n
"
);
status
=
0
;
size
=
sizeof
(
status
);
ret
=
HttpQueryInfo
(
req
,
HTTP_QUERY_STATUS_CODE
|
HTTP_QUERY_FLAG_NUMBER
,
&
status
,
&
size
,
NULL
);
ok
(
ret
,
"HttpQueryInfo failed
\n
"
);
ok
(
status
==
200
,
"request failed with status %u
\n
"
,
status
);
InternetCloseHandle
(
req
);
req
=
HttpOpenRequest
(
con
,
NULL
,
"/test9"
,
NULL
,
NULL
,
NULL
,
0
,
0
);
ok
(
req
!=
NULL
,
"HttpOpenRequest failed
\n
"
);
ret
=
HttpSendRequest
(
req
,
NULL
,
0
,
NULL
,
0
);
ok
(
ret
,
"HttpSendRequest failed
\n
"
);
status
=
0
;
size
=
sizeof
(
status
);
ret
=
HttpQueryInfo
(
req
,
HTTP_QUERY_STATUS_CODE
|
HTTP_QUERY_FLAG_NUMBER
,
&
status
,
&
size
,
NULL
);
ok
(
ret
,
"HttpQueryInfo failed
\n
"
);
ok
(
status
==
200
,
"request failed with status %u
\n
"
,
status
);
InternetCloseHandle
(
req
);
InternetCloseHandle
(
con
);
InternetCloseHandle
(
ses
);
}
static
void
test_http_connection
(
void
)
static
void
test_http_connection
(
void
)
{
{
struct
server_info
si
;
struct
server_info
si
;
...
@@ -1709,6 +1760,7 @@ static void test_http_connection(void)
...
@@ -1709,6 +1760,7 @@ static void test_http_connection(void)
test_header_handling_order
(
si
.
port
);
test_header_handling_order
(
si
.
port
);
test_basic_request
(
si
.
port
,
"POST"
,
"/test5"
);
test_basic_request
(
si
.
port
,
"POST"
,
"/test5"
);
test_basic_request
(
si
.
port
,
"GET"
,
"/test6"
);
test_basic_request
(
si
.
port
,
"GET"
,
"/test6"
);
test_connection_header
(
si
.
port
);
/* send the basic request again to shutdown the server thread */
/* send the basic request again to shutdown the server thread */
test_basic_request
(
si
.
port
,
"GET"
,
"/quit"
);
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