Skip to content
Snippets Groups Projects
Commit c2668776 authored by Tom Helander's avatar Tom Helander Committed by Alexandre Julliard
Browse files

http.sys: Skip clean up if HTTP_SEND_RESPONSE_FLAG_MORE_DATA is set.

parent 11f80ae3
No related branches found
No related tags found
No related merge requests found
......@@ -638,7 +638,7 @@ static void receive_data(struct connection *conn)
if (conn->available)
return; /* waiting for an HttpReceiveHttpRequest() call */
if (conn->req_id != HTTP_NULL_ID)
return; /* waiting for an HttpSendHttpResponse() call */
return; /* waiting for an HttpSendHttpResponse() or HttpSendResponseEntityBody() call */
TRACE("Received %u bytes of data.\n", len);
......@@ -1006,23 +1006,28 @@ static NTSTATUS http_send_response(struct request_queue *queue, IRP *irp)
{
if (send(conn->socket, response->buffer, response->len, 0) >= 0)
{
if (conn->content_len)
/* Clean up the connection if we are not sending more response data. */
if (response->response_flags != HTTP_SEND_RESPONSE_FLAG_MORE_DATA)
{
/* Discard whatever entity body is left. */
memmove(conn->buffer, conn->buffer + conn->content_len, conn->len - conn->content_len);
conn->len -= conn->content_len;
if (conn->content_len)
{
/* Discard whatever entity body is left. */
memmove(conn->buffer, conn->buffer + conn->content_len, conn->len - conn->content_len);
conn->len -= conn->content_len;
}
conn->queue = NULL;
conn->req_id = HTTP_NULL_ID;
WSAEventSelect(conn->socket, request_event, FD_READ | FD_CLOSE);
/* We might have another request already in the buffer. */
if (parse_request(conn) < 0)
{
WARN("Failed to parse request; shutting down connection.\n");
send_400(conn);
}
}
conn->queue = NULL;
conn->req_id = HTTP_NULL_ID;
WSAEventSelect(conn->socket, request_event, FD_READ | FD_CLOSE);
irp->IoStatus.Information = response->len;
/* We might have another request already in the buffer. */
if (parse_request(conn) < 0)
{
WARN("Failed to parse request; shutting down connection.\n");
send_400(conn);
}
}
else
{
......
......@@ -46,6 +46,7 @@ struct http_receive_request_params
struct http_response
{
HTTP_REQUEST_ID id;
ULONG response_flags;
int len;
char buffer[1];
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment