summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--plop.c2
-rw-r--r--request.c15
-rw-r--r--request.h1
3 files changed, 10 insertions, 8 deletions
diff --git a/plop.c b/plop.c
index 12cef19..9748a02 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, 2, 1);
+ lua_call((*request)->lua, 3, 1);
size_t length;
const char * body = lua_tolstring((*request)->lua, -1, &length);
diff --git a/request.c b/request.c
index 6039f56..15c26f3 100644
--- a/request.c
+++ b/request.c
@@ -185,11 +185,12 @@ int parse_step_method(struct request * request)
// TODO: Consider spliting path into an actual path and arguments in this stage
int parse_step_path(struct request * request)
{
- if (0 >= request->path.start)
+ // TODO: Rethink interface of parse_step_* and read_* functions. After a break it looks like mess; it's a bad sign.
+ if (0 >= request->temp.start)
{
- request->path.start = read_until_word(request);
+ request->temp.start = read_until_word(request);
- if (0 == request->path.start)
+ if (0 == request->temp.start)
{
return 0;
}
@@ -202,10 +203,12 @@ int parse_step_path(struct request * request)
return 0;
}
- request->path.length = request->position - request->path.start;
- request->step = parse_step_version;
+ request->temp.length = request->position - request->temp.start;
- return parse_step_version(request);
+ // TODO: Use macro for pushing temporary span. Also clear the span in that macro instead of PROCEED_TO.
+ lua_pushlstring(request->lua, request->data + request->temp.start, request->temp.length);
+
+ PROCEED_TO(parse_step_version);
}
/// Parses and verifies http version field of the request.
diff --git a/request.h b/request.h
index b29bf0e..f017fa1 100644
--- a/request.h
+++ b/request.h
@@ -23,7 +23,6 @@ struct request
lua_State * lua;
int reference;
struct span temp;
- struct span path;
struct span version;
struct header * headerv;
int headerc;