kore

An easy to use, scalable and secure web application framework for writing web APIs in C.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit b73343aea4de14c17f852300c29e474c88b256f5
parent aed1a63c389884780189613c2550c4eef4cc886e
Author: Stanislav Yudin <stan@endlessinsomnia.com>
Date:   Tue,  4 Apr 2017 17:37:19 +1000

add HTTP_METHOD_OPTIONS as another supported http method. (#186)


Diffstat:
includes/http.h | 1+
src/http.c | 6++++++
src/python.c | 1+
3 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/includes/http.h b/includes/http.h @@ -171,6 +171,7 @@ struct http_file { #define HTTP_METHOD_PUT 2 #define HTTP_METHOD_DELETE 3 #define HTTP_METHOD_HEAD 4 +#define HTTP_METHOD_OPTIONS 5 #define HTTP_REQUEST_COMPLETE 0x0001 #define HTTP_REQUEST_DELETE 0x0002 diff --git a/src/http.c b/src/http.c @@ -231,6 +231,9 @@ http_request_new(struct connection *c, const char *host, } else if (!strcasecmp(method, "head")) { m = HTTP_METHOD_HEAD; flags = HTTP_REQUEST_COMPLETE; + } else if (!strcasecmp(method, "options")) { + m = HTTP_METHOD_OPTIONS; + flags = HTTP_REQUEST_COMPLETE; } else { http_error_response(c, 400); return (KORE_RESULT_ERROR); @@ -1883,6 +1886,9 @@ http_method_text(int method) case HTTP_METHOD_HEAD: r = "HEAD"; break; + case HTTP_METHOD_OPTIONS: + r = "OPTIONS"; + break; default: r = ""; break; diff --git a/src/python.c b/src/python.c @@ -106,6 +106,7 @@ static struct { { "METHOD_HEAD", HTTP_METHOD_HEAD }, { "METHOD_POST", HTTP_METHOD_POST }, { "METHOD_DELETE", HTTP_METHOD_DELETE }, + { "METHOD_OPTIONS", HTTP_METHOD_OPTIONS }, { "WEBSOCKET_OP_TEXT", WEBSOCKET_OP_TEXT }, { "WEBSOCKET_OP_BINARY", WEBSOCKET_OP_BINARY }, { "WEBSOCKET_BROADCAST_LOCAL", WEBSOCKET_BROADCAST_LOCAL },