fix bug, first scan works.

event_stream
Ryan Dahl 15 years ago
parent b71a17ec85
commit d931481302

@ -20,6 +20,12 @@ do { \
} while (0) } while (0)
#define CALLBACK(FOR) \ #define CALLBACK(FOR) \
do { \
if (0 != FOR##_callback(parser, p)) return (p - data); \
parser->FOR##_mark = NULL; \
} while (0)
#define CALLBACK_NOCLEAR(FOR) \
do { \ do { \
if (0 != FOR##_callback(parser, p)) return (p - data); \ if (0 != FOR##_callback(parser, p)) return (p - data); \
} while (0) } while (0)
@ -59,7 +65,6 @@ static inline int FOR##_callback (http_parser *parser, const char *p) \
if (parser->FOR##_size > MAX_FIELD_SIZE) return -1; \ if (parser->FOR##_size > MAX_FIELD_SIZE) return -1; \
int r = 0; \ int r = 0; \
if (parser->on_##FOR) r = parser->on_##FOR(parser, mark, p - mark); \ if (parser->on_##FOR) r = parser->on_##FOR(parser, mark, p - mark); \
parser->FOR##_mark = NULL; \
return r; \ return r; \
} }
@ -1191,12 +1196,12 @@ size_t http_parser_execute (http_parser *parser, const char *data, size_t len)
} }
} }
CALLBACK(header_field); CALLBACK_NOCLEAR(header_field);
CALLBACK(header_value); CALLBACK_NOCLEAR(header_value);
CALLBACK(fragment); CALLBACK_NOCLEAR(fragment);
CALLBACK(query_string); CALLBACK_NOCLEAR(query_string);
CALLBACK(path); CALLBACK_NOCLEAR(path);
CALLBACK(uri); CALLBACK_NOCLEAR(uri);
parser->state = state; parser->state = state;
parser->header_state = header_state; parser->header_state = header_state;

Loading…
Cancel
Save