diff --git a/http_parser.c b/http_parser.c index 99f5a23a..1c471fd4 100644 --- a/http_parser.c +++ b/http_parser.c @@ -1000,6 +1000,13 @@ size_t http_parser_execute (http_parser *parser, UPDATE_STATE(s_req_spaces_before_url); } else if (ch == matcher[parser->index]) { ; /* nada */ + } else if (parser->method == HTTP_LOCK) { + if (parser->index == 1 && ch == 'I') { + parser->method = HTTP_LINK; + } else { + SET_ERRNO(HPE_INVALID_METHOD); + goto error; + } } else if (parser->method == HTTP_CONNECT) { if (parser->index == 1 && ch == 'H') { parser->method = HTTP_CHECKOUT; @@ -1070,6 +1077,13 @@ size_t http_parser_execute (http_parser *parser, SET_ERRNO(HPE_INVALID_METHOD); goto error; } + } else if (parser->method == HTTP_UNLOCK && parser->index == 3) { + if (ch == 'I') { + parser->method = HTTP_UNLINK; + } else { + SET_ERRNO(HPE_INVALID_METHOD); + goto error; + } } else if (parser->index == 4 && parser->method == HTTP_PROPFIND && ch == 'P') { parser->method = HTTP_PROPPATCH; } else { diff --git a/http_parser.h b/http_parser.h index a7bb9b9c..5e98b462 100644 --- a/http_parser.h +++ b/http_parser.h @@ -124,6 +124,9 @@ typedef int (*http_cb) (http_parser*); XX(29, PURGE, PURGE) \ /* CalDAV */ \ XX(30, MKCALENDAR, MKCALENDAR) \ + /* RFC-7237 */ \ + XX(31, LINK, LINK) \ + XX(32, UNLINK, UNLINK) \ enum http_method {