mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 23:56:57 +02:00
CLEANUP: http: make it more obvious that msg->som is always null outside of chunks
Since the recent buffer reorg, msg->som is redundant with buf->p but still appears at a number of places. This tiny patch allows to confirm that som follows two states : - 0 from the moment the message starts to be parsed - relative offset to ->p for start of chunk when parsing chunks During this second state, ->sol is never used, so we should probably merge the two.
This commit is contained in:
parent
09d1e254c9
commit
06a000f56e
@ -260,8 +260,8 @@ struct server *get_server_ph_post(struct session *s)
|
|||||||
const char *params = b_ptr(req, (int)(msg->sov - req->o));
|
const char *params = b_ptr(req, (int)(msg->sov - req->o));
|
||||||
const char *p = params;
|
const char *p = params;
|
||||||
|
|
||||||
if (len > buffer_len(req) - (msg->sov - msg->som))
|
if (len > buffer_len(req) - msg->sov)
|
||||||
len = buffer_len(req) - (msg->sov - msg->som);
|
len = buffer_len(req) - msg->sov;
|
||||||
|
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1303,15 +1303,13 @@ void http_msg_analyzer(struct http_msg *msg, struct hdr_idx *idx)
|
|||||||
* first if we need to remove some CRLF. We can only
|
* first if we need to remove some CRLF. We can only
|
||||||
* do this when o=0.
|
* do this when o=0.
|
||||||
*/
|
*/
|
||||||
char *beg = buf->p;
|
if (unlikely(ptr != buf->p)) {
|
||||||
|
|
||||||
if (unlikely(ptr != beg)) {
|
|
||||||
if (buf->o)
|
if (buf->o)
|
||||||
goto http_msg_ood;
|
goto http_msg_ood;
|
||||||
/* Remove empty leading lines, as recommended by RFC2616. */
|
/* Remove empty leading lines, as recommended by RFC2616. */
|
||||||
bi_fast_delete(buf, ptr - beg);
|
bi_fast_delete(buf, ptr - buf->p);
|
||||||
}
|
}
|
||||||
msg->sol = msg->som = ptr - buf->p;
|
msg->sol = msg->som = 0;
|
||||||
hdr_idx_init(idx);
|
hdr_idx_init(idx);
|
||||||
state = HTTP_MSG_RPVER;
|
state = HTTP_MSG_RPVER;
|
||||||
goto http_msg_rpver;
|
goto http_msg_rpver;
|
||||||
@ -1370,15 +1368,13 @@ void http_msg_analyzer(struct http_msg *msg, struct hdr_idx *idx)
|
|||||||
* first if we need to remove some CRLF. We can only
|
* first if we need to remove some CRLF. We can only
|
||||||
* do this when o=0.
|
* do this when o=0.
|
||||||
*/
|
*/
|
||||||
char *beg = buf->p;
|
if (likely(ptr != buf->p)) {
|
||||||
|
|
||||||
if (likely(ptr != beg)) {
|
|
||||||
if (buf->o)
|
if (buf->o)
|
||||||
goto http_msg_ood;
|
goto http_msg_ood;
|
||||||
/* Remove empty leading lines, as recommended by RFC2616. */
|
/* Remove empty leading lines, as recommended by RFC2616. */
|
||||||
bi_fast_delete(buf, ptr - beg);
|
bi_fast_delete(buf, ptr - buf->p);
|
||||||
}
|
}
|
||||||
msg->sol = msg->som = ptr - buf->p;
|
msg->sol = msg->som = 0;
|
||||||
/* we will need this when keep-alive will be supported
|
/* we will need this when keep-alive will be supported
|
||||||
hdr_idx_init(idx);
|
hdr_idx_init(idx);
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user