diff options
author | Aki <please@ignore.pl> | 2020-08-15 16:09:19 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2020-08-15 16:09:19 +0200 |
commit | d50c9fbfa635fd06253217897001c85e446c906a (patch) | |
tree | fd28d3fe2e657de69d541fde01b74db5fbd189ec | |
parent | 80e299845156b605be1a47fdb253d0eea81ce7a2 (diff) | |
download | plop-d50c9fbfa635fd06253217897001c85e446c906a.zip plop-d50c9fbfa635fd06253217897001c85e446c906a.tar.gz plop-d50c9fbfa635fd06253217897001c85e446c906a.tar.bz2 |
Moved version parsing to new system
-rw-r--r-- | plop.c | 2 | ||||
-rw-r--r-- | request.c | 13 | ||||
-rw-r--r-- | request.h | 1 |
3 files changed, 8 insertions, 8 deletions
@@ -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); @@ -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. @@ -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; |