From c006936fd0401e56b1b1a8387b94a653907df0ba Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Sun, 30 Apr 2023 14:31:34 +0000 Subject: [PATCH] http: Only support GET method --- include/http.h | 7 ------- src/http.c | 28 ++-------------------------- 2 files changed, 2 insertions(+), 33 deletions(-) diff --git a/include/http.h b/include/http.h index 958a6a4..c7873a1 100644 --- a/include/http.h +++ b/include/http.h @@ -20,19 +20,12 @@ #include -enum http_method { - HTTP_GET = 1, - HTTP_PUT = 2, - HTTP_OPTIONS = 4, -}; - struct http_kv { char* key; char* value; }; struct http_req { - enum http_method method; size_t header_length; size_t content_length; char* content_type; diff --git a/src/http.c b/src/http.c index 9e29d73..8aca410 100644 --- a/src/http.c +++ b/src/http.c @@ -262,36 +262,12 @@ static int http__literal(struct httplex* lex, const char* str) static int http__get(struct http_req* req, struct httplex* lex) { - if (!http__literal(lex, "GET")) - return 0; - - req->method = HTTP_GET; - return 1; -} - -static int http__put(struct http_req* req, struct httplex* lex) -{ - if (!http__literal(lex, "PUT")) - return 0; - - req->method = HTTP_PUT; - return 1; -} - -static int http__options(struct http_req* req, struct httplex* lex) -{ - if (!http__literal(lex, "OPTIONS")) - return 0; - - req->method = HTTP_OPTIONS; - return 1; + return http__literal(lex, "GET"); } static int http__method(struct http_req* req, struct httplex* lex) { - return http__get(req, lex) - || http__put(req, lex) - || http__options(req, lex); + return http__get(req, lex); } static int http__peek(struct httplex* lex, enum httplex_token_type type)