diff --git a/include/proto/proto_http.h b/include/proto/proto_http.h index 8620bf45b..d70603c83 100644 --- a/include/proto/proto_http.h +++ b/include/proto/proto_http.h @@ -61,10 +61,10 @@ int event_accept(int fd); int process_cli(struct session *t); int process_srv_data(struct session *t); int process_srv_conn(struct session *t); -int http_wait_for_request(struct session *s, struct buffer *req); -int http_process_request(struct session *t, struct buffer *req); -int http_process_tarpit(struct session *s, struct buffer *req); -int http_process_request_body(struct session *s, struct buffer *req); +int http_wait_for_request(struct session *s, struct buffer *req, int an_bit); +int http_process_request(struct session *t, struct buffer *req, int an_bit); +int http_process_tarpit(struct session *s, struct buffer *req, int an_bit); +int http_process_request_body(struct session *s, struct buffer *req, int an_bit); int process_response(struct session *t); void produce_content(struct session *s, struct buffer *rep); diff --git a/include/proto/proto_tcp.h b/include/proto/proto_tcp.h index 109bc09ac..61ec0bd0b 100644 --- a/include/proto/proto_tcp.h +++ b/include/proto/proto_tcp.h @@ -32,7 +32,7 @@ int tcpv4_bind_socket(int fd, int flags, struct sockaddr_in *local, struct socka void tcpv4_add_listener(struct listener *listener); void tcpv6_add_listener(struct listener *listener); int tcp_bind_listener(struct listener *listener, char *errmsg, int errlen); -int tcp_inspect_request(struct session *s, struct buffer *req); +int tcp_inspect_request(struct session *s, struct buffer *req, int an_bit); #endif /* _PROTO_PROTO_TCP_H */ diff --git a/src/proto_http.c b/src/proto_http.c index 7d43770ff..33e94664c 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -1509,7 +1509,7 @@ void http_msg_analyzer(struct buffer *buf, struct http_msg *msg, struct hdr_idx * when it has nothing left to do, and may remove any analyser when it wants to * abort. */ -int http_wait_for_request(struct session *s, struct buffer *req) +int http_wait_for_request(struct session *s, struct buffer *req, int an_bit) { /* * We will parse the partial (or complete) lines. @@ -1780,7 +1780,7 @@ int http_wait_for_request(struct session *s, struct buffer *req) txn->req.cap, s->fe->req_cap); /* end of job, return OK */ - req->analysers &= ~AN_REQ_WAIT_HTTP; + req->analysers &= ~an_bit; req->analyse_exp = TICK_ETERNITY; return 1; @@ -1814,14 +1814,14 @@ int http_wait_for_request(struct session *s, struct buffer *req) * needs more data, encounters an error, or wants to immediately abort the * request. It relies on buffers flags, and updates s->req->analysers. */ -int http_process_request(struct session *s, struct buffer *req) +int http_process_request(struct session *s, struct buffer *req, int an_bit) { int cur_idx; struct http_txn *txn = &s->txn; struct http_msg *msg = &txn->req; struct proxy *cur_proxy; - req->analysers &= ~AN_REQ_HTTP_HDR; + req->analysers &= ~an_bit; req->analyse_exp = TICK_ETERNITY; DPRINTF(stderr,"[%u] %s: session=%p b=%p, exp(r,w)=%u,%u bf=%08x bl=%d analysers=%02x\n", @@ -2448,7 +2448,7 @@ int http_process_request(struct session *s, struct buffer *req) * returns zero, at the beginning because it prevents any other processing * from occurring, and at the end because it terminates the request. */ -int http_process_tarpit(struct session *s, struct buffer *req) +int http_process_tarpit(struct session *s, struct buffer *req, int an_bit) { struct http_txn *txn = &s->txn; @@ -2490,7 +2490,7 @@ int http_process_tarpit(struct session *s, struct buffer *req) * because it expects the request to be parsed. It returns zero if it needs to * read more data, or 1 once it has completed its analysis. */ -int http_process_request_body(struct session *s, struct buffer *req) +int http_process_request_body(struct session *s, struct buffer *req, int an_bit) { struct http_msg *msg = &s->txn.req; unsigned long body = msg->sol[msg->eoh] == '\r' ? msg->eoh + 2 : msg->eoh + 1; @@ -2551,7 +2551,7 @@ int http_process_request_body(struct session *s, struct buffer *req) tick_is_expired(req->analyse_exp, now_ms)) { /* The situation will not evolve, so let's give up on the analysis. */ s->logs.tv_request = now; /* update the request timer to reflect full request */ - req->analysers &= ~AN_REQ_HTTP_BODY; + req->analysers &= ~an_bit; req->analyse_exp = TICK_ETERNITY; return 1; } diff --git a/src/proto_tcp.c b/src/proto_tcp.c index 4a841866f..59f76c4a6 100644 --- a/src/proto_tcp.c +++ b/src/proto_tcp.c @@ -373,7 +373,7 @@ void tcpv6_add_listener(struct listener *listener) * called after XXX bytes have been received (or transfered), and the min of * all's wishes will be used to ring back (unless a special condition occurs). */ -int tcp_inspect_request(struct session *s, struct buffer *req) +int tcp_inspect_request(struct session *s, struct buffer *req, int an_bit) { struct tcp_rule *rule; int partial; @@ -441,7 +441,7 @@ int tcp_inspect_request(struct session *s, struct buffer *req) /* if we get there, it means we have no rule which matches, or * we have an explicit accept, so we apply the default accept. */ - req->analysers &= ~AN_REQ_INSPECT; + req->analysers &= ~an_bit; req->analyse_exp = TICK_ETERNITY; return 1; } diff --git a/src/proto_uxst.c b/src/proto_uxst.c index 8af3d5a63..a450217f3 100644 --- a/src/proto_uxst.c +++ b/src/proto_uxst.c @@ -640,7 +640,7 @@ int unix_sock_parse_request(struct session *s, char *line) * STATS_ST_CLOSE. It removes the AN_REQ_UNIX_STATS bit from req->analysers * once done. It always returns 0. */ -int uxst_req_analyser_stats(struct session *s, struct buffer *req) +int uxst_req_analyser_stats(struct session *s, struct buffer *req, int an_bit) { char *line, *p; @@ -694,7 +694,7 @@ int uxst_req_analyser_stats(struct session *s, struct buffer *req) case STATS_ST_CLOSE: /* end of dump */ - s->req->analysers &= ~AN_REQ_UNIX_STATS; + s->req->analysers &= ~an_bit; s->ana_state = 0; break; } @@ -793,7 +793,7 @@ struct task *uxst_process_session(struct task *t) */ while (s->req->analysers) { if (s->req->analysers & AN_REQ_UNIX_STATS) - if (!uxst_req_analyser_stats(s, s->req)) + if (!uxst_req_analyser_stats(s, s->req, AN_REQ_UNIX_STATS)) break; /* Just make sure that nobody set a wrong flag causing an endless loop */ diff --git a/src/session.c b/src/session.c index 0f82639b8..1d223d080 100644 --- a/src/session.c +++ b/src/session.c @@ -726,31 +726,31 @@ resync_stream_interface: if (s->req->analysers & AN_REQ_INSPECT) { last_ana |= AN_REQ_INSPECT; - if (!tcp_inspect_request(s, s->req)) + if (!tcp_inspect_request(s, s->req, AN_REQ_INSPECT)) break; } if (s->req->analysers & AN_REQ_WAIT_HTTP) { last_ana |= AN_REQ_WAIT_HTTP; - if (!http_wait_for_request(s, s->req)) + if (!http_wait_for_request(s, s->req, AN_REQ_WAIT_HTTP)) break; } if (s->req->analysers & AN_REQ_HTTP_HDR) { last_ana |= AN_REQ_HTTP_HDR; - if (!http_process_request(s, s->req)) + if (!http_process_request(s, s->req, AN_REQ_HTTP_HDR)) break; } if (s->req->analysers & AN_REQ_HTTP_TARPIT) { last_ana |= AN_REQ_HTTP_TARPIT; - if (!http_process_tarpit(s, s->req)) + if (!http_process_tarpit(s, s->req, AN_REQ_HTTP_TARPIT)) break; } if (s->req->analysers & AN_REQ_HTTP_BODY) { last_ana |= AN_REQ_HTTP_BODY; - if (!http_process_request_body(s, s->req)) + if (!http_process_request_body(s, s->req, AN_REQ_HTTP_BODY)) break; } }