Skip to content
This repository has been archived by the owner on Nov 6, 2022. It is now read-only.

methods: add link and unlink #266

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions http_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions http_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down