From: Willy Tarreau Date: Sun, 27 Dec 2009 21:47:25 +0000 (+0100) Subject: [BUG] http: body parsing must consider the start of message X-Git-Tag: v1.4-dev5~40 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7c96f678fa822d7f7dfc1fc053396c1dff547b11;p=thirdparty%2Fhaproxy.git [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 6a2670a67f..8ce981ce09 100644 --- a/src/backend.c +++ b/src/backend.c @@ -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; diff --git a/src/proto_http.c b/src/proto_http.c index 3a93360d70..bcb02129e9 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -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: