]> granicus.if.org Git - libevent/commitdiff
r14213@tombo: nickm | 2008-02-16 15:48:07 -0500
authorNick Mathewson <nickm@torproject.org>
Sat, 16 Feb 2008 20:50:02 +0000 (20:50 +0000)
committerNick Mathewson <nickm@torproject.org>
Sat, 16 Feb 2008 20:50:02 +0000 (20:50 +0000)
 Patch from Scott Lamb: make http content length into a 64-bit value.

svn:r641

ChangeLog
evhttp.h
http.c

index f36b01494f4abc377c9e3939352ba42c4b79de06..deb3780ca1fce511cab9cda40bfd7a77fd1e56de 100644 (file)
--- 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.
index 20a33b93a243983bd857a1cf2f45502da9d46b37..4a85d0d971f1ee2ba868d8a5c881cb7f82d0a634 100644 (file)
--- 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 1c791c077b2808dd0f325329f74702a0b3e40b0a..0787b2e8fd57e26787b928bb7ae80585681721ef 100644 (file)
--- 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);