kore

Kore is a web application platform for writing scalable, concurrent web based processes in C or Python.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit f0f1296265c5bb84b259b719d60e2891df6f4aca
parent f8b3915ee13e63e169fc75ce98995c1b1f6d5808
Author: rouzier <rouzier@gmail.com>
Date:   Tue,  2 Jan 2018 16:27:59 -0500

Add patch support (#217)

Add PATCH to supported verbs in config and what not.
Diffstat:
includes/http.h | 1+
src/accesslog.c | 3+++
src/config.c | 2++
src/http.c | 6++++++
src/python.c | 1+
5 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/includes/http.h b/includes/http.h @@ -172,6 +172,7 @@ struct http_file { #define HTTP_METHOD_DELETE 3 #define HTTP_METHOD_HEAD 4 #define HTTP_METHOD_OPTIONS 5 +#define HTTP_METHOD_PATCH 6 #define HTTP_REQUEST_COMPLETE 0x0001 #define HTTP_REQUEST_DELETE 0x0002 diff --git a/src/accesslog.c b/src/accesslog.c @@ -88,6 +88,9 @@ kore_accesslog_write(const void *data, u_int32_t len) case HTTP_METHOD_HEAD: method = "HEAD"; break; + case HTTP_METHOD_PATCH: + method = "PATCH"; + break; default: method = "UNKNOWN"; break; diff --git a/src/config.c b/src/config.c @@ -760,6 +760,8 @@ configure_params(char *options) current_method = HTTP_METHOD_DELETE; } else if (!strcasecmp(argv[0], "head")) { current_method = HTTP_METHOD_HEAD; + } else if (!strcasecmp(argv[0], "patch")) { + current_method = HTTP_METHOD_PATCH; } else { printf("unknown method: %s in params block for %s\n", argv[0], argv[1]); diff --git a/src/http.c b/src/http.c @@ -234,6 +234,9 @@ http_request_new(struct connection *c, const char *host, } else if (!strcasecmp(method, "options")) { m = HTTP_METHOD_OPTIONS; flags = HTTP_REQUEST_COMPLETE; + } else if (!strcasecmp(method, "patch")) { + m = HTTP_METHOD_PATCH; + flags = HTTP_REQUEST_EXPECT_BODY; } else { http_error_response(c, 400); return (KORE_RESULT_ERROR); @@ -1894,6 +1897,9 @@ http_method_text(int method) case HTTP_METHOD_OPTIONS: r = "OPTIONS"; break; + case HTTP_METHOD_PATCH: + r = "PATCH"; + break; default: r = ""; break; diff --git a/src/python.c b/src/python.c @@ -107,6 +107,7 @@ static struct { { "METHOD_POST", HTTP_METHOD_POST }, { "METHOD_DELETE", HTTP_METHOD_DELETE }, { "METHOD_OPTIONS", HTTP_METHOD_OPTIONS }, + { "METHOD_PATCH", HTTP_METHOD_PATCH }, { "WEBSOCKET_OP_TEXT", WEBSOCKET_OP_TEXT }, { "WEBSOCKET_OP_BINARY", WEBSOCKET_OP_BINARY }, { "WEBSOCKET_BROADCAST_LOCAL", WEBSOCKET_BROADCAST_LOCAL },