]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] http: body parsing must consider the start of message
authorWilly Tarreau <w@1wt.eu>
Sun, 27 Dec 2009 21:47:25 +0000 (22:47 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 27 Dec 2009 21:47:25 +0000 (22:47 +0100)
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.

src/backend.c
src/proto_http.c

index 6a2670a67f32499e1f105a24fd982324c3a83e0f..8ce981ce0935660827d6d69bc055182052614c91 100644 (file)
@@ -248,8 +248,8 @@ struct server *get_server_ph_post(struct session *s)
        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;
index 3a93360d7058c7e345e54159db6c22b7f3b49ae8..bcb02129e98b812ce5c92f7f906165cfa9b49890 100644 (file)
@@ -2970,7 +2970,7 @@ int http_process_request_body(struct session *s, struct buffer *req, int an_bit)
        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: