parser: add support for icecast SOURCE method

Fixes: https://github.com/nodejs/http-parser/issues/405
PR-URL: https://github.com/nodejs/http-parser/pull/407
Reviewed-By: Fedor Indutny <fedor@indutny.com>
make-http-max-header-size-gyp-configurable
Ben Noordhuis 7 years ago
parent 9ce7316de3
commit 921d558551

@ -942,7 +942,7 @@ reexecute:
/* or PROPFIND|PROPPATCH|PUT|PATCH|PURGE */ /* or PROPFIND|PROPPATCH|PUT|PATCH|PURGE */
break; break;
case 'R': parser->method = HTTP_REPORT; /* or REBIND */ break; case 'R': parser->method = HTTP_REPORT; /* or REBIND */ break;
case 'S': parser->method = HTTP_SUBSCRIBE; /* or SEARCH */ break; case 'S': parser->method = HTTP_SUBSCRIBE; /* or SEARCH, SOURCE */ break;
case 'T': parser->method = HTTP_TRACE; break; case 'T': parser->method = HTTP_TRACE; break;
case 'U': parser->method = HTTP_UNLOCK; /* or UNSUBSCRIBE, UNBIND, UNLINK */ break; case 'U': parser->method = HTTP_UNLOCK; /* or UNSUBSCRIBE, UNBIND, UNLINK */ break;
default: default:
@ -988,6 +988,7 @@ reexecute:
XX(MKCOL, 2, 'A', MKACTIVITY) XX(MKCOL, 2, 'A', MKACTIVITY)
XX(MKCOL, 3, 'A', MKCALENDAR) XX(MKCOL, 3, 'A', MKCALENDAR)
XX(SUBSCRIBE, 1, 'E', SEARCH) XX(SUBSCRIBE, 1, 'E', SEARCH)
XX(SUBSCRIBE, 1, 'O', SOURCE)
XX(REPORT, 2, 'B', REBIND) XX(REPORT, 2, 'B', REBIND)
XX(PROPFIND, 4, 'P', PROPPATCH) XX(PROPFIND, 4, 'P', PROPPATCH)
XX(LOCK, 1, 'I', LINK) XX(LOCK, 1, 'I', LINK)

@ -201,6 +201,8 @@ enum http_status
/* RFC-2068, section 19.6.1.2 */ \ /* RFC-2068, section 19.6.1.2 */ \
XX(31, LINK, LINK) \ XX(31, LINK, LINK) \
XX(32, UNLINK, UNLINK) \ XX(32, UNLINK, UNLINK) \
/* icecast */ \
XX(33, SOURCE, SOURCE) \
enum http_method enum http_method
{ {

@ -1154,6 +1154,26 @@ const struct message requests[] =
,.body= "" ,.body= ""
} }
#define SOURCE_REQUEST 42
, {.name = "source request"
,.type= HTTP_REQUEST
,.raw= "SOURCE /music/sweet/music HTTP/1.1\r\n"
"Host: example.com\r\n"
"\r\n"
,.should_keep_alive= TRUE
,.message_complete_on_eof= FALSE
,.http_major= 1
,.http_minor= 1
,.method= HTTP_SOURCE
,.request_path= "/music/sweet/music"
,.request_url= "/music/sweet/music"
,.query_string= ""
,.fragment= ""
,.num_headers= 1
,.headers= { { "Host", "example.com" } }
,.body= ""
}
, {.name= NULL } /* sentinel */ , {.name= NULL } /* sentinel */
}; };

Loading…
Cancel
Save