mirror of
https://gitlab.xiph.org/xiph/icecast-common.git
synced 2024-12-04 14:46:31 -05:00
Feature: Added support for HTTP Methods: OPTIONS, DELETE, TRACE, CONNECT
This added support for the standard HTTP/1.1 methods: * OPTIONS - Query the server to tell what features are supported. * DELETE - Delete a resource on a server. In Icecast2 context this is about what is known as 'kick source'. * TRACE - Asks the server to return the request to the client as body. The client is to send a body-less request and the server will return with a 200 OK and the body to to be the exact bitstream it got from the client (or any (reverse) proxy). The Content-Type is to be set to 'message/http'. * CONNECT - Client asks the server to proxy the request to the given resource. This hardly seems to make sense for Icecast2 but may be used by some clients such as libshout. Therefor I added it as well so we have at least an ID assigned to it. Please note that this is a ABI breaker and you will need to recompile your projects (use 'make clean all'). See: RFC2616
This commit is contained in:
parent
cf289788a3
commit
ae2a956d88
@ -398,6 +398,18 @@ int httpp_parse(http_parser_t *parser, const char *http_data, unsigned long len)
|
||||
case httpp_req_head:
|
||||
httpp_setvar(parser, HTTPP_VAR_REQ_TYPE, "HEAD");
|
||||
break;
|
||||
case httpp_req_options:
|
||||
httpp_setvar(parser, HTTPP_VAR_REQ_TYPE, "OPTIONS");
|
||||
break;
|
||||
case httpp_req_delete:
|
||||
httpp_setvar(parser, HTTPP_VAR_REQ_TYPE, "DELETE");
|
||||
break;
|
||||
case httpp_req_trace:
|
||||
httpp_setvar(parser, HTTPP_VAR_REQ_TYPE, "TRACE");
|
||||
break;
|
||||
case httpp_req_connect:
|
||||
httpp_setvar(parser, HTTPP_VAR_REQ_TYPE, "CONNECT");
|
||||
break;
|
||||
case httpp_req_source:
|
||||
httpp_setvar(parser, HTTPP_VAR_REQ_TYPE, "SOURCE");
|
||||
break;
|
||||
@ -577,6 +589,14 @@ httpp_request_type_e httpp_str_to_method(const char * method) {
|
||||
return httpp_req_put;
|
||||
} else if (strcasecmp("HEAD", method) == 0) {
|
||||
return httpp_req_head;
|
||||
} else if (strcasecmp("OPTIONS", method) == 0) {
|
||||
return httpp_req_options;
|
||||
} else if (strcasecmp("DELETE", method) == 0) {
|
||||
return httpp_req_delete;
|
||||
} else if (strcasecmp("TRACE", method) == 0) {
|
||||
return httpp_req_trace;
|
||||
} else if (strcasecmp("CONNECT", method) == 0) {
|
||||
return httpp_req_connect;
|
||||
} else if (strcasecmp("SOURCE", method) == 0) {
|
||||
return httpp_req_source;
|
||||
} else if (strcasecmp("PLAY", method) == 0) {
|
||||
|
@ -47,6 +47,10 @@ typedef enum httpp_request_type_tag {
|
||||
httpp_req_post,
|
||||
httpp_req_put,
|
||||
httpp_req_head,
|
||||
httpp_req_options,
|
||||
httpp_req_delete,
|
||||
httpp_req_trace,
|
||||
httpp_req_connect,
|
||||
/* Icecast SOURCE, to be replaced with PUT some day */
|
||||
httpp_req_source,
|
||||
/* XXX: ??? */
|
||||
|
Loading…
Reference in New Issue
Block a user