cURL / Mailing Lists / curl-library / Single Mail

curl-library

CURLINFO_REQUEST_SIZE is inaccurate when the HTTP request header is very long

From: Georgios Kontaxis <georgios.kontaxis_at_gmail.com>
Date: Fri, 17 Jun 2016 22:26:49 -0400

In lib/http.c a call to Curl_add_buffer_send() is meant to write the HTTP
request buffer to the socket and store the request's size in
data->info.request_size.

In lib/sendf.c Curl_write() is called which in turn calls send(). However
send() might return bytes_written < len. Nevertheless request_size becomes
bytes_written.

From what I can see the rest of the header data is sent through
Curl_fillreadbuffer(), however request_size is never updated.

The very naive statement "conn->data->info.request_size += nread;"
immediately after fread_func() in Curl_fillreadbuffer(), seems to fix the
issue however I am pretty sure additional checks are necessary.

If I could get some help navigating the code I would be happy writing a
patch.

P.S.: I have tested both 7.49.1 and 7.26.0 and found this issue in both
versions.

Georgios Kontaxis

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-06-18