Add support for "M-SEARCH" and "NOTIFY" request methods.

Allow a request path of "*" (for SSDP requests).
This commit is contained in:
Nathan Rajlich
2010-10-12 11:23:22 -07:00
committed by Ryan Dahl
parent 03970a576d
commit d56a0700d0
3 changed files with 35 additions and 2 deletions

View File

@@ -93,6 +93,8 @@ static const char *method_strings[] =
, "MKACTIVITY"
, "CHECKOUT"
, "MERGE"
, "M-SEARCH"
, "NOTIFY"
};
@@ -575,7 +577,8 @@ size_t http_parser_execute (http_parser *parser,
case 'G': parser->method = HTTP_GET; break;
case 'H': parser->method = HTTP_HEAD; break;
case 'L': parser->method = HTTP_LOCK; break;
case 'M': parser->method = HTTP_MKCOL; /* or MOVE, MKACTIVITY, MERGE */ break;
case 'M': parser->method = HTTP_MKCOL; /* or MOVE, MKACTIVITY, MERGE, M-SEARCH */ break;
case 'N': parser->method = HTTP_NOTIFY; break;
case 'O': parser->method = HTTP_OPTIONS; break;
case 'P': parser->method = HTTP_POST; /* or PROPFIND or PROPPATCH or PUT */ break;
case 'R': parser->method = HTTP_REPORT; break;
@@ -608,6 +611,8 @@ size_t http_parser_execute (http_parser *parser,
parser->method = HTTP_MOVE;
} else if (index == 1 && ch == 'E') {
parser->method = HTTP_MERGE;
} else if (index == 1 && ch == '-') {
parser->method = HTTP_MSEARCH;
} else if (index == 2 && ch == 'A') {
parser->method = HTTP_MKACTIVITY;
}
@@ -628,7 +633,7 @@ size_t http_parser_execute (http_parser *parser,
{
if (ch == ' ') break;
if (ch == '/') {
if (ch == '/' || ch == '*') {
MARK(url);
MARK(path);
state = s_req_path;