Permalink
Browse files

Support long messages

  • Loading branch information...
1 parent 120f0f6 commit a59ba4d866ef6abfa25e3f763e6c4f8990a4877d @ry ry committed Jul 26, 2010
Showing with 8 additions and 7 deletions.
  1. +5 −5 http_parser.c
  2. +3 −2 http_parser.h
View
@@ -287,12 +287,12 @@ size_t http_parser_execute (http_parser *parser,
{
char c, ch;
const char *p = data, *pe;
- ssize_t to_read;
+ int64_t to_read;
enum state state = (enum state) parser->state;
enum header_states header_state = (enum header_states) parser->header_state;
- size_t index = parser->index;
- size_t nread = parser->nread;
+ uint64_t index = parser->index;
+ uint64_t nread = parser->nread;
if (len == 0) {
if (state == s_body_identity_eof) {
@@ -1376,7 +1376,7 @@ size_t http_parser_execute (http_parser *parser,
}
case s_body_identity:
- to_read = MIN(pe - p, (ssize_t)parser->content_length);
+ to_read = MIN(pe - p, (int64_t)parser->content_length);
if (to_read > 0) {
if (settings->on_body) settings->on_body(parser, p, to_read);
p += to_read - 1;
@@ -1461,7 +1461,7 @@ size_t http_parser_execute (http_parser *parser,
{
assert(parser->flags & F_CHUNKED);
- to_read = MIN(pe - p, (ssize_t)(parser->content_length));
+ to_read = MIN(pe - p, (int64_t)(parser->content_length));
if (to_read > 0) {
if (settings->on_body) settings->on_body(parser, p, to_read);
View
@@ -26,6 +26,7 @@ extern "C" {
#include <sys/types.h>
+#include <stdint.h>
#ifdef _WIN32
typedef unsigned int size_t;
@@ -106,8 +107,8 @@ struct http_parser {
char flags;
- size_t nread;
- ssize_t content_length;
+ uint64_t nread;
+ int64_t content_length;
/** READ-ONLY **/
unsigned short http_major;

0 comments on commit a59ba4d

Please sign in to comment.