mirror of
https://github.com/reactos/wine.git
synced 2025-02-03 10:43:30 +00:00
wininet: Always send a content length header, even if there is no content.
This commit is contained in:
parent
e3b8e2f2dd
commit
64359c2432
@ -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
|
||||
{
|
||||
|
@ -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");
|
||||
|
Loading…
x
Reference in New Issue
Block a user