[BUG] http: body parsing must consider the start of message
When parsing body for URL parameters, we must not consider that
data are available from buf->data but from buf->data + msg->som.
This is not a problem right now but may become with keep-alive.
diff --git a/src/backend.c b/src/backend.c
index 6a2670a..8ce981c 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -248,8 +248,8 @@
const char *params = req->data + msg->sov;
const char *p = params;
- if (len > req->l - msg->sov)
- len = req->l - msg->sov;
+ if (len > req->l - (msg->sov - msg->som))
+ len = req->l - (msg->sov - msg->som);
if (len == 0)
return NULL;
diff --git a/src/proto_http.c b/src/proto_http.c
index 3a93360..bcb0212 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -2970,7 +2970,7 @@
if (msg->hdr_content_len < limit)
limit = msg->hdr_content_len;
- if (req->l - msg->sov >= limit) /* we have enough bytes now */
+ if (req->l - (msg->sov - msg->som) >= limit) /* we have enough bytes now */
goto http_end;
missing_data: