/*
* HTTP protocol analyzer
*
- * Copyright 2000-2008 Willy Tarreau <w@1wt.eu>
+ * Copyright 2000-2009 Willy Tarreau <w@1wt.eu>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
/* 1: we might have to print this header in debug mode */
if (unlikely((global.mode & MODE_DEBUG) &&
(!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)) &&
- (msg->msg_state == HTTP_MSG_BODY || msg->msg_state == HTTP_MSG_ERROR))) {
+ (msg->msg_state >= HTTP_MSG_BODY || msg->msg_state == HTTP_MSG_ERROR))) {
char *eol, *sol;
sol = req->data + msg->som;
* Now we quickly check if we have found a full valid request.
* If not so, we check the FD and buffer states before leaving.
* A full request is indicated by the fact that we have seen
- * the double LF/CRLF, so the state is HTTP_MSG_BODY. Invalid
+ * the double LF/CRLF, so the state is >= HTTP_MSG_BODY. Invalid
* requests are checked first.
*
*/
- if (unlikely(msg->msg_state != HTTP_MSG_BODY)) {
+ if (unlikely(msg->msg_state < HTTP_MSG_BODY)) {
/*
* First, let's catch bad requests.
*/
struct redirect_rule *rule;
int cur_idx;
- if (unlikely(msg->msg_state != HTTP_MSG_BODY)) {
+ if (unlikely(msg->msg_state < HTTP_MSG_BODY)) {
/* we need more data */
buffer_dont_connect(req);
return 0;
struct http_txn *txn = &s->txn;
struct http_msg *msg = &txn->req;
- if (unlikely(msg->msg_state != HTTP_MSG_BODY)) {
+ if (unlikely(msg->msg_state < HTTP_MSG_BODY)) {
/* we need more data */
buffer_dont_connect(req);
return 0;
unsigned long body = msg->sol[msg->eoh] == '\r' ? msg->eoh + 2 : msg->eoh + 1;
long long limit = s->be->url_param_post_limit;
- if (unlikely(msg->msg_state != HTTP_MSG_BODY)) {
+ if (unlikely(msg->msg_state < HTTP_MSG_BODY)) {
/* we need more data */
buffer_dont_connect(req);
return 0;
/* 1: we might have to print this header in debug mode */
if (unlikely((global.mode & MODE_DEBUG) &&
(!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)) &&
- (msg->msg_state == HTTP_MSG_BODY || msg->msg_state == HTTP_MSG_ERROR))) {
+ (msg->msg_state >= HTTP_MSG_BODY || msg->msg_state == HTTP_MSG_ERROR))) {
char *eol, *sol;
sol = rep->data + msg->som;
* Now we quickly check if we have found a full valid response.
* If not so, we check the FD and buffer states before leaving.
* A full response is indicated by the fact that we have seen
- * the double LF/CRLF, so the state is HTTP_MSG_BODY. Invalid
+ * the double LF/CRLF, so the state is >= HTTP_MSG_BODY. Invalid
* responses are checked first.
*
* Depending on whether the client is still there or not, we
* errors somewhere else.
*/
- if (unlikely(msg->msg_state != HTTP_MSG_BODY)) {
+ if (unlikely(msg->msg_state < HTTP_MSG_BODY)) {
/* Invalid response */
if (unlikely(msg->msg_state == HTTP_MSG_ERROR)) {
/* we detected a parsing error. We want to archive this response
rep->l,
rep->analysers);
- if (unlikely(msg->msg_state != HTTP_MSG_BODY)) /* we need more data */
+ if (unlikely(msg->msg_state < HTTP_MSG_BODY)) /* we need more data */
return 0;
rep->analysers &= ~an_bit;
if (!txn)
return 0;
- if (txn->req.msg_state != HTTP_MSG_BODY)
+ if (txn->req.msg_state < HTTP_MSG_BODY)
return 0;
meth = txn->meth;
if (!txn)
return 0;
- if (txn->req.msg_state != HTTP_MSG_BODY)
+ if (txn->req.msg_state < HTTP_MSG_BODY)
return 0;
len = txn->req.sl.rq.v_l;
if (!txn)
return 0;
- if (txn->rsp.msg_state != HTTP_MSG_BODY)
+ if (txn->rsp.msg_state < HTTP_MSG_BODY)
return 0;
len = txn->rsp.sl.st.v_l;
if (!txn)
return 0;
- if (txn->rsp.msg_state != HTTP_MSG_BODY)
+ if (txn->rsp.msg_state < HTTP_MSG_BODY)
return 0;
len = txn->rsp.sl.st.c_l;
if (!txn)
return 0;
- if (txn->req.msg_state != HTTP_MSG_BODY)
+ if (txn->req.msg_state < HTTP_MSG_BODY)
return 0;
if (txn->rsp.msg_state != HTTP_MSG_RPBEFORE)
if (!txn)
return 0;
- if (txn->req.msg_state != HTTP_MSG_BODY)
+ if (txn->req.msg_state < HTTP_MSG_BODY)
return 0;
if (txn->rsp.msg_state != HTTP_MSG_RPBEFORE)
if (!txn)
return 0;
- if (txn->req.msg_state != HTTP_MSG_BODY)
+ if (txn->req.msg_state < HTTP_MSG_BODY)
return 0;
if (txn->rsp.msg_state != HTTP_MSG_RPBEFORE)
if (!txn)
return 0;
- if (txn->req.msg_state != HTTP_MSG_BODY)
+ if (txn->req.msg_state < HTTP_MSG_BODY)
return 0;
if (txn->rsp.msg_state != HTTP_MSG_RPBEFORE)
if (!txn)
return 0;
- if (txn->rsp.msg_state != HTTP_MSG_BODY)
+ if (txn->rsp.msg_state < HTTP_MSG_BODY)
return 0;
return acl_fetch_hdr(px, l4, txn, txn->rsp.sol, expr, test);
if (!txn)
return 0;
- if (txn->req.msg_state != HTTP_MSG_BODY)
+ if (txn->req.msg_state < HTTP_MSG_BODY)
return 0;
if (txn->rsp.msg_state != HTTP_MSG_RPBEFORE)
if (!txn)
return 0;
- if (txn->rsp.msg_state != HTTP_MSG_BODY)
+ if (txn->rsp.msg_state < HTTP_MSG_BODY)
return 0;
return acl_fetch_hdr_cnt(px, l4, txn, txn->rsp.sol, expr, test);
if (!txn)
return 0;
- if (txn->req.msg_state != HTTP_MSG_BODY)
+ if (txn->req.msg_state < HTTP_MSG_BODY)
return 0;
if (txn->rsp.msg_state != HTTP_MSG_RPBEFORE)
if (!txn)
return 0;
- if (txn->rsp.msg_state != HTTP_MSG_BODY)
+ if (txn->rsp.msg_state < HTTP_MSG_BODY)
return 0;
return acl_fetch_hdr_val(px, l4, txn, txn->rsp.sol, expr, test);
if (!txn)
return 0;
- if (txn->req.msg_state != HTTP_MSG_BODY)
+ if (txn->req.msg_state < HTTP_MSG_BODY)
return 0;
if (txn->rsp.msg_state != HTTP_MSG_RPBEFORE)
if (!txn)
return 0;
- if (txn->rsp.msg_state != HTTP_MSG_BODY)
+ if (txn->rsp.msg_state < HTTP_MSG_BODY)
return 0;
return acl_fetch_hdr_ip(px, l4, txn, txn->rsp.sol, expr, test);
if (!txn)
return 0;
- if (txn->req.msg_state != HTTP_MSG_BODY)
+ if (txn->req.msg_state < HTTP_MSG_BODY)
return 0;
if (txn->rsp.msg_state != HTTP_MSG_RPBEFORE)
if (!s || !req)
return 0;
- if (unlikely(msg->msg_state == HTTP_MSG_BODY)) {
+ if (unlikely(msg->msg_state >= HTTP_MSG_BODY)) {
/* Already decoded as OK */
test->flags |= ACL_TEST_F_SET_RES_PASS;
return 1;
if (likely(req->lr < req->r))
http_msg_analyzer(req, msg, &txn->hdr_idx);
- if (unlikely(msg->msg_state != HTTP_MSG_BODY)) {
+ if (unlikely(msg->msg_state < HTTP_MSG_BODY)) {
if ((msg->msg_state == HTTP_MSG_ERROR) || (req->flags & BF_FULL)) {
test->flags |= ACL_TEST_F_SET_RES_FAIL;
return 1;