From d47907a73036b07ce61c7ce81d19cde6bc2c4056 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sat, 16 Feb 2008 20:50:02 +0000 Subject: [PATCH] r14213@tombo: nickm | 2008-02-16 15:48:07 -0500 Patch from Scott Lamb: make http content length into a 64-bit value. svn:r641 --- ChangeLog | 2 ++ evhttp.h | 2 +- http.c | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index f36b0149..deb3780c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -40,6 +40,8 @@ Changes in current version: o event_base_get_method; from Springande Ulv o Send CRLF after each chunk in HTTP output, for compliance with RFC2626. Patch from "propanbutan". Fixes bug 1894184. o Add a int64_t parsing function, with unit tests, so we can apply Scott Lamb's fix to allow large HTTP values. + o Use a 64-bit field to hold HTTP content-lengths. Patch from Scott Lamb. + Changes in 1.4.0: o allow \r or \n individually to separate HTTP headers instead of the standard "\r\n"; from Charles Kerr. diff --git a/evhttp.h b/evhttp.h index 20a33b93..4a85d0d9 100644 --- a/evhttp.h +++ b/evhttp.h @@ -204,7 +204,7 @@ struct { char *response_code_line; /* Readable response */ struct evbuffer *input_buffer; /* read data */ - int ntoread; + ev_int64_t ntoread; int chunked; struct evbuffer *output_buffer; /* outgoing post or data */ diff --git a/http.c b/http.c index 1c791c07..0787b2e8 100644 --- a/http.c +++ b/http.c @@ -707,7 +707,7 @@ evhttp_handle_chunked_read(struct evhttp_request *req, struct evbuffer *buf) event_free(p); continue; } - req->ntoread = strtol(p, &endp, 16); + req->ntoread = evutil_strtoll(p, &endp, 16); error = *p == '\0' || (*endp != '\0' && *endp != ' '); event_free(p); if (error) { @@ -1321,7 +1321,7 @@ evhttp_get_body_length(struct evhttp_request *req) req->ntoread = -1; } else { char *endp; - req->ntoread = strtol(content_length, &endp, 10); + req->ntoread = evutil_strtoll(content_length, &endp, 10); if (*content_length == '\0' || *endp != '\0') { event_warnx("%s: illegal content length: %s", __func__, content_length); -- 2.50.1