[PATCH v2] wininet: Reset context length for http status 304
Hans Leidekker
hans at codeweavers.com
Tue Sep 28 06:19:42 CDT 2021
On Tue, 2021-09-28 at 19:36 +1000, Alistair Leslie-Hughes wrote:
> diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
> index e9363208471..4bfd93aa3be 100644
> --- a/dlls/wininet/http.c
> +++ b/dlls/wininet/http.c
> @@ -2918,7 +2918,9 @@ static DWORD set_content_length(http_request_t *request)
> WCHAR encoding[20];
> DWORD size;
>
>
>
>
> - if(request->status_code == HTTP_STATUS_NO_CONTENT || !wcscmp(request->verb, L"HEAD")) {
> + if(request->status_code == HTTP_STATUS_NO_CONTENT || request->status_code == HTTP_STATUS_NOT_MODIFIED ||
> + !wcscmp(request->verb, L"HEAD"))
> + {
> request->contentLength = request->netconn_stream.content_length = 0;
> return ERROR_SUCCESS;
> }
> diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
> index bf4dce80bef..1a4b1a15a4e 100644
> --- a/dlls/wininet/tests/http.c
> +++ b/dlls/wininet/tests/http.c
> @@ -2381,6 +2381,13 @@ static DWORD CALLBACK server_thread(LPVOID param)
> static const char nocontentmsg[] = "HTTP/1.1 204 No Content\r\nConnection: close\r\n\r\n";
> send(c, nocontentmsg, sizeof(nocontentmsg)-1, 0);
> }
> + if (strstr(buffer, "GET /test_not_modified"))
> + {
> + static const char notmodifiedmsg[] = "HTTP/1.1 304 Not Modified\r\nConnection: close\r\n"
> + "Content-Length: 10\r\n"
> + "\r\n";
> + send(c, notmodifiedmsg, sizeof(notmodifiedmsg)-1, 0);
> + }
You should add 10 bytes of data. It turns out that the data is reported
in that case and if the Content-Length header is missing it's not
reported.
More information about the wine-devel
mailing list