From: Willy Tarreau Date: Fri, 9 Mar 2012 13:46:19 +0000 (+0100) Subject: MINOR: http: remove useless wrapping checks in http_msg_analyzer X-Git-Tag: v1.5-dev9~75 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8b1323e4cb2c0a53c0d53fc3cded511ffec4146e;p=thirdparty%2Fhaproxy.git MINOR: http: remove useless wrapping checks in http_msg_analyzer The message cannot wrap here. --- diff --git a/src/proto_http.c b/src/proto_http.c index 1b2bfbde32..f81e71e3d9 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -1266,9 +1266,11 @@ get_http_auth(struct session *s) /* * This function parses an HTTP message, either a request or a response, - * depending on the initial msg->msg_state. It can be preempted everywhere - * when data are missing and recalled at the exact same location with no - * information loss. The header index is re-initialized when switching from + * depending on the initial msg->msg_state. The caller is responsible for + * ensuring that the message does not wrap. The function can be preempted + * everywhere when data are missing and recalled at the exact same location + * with no information loss. The message may even be realigned between two + * calls. The header index is re-initialized when switching from * MSG_R[PQ]BEFORE to MSG_RPVER|MSG_RQMETH. It modifies msg->sol among other * fields. Note that msg->som and msg->sol will be initialized after completing * the first state, so that none of the msg pointers has to be initialized @@ -1281,8 +1283,8 @@ void http_msg_analyzer(struct http_msg *msg, struct hdr_idx *idx) struct buffer *buf = msg->buf; state = msg->msg_state; - ptr = buffer_wrap_add(buf, buf->p + msg->next); - end = buffer_wrap_add(buf, buf->p + buf->i); + ptr = buf->p + msg->next; + end = buf->p + buf->i; if (unlikely(ptr >= end)) goto http_msg_ood;