Allow spaces between a chunked start and the CRLF

event_stream
Jeremy Hinegardner 16 years ago committed by Ryan
parent da47c13169
commit b538749fc3

@ -387,11 +387,11 @@ do { \
chunk_ext_val = token*;
chunk_ext_name = token*;
chunk_extension = ( ";" " "* chunk_ext_name ("=" chunk_ext_val)? )*;
last_chunk = "0"+ chunk_extension CRLF;
chunk_size = (xdigit* [1-9a-fA-F] xdigit*) $add_to_chunk_size;
last_chunk = "0"+ ( chunk_extension | " "+) CRLF;
chunk_size = (xdigit* [1-9a-fA-F] xdigit* ) $add_to_chunk_size;
chunk_end = CRLF;
chunk_body = any >skip_chunk_data;
chunk_begin = chunk_size chunk_extension CRLF;
chunk_begin = chunk_size ( chunk_extension | " "+ ) CRLF;
chunk = chunk_begin chunk_body chunk_end;
ChunkedBody := chunk* last_chunk trailing_headers CRLF @end_chunked_body;

@ -362,7 +362,34 @@ const struct message responses[] =
,.num_headers= 0
,.headers= {}
,.body= ""
}
}
, {.name="200 trailing space on chunked body"
,.type= HTTP_RESPONSE
,.raw= "HTTP/1.1 200 OK\r\n"
"Content-Type: text/plain\r\n"
"Transfer-Encoding: chunked\r\n"
"\r\n"
"25 \r\n"
"This is the data in the first chunk\r\n"
"\r\n"
"1C\r\n"
"and this is the second one\r\n"
"\r\n"
"0 \r\n"
"\r\n"
,.should_keep_alive= TRUE
,.status_code= 200
,.num_headers= 2
,.headers=
{ {"Content-Type", "text/plain" }
, {"Transfer-Encoding", "chunked" }
}
,.body =
"This is the data in the first chunk\r\n"
"and this is the second one\r\n"
}
, {.name= NULL } /* sentinel */
};
@ -653,7 +680,7 @@ test_scan (const struct message *r1, const struct message *r2, const struct mess
http_parser_execute(&parser, buf3, buf3_len);
assert(! http_parser_has_error(&parser));
assert(!http_parser_has_error(&parser));
assert(3 == num_messages);

Loading…
Cancel
Save