1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Use http-parser 2.9.2

This commit is contained in:
winlin 2019-04-24 09:37:25 +08:00
parent 646d490a18
commit cfc92d5e93
5 changed files with 1196 additions and 463 deletions

View file

@ -248,6 +248,12 @@ int SrsHttpParser::on_body(http_parser* parser, const char* at, size_t length)
{
SrsHttpParser* obj = (SrsHttpParser*)parser->data;
srs_assert(obj);
// When got body, but no header-parsed, we update it manually.
char* p = obj->buffer->bytes();
if (!obj->header_parsed && p < at) {
obj->header_parsed = int(at - p);
}
srs_info("Body: %.*s", (int)length, at);

View file

@ -69,7 +69,7 @@ public:
* one parser can only parse request or response messages.
* @param allow_jsonp whether allow jsonp parser, which indicates the method in query string.
*/
virtual srs_error_t initialize(enum http_parser_type type, bool allow_jsonp);
virtual srs_error_t initialize(enum http_parser_type type, bool allow_jsonp = false);
/**
* always parse a http message,
* that is, the *ppmsg always NOT-NULL when return success.