Commit 04c7bdb4 by Edward Thomson

httpclient: clear the read_buf on new requests

The httpclient implementation keeps a `read_buf` that holds the data
in the body of the response after the headers have been written.  We
store that data for subsequent calls to `git_http_client_read_body`.  If
we want to stop reading body data and send another request, we need to
clear that cached data.

Clear the cached body data on new requests, just like we read any
outstanding data from the socket.
parent aa8b2c0f
......@@ -1195,7 +1195,7 @@ static void complete_response_body(git_http_client *client)
/* If we're not keeping alive, don't bother. */
if (!client->keepalive) {
client->connected = 0;
return;
goto done;
}
parser_context.client = client;
......@@ -1209,6 +1209,9 @@ static void complete_response_body(git_http_client *client)
git_error_clear();
client->connected = 0;
}
done:
git_buf_clear(&client->read_buf);
}
int git_http_client_send_request(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment