From d50c9fbfa635fd06253217897001c85e446c906a Mon Sep 17 00:00:00 2001 From: Aki Date: Sat, 15 Aug 2020 16:09:19 +0200 Subject: Moved version parsing to new system --- plop.c | 2 +- request.c | 13 +++++++------ request.h | 1 - 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plop.c b/plop.c index 9748a02..e770a5a 100644 --- a/plop.c +++ b/plop.c @@ -113,7 +113,7 @@ int handle_client(lua_State * L, struct pollfd * pfd, struct request ** request, lua_getglobal((*request)->lua, "Handler"); lua_insert((*request)->lua, 1); lua_pushlstring((*request)->lua, (*request)->data, (*request)->length); - lua_call((*request)->lua, 3, 1); + lua_call((*request)->lua, 4, 1); size_t length; const char * body = lua_tolstring((*request)->lua, -1, &length); diff --git a/request.c b/request.c index 15c26f3..d67eab7 100644 --- a/request.c +++ b/request.c @@ -217,11 +217,11 @@ int parse_step_path(struct request * request) // TODO: Return -1 if version is unsupported, meaning other than HTTP/1.1 int parse_step_version(struct request * request) { - if (0 >= request->version.start) + if (0 >= request->temp.start) { - request->version.start = read_until_word(request); + request->temp.start = read_until_word(request); - if (0 == request->version.start) + if (0 == request->temp.start) { return 0; } @@ -234,10 +234,11 @@ int parse_step_version(struct request * request) return 0; } - request->version.length = request->position - request->version.start; - request->step = parse_step_header_name; + request->temp.length = request->position - request->temp.start; - return parse_step_header_name(request); + lua_pushlstring(request->lua, request->data + request->temp.start, request->temp.length); + + PROCEED_TO(parse_step_header_name); } /// Parses and verifies name of a single header from the request. diff --git a/request.h b/request.h index f017fa1..be5ff0e 100644 --- a/request.h +++ b/request.h @@ -23,7 +23,6 @@ struct request lua_State * lua; int reference; struct span temp; - struct span version; struct header * headerv; int headerc; struct span body; -- cgit v1.1