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

Commit 6e3f17a

Browse files
committed
methods: add link and unlink
LINK and UNLINK are registered methods and are in real world use.
1 parent e01811e commit 6e3f17a

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

http_parser.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,6 +1000,13 @@ size_t http_parser_execute (http_parser *parser,
10001000
UPDATE_STATE(s_req_spaces_before_url);
10011001
} else if (ch == matcher[parser->index]) {
10021002
; /* nada */
1003+
} else if (parser->method == HTTP_LOCK) {
1004+
if (parser->index == 1 && ch == 'I') {
1005+
parser->method = HTTP_LINK;
1006+
} else {
1007+
SET_ERRNO(HPE_INVALID_METHOD);
1008+
goto error;
1009+
}
10031010
} else if (parser->method == HTTP_CONNECT) {
10041011
if (parser->index == 1 && ch == 'H') {
10051012
parser->method = HTTP_CHECKOUT;
@@ -1070,6 +1077,13 @@ size_t http_parser_execute (http_parser *parser,
10701077
SET_ERRNO(HPE_INVALID_METHOD);
10711078
goto error;
10721079
}
1080+
} else if (parser->method == HTTP_UNLOCK && parser->index == 3) {
1081+
if (ch == 'I') {
1082+
parser->method = HTTP_UNLINK;
1083+
} else {
1084+
SET_ERRNO(HPE_INVALID_METHOD);
1085+
goto error;
1086+
}
10731087
} else if (parser->index == 4 && parser->method == HTTP_PROPFIND && ch == 'P') {
10741088
parser->method = HTTP_PROPPATCH;
10751089
} else {

http_parser.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ typedef int (*http_cb) (http_parser*);
124124
XX(29, PURGE, PURGE) \
125125
/* CalDAV */ \
126126
XX(30, MKCALENDAR, MKCALENDAR) \
127+
/* RFC-7237 */ \
128+
XX(31, LINK, LINK) \
129+
XX(32, UNLINK, UNLINK) \
127130

128131
enum http_method
129132
{

0 commit comments

Comments
 (0)