parser->method = (enum http_method) 0;
parser->index = 1;
switch (ch) {
+ case 'A': parser->method = HTTP_ANNOUNCE; break;
case 'C': parser->method = HTTP_CONNECT; /* or COPY, CHECKOUT */ break;
- case 'D': parser->method = HTTP_DELETE; break;
- case 'G': parser->method = HTTP_GET; break;
+ case 'D': parser->method = HTTP_DELETE; /* or DESCRIBE */ break;
+ case 'F': parser->method = HTTP_FLUSH; break;
+ case 'G': parser->method = HTTP_GET; /* or GET_PARAMETER */ 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, 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|PROPPATCH|PUT|PATCH|PURGE */
+ /* or PROPFIND|PROPPATCH|PUT|PATCH|PURGE|PLAY|PAUSE */
break;
- case 'R': parser->method = HTTP_REPORT; break;
- case 'S': parser->method = HTTP_SUBSCRIBE; /* or SEARCH */ break;
- case 'T': parser->method = HTTP_TRACE; break;
+ case 'R': parser->method = HTTP_REPORT; /* or REDIRECT, RECORD */ break;
+ case 'S': parser->method = HTTP_SUBSCRIBE; /* or SEARCH, SETUP, SET_PARAMETER */ break;
+ case 'T': parser->method = HTTP_TRACE; /* or TEARDOWN */ break;
case 'U': parser->method = HTTP_UNLOCK; /* or UNSUBSCRIBE */ break;
default:
SET_ERRNO(HPE_INVALID_METHOD);
} else {
goto error;
}
+ } else if (parser->index == 2 && parser->method == HTTP_DELETE && ch == 'S') {
+ parser->method = HTTP_DESCRIBE;
+ } else if (parser->index == 3 && parser->method == HTTP_GET && ch == '_') {
+ parser->method = HTTP_GET_PARAMETER;
} else if (parser->method == HTTP_MKCOL) {
if (parser->index == 1 && ch == 'O') {
parser->method = HTTP_MOVE;
}
} else if (parser->method == HTTP_SUBSCRIBE) {
if (parser->index == 1 && ch == 'E') {
- parser->method = HTTP_SEARCH;
+ parser->method = HTTP_SEARCH; /* or HTTP_SETUP or HTTP_SET_PARAMETER */
+ } else {
+ goto error;
+ }
+ } else if (parser->method == HTTP_TRACE) {
+ if (parser->index == 1 && ch == 'E') {
+ parser->method = HTTP_TEARDOWN;
} else {
goto error;
}
} else if (ch == 'U') {
parser->method = HTTP_PUT; /* or HTTP_PURGE */
} else if (ch == 'A') {
- parser->method = HTTP_PATCH;
+ parser->method = HTTP_PATCH; /* or HTTP_PAUSE */
+ } else if (ch == 'L') {
+ parser->method = HTTP_PLAY;
} else {
goto error;
}
} else if (parser->index == 2) {
if (parser->method == HTTP_PUT) {
if (ch == 'R') parser->method = HTTP_PURGE;
+ } else if (parser->method == HTTP_PATCH) {
+ if (ch == 'U') parser->method = HTTP_PAUSE;
+ } else if (parser->method == HTTP_REPORT && ch == 'D') {
+ parser->method = HTTP_REDIRECT;
+ } else if (parser->method == HTTP_REPORT && ch == 'C') {
+ parser->method = HTTP_RECORD;
+ } else if (parser->method == HTTP_SEARCH) {
+ if (ch == 'T') parser->method = HTTP_SETUP; /* or HTTP_SET_PARAMETER */
} else if (parser->method == HTTP_UNLOCK) {
if (ch == 'S') parser->method = HTTP_UNSUBSCRIBE;
+ } else {
+ goto error;
}
+ } else if (parser->index == 3 && parser->method == HTTP_SETUP && ch == '_') {
+ parser->method = HTTP_SET_PARAMETER;
} else if (parser->index == 4 && parser->method == HTTP_PROPFIND && ch == 'P') {
parser->method = HTTP_PROPPATCH;
} else {
case s_req_http_start:
switch (ch) {
case 'H':
+ case 'R':
parser->state = s_req_http_H;
break;
case ' ':
* faster
*/
#ifndef HTTP_PARSER_STRICT
-# define HTTP_PARSER_STRICT 1
+# define HTTP_PARSER_STRICT 0
#endif
/* Compile with -DHTTP_PARSER_DEBUG=1 to add extra debugging information to
/* RFC-5789 */ \
XX(24, PATCH, PATCH) \
XX(25, PURGE, PURGE) \
+ /* RFC-2326 (RTSP) */ \
+ XX(26, DESCRIBE, DESCRIBE) \
+ XX(27, ANNOUNCE, ANNOUNCE) \
+ XX(28, SETUP, SETUP) \
+ XX(29, PLAY, PLAY) \
+ XX(30, PAUSE, PAUSE) \
+ XX(31, TEARDOWN, TEARDOWN) \
+ XX(32, GET_PARAMETER, GET_PARAMETER) \
+ XX(33, SET_PARAMETER, SET_PARAMETER) \
+ XX(34, REDIRECT, REDIRECT) \
+ XX(35, RECORD, RECORD) \
+ /* RAOP */ \
+ XX(36, FLUSH, FLUSH) \
enum http_method
{