Hans Leidekker : wininet: Always send a content length header, even if there is no content.
Alexandre Julliard
julliard at winehq.org
Mon Oct 29 08:34:53 CDT 2007
Module: wine
Branch: master
Commit: 64359c2432fda82d5565417417c92578825dc089
URL: http://source.winehq.org/git/wine.git/?a=commit;h=64359c2432fda82d5565417417c92578825dc089
Author: Hans Leidekker <hans at it.vu.nl>
Date: Sun Oct 28 16:32:46 2007 +0100
wininet: Always send a content length header, even if there is no content.
---
dlls/wininet/http.c | 15 +++++----------
dlls/wininet/tests/http.c | 12 ++++++++++++
2 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index f496733..53d6fba 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -2589,6 +2589,9 @@ BOOL WINAPI HTTP_HttpSendRequestW(LPWININETHTTPREQW lpwhr, LPCWSTR lpszHeaders,
BOOL loop_next;
INTERNET_ASYNC_RESULT iar;
static const WCHAR szClose[] = { 'C','l','o','s','e',0 };
+ static const WCHAR szContentLength[] =
+ { 'C','o','n','t','e','n','t','-','L','e','n','g','t','h',':',' ','%','l','i','\r','\n',0 };
+ WCHAR contentLengthStr[sizeof szContentLength/2 /* includes \r\n */ + 20 /* int */ ];
TRACE("--> %p\n", lpwhr);
@@ -2599,16 +2602,8 @@ BOOL WINAPI HTTP_HttpSendRequestW(LPWININETHTTPREQW lpwhr, LPCWSTR lpszHeaders,
HTTP_FixVerb(lpwhr);
- /* if we are using optional stuff, we must add the fixed header of that option length */
- if (dwContentLength > 0)
- {
- static const WCHAR szContentLength[] = {
- 'C','o','n','t','e','n','t','-','L','e','n','g','t','h',':',' ','%','l','i','\r','\n',0};
- WCHAR contentLengthStr[sizeof szContentLength/2 /* includes \n\r */ + 20 /* int */ ];
- sprintfW(contentLengthStr, szContentLength, dwContentLength);
- HTTP_HttpAddRequestHeadersW(lpwhr, contentLengthStr, -1L,
- HTTP_ADDREQ_FLAG_ADD | HTTP_ADDHDR_FLAG_REPLACE);
- }
+ sprintfW(contentLengthStr, szContentLength, dwContentLength);
+ HTTP_HttpAddRequestHeadersW(lpwhr, contentLengthStr, -1L, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDHDR_FLAG_REPLACE);
do
{
diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index 589fe8a..a8f989b 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -1302,6 +1302,17 @@ static DWORD CALLBACK server_thread(LPVOID param)
send(c, notokmsg, sizeof notokmsg-1, 0);
}
+ if (strstr(buffer, "/test5"))
+ {
+ if (strstr(buffer, "Content-Length: 0"))
+ {
+ send(c, okmsg, sizeof okmsg-1, 0);
+ send(c, page1, sizeof page1-1, 0);
+ }
+ else
+ send(c, notokmsg, sizeof notokmsg-1, 0);
+ }
+
if (strstr(buffer, "/quit"))
{
send(c, okmsg, sizeof okmsg-1, 0);
@@ -1526,6 +1537,7 @@ static void test_http_connection(void)
test_proxy_indirect(si.port);
test_proxy_direct(si.port);
test_header_handling_order(si.port);
+ test_basic_request(si.port, "/test5");
/* send the basic request again to shutdown the server thread */
test_basic_request(si.port, "/quit");
More information about the wine-cvs
mailing list