}
}
- /* Was the status page requested with a POST ? */
- if (unlikely(txn->meth == HTTP_METH_POST && txn->req.body_len > 0)) {
+ if (txn->meth == HTTP_METH_GET || txn->meth == HTTP_METH_HEAD)
+ appctx->st0 = STAT_HTTP_HEAD;
+ else if (txn->meth == HTTP_METH_POST && (msg->flags & HTTP_MSGF_CNT_LEN)) {
if (appctx->ctx.stats.flags & STAT_ADMIN) {
/* we'll need the request body, possibly after sending 100-continue */
- if (msg->msg_state < HTTP_MSG_CHUNK_SIZE)
+ if (msg->msg_state < HTTP_MSG_DATA)
req->analysers |= AN_REQ_HTTP_BODY;
appctx->st0 = STAT_HTTP_POST;
}
else {
+ /* POST without admin level */
+ appctx->ctx.stats.flags &= ~STAT_CHUNKED;
appctx->ctx.stats.st_code = STAT_STATUS_DENY;
appctx->st0 = STAT_HTTP_LAST;
}
}
else {
- /* So it was another method (GET/HEAD) */
- appctx->st0 = STAT_HTTP_HEAD;
+ /* Unsupported method or chunked POST */
+ appctx->ctx.stats.flags &= ~STAT_CHUNKED;
+ appctx->ctx.stats.st_code = STAT_STATUS_IVAL;
+ appctx->st0 = STAT_HTTP_LAST;
}
s->task->nice = -32; /* small boost for HTTP statistics */
}
}
- /* Was the status page requested with a POST ? */
- if (unlikely(txn->meth == HTTP_METH_POST)) {
+ if (txn->meth == HTTP_METH_GET || txn->meth == HTTP_METH_HEAD)
+ appctx->st0 = STAT_HTTP_HEAD;
+ else if (txn->meth == HTTP_METH_POST) {
if (appctx->ctx.stats.flags & STAT_ADMIN) {
/* we'll need the request body, possibly after sending 100-continue */
if (msg->msg_state < HTTP_MSG_DATA)
appctx->st0 = STAT_HTTP_POST;
}
else {
+ /* POST without admin level */
appctx->ctx.stats.flags &= ~STAT_CHUNKED;
appctx->ctx.stats.st_code = STAT_STATUS_DENY;
appctx->st0 = STAT_HTTP_LAST;
}
}
else {
- /* So it was another method (GET/HEAD) */
- appctx->st0 = STAT_HTTP_HEAD;
+ /* Unsupported method */
+ appctx->ctx.stats.flags &= ~STAT_CHUNKED;
+ appctx->ctx.stats.st_code = STAT_STATUS_IVAL;
+ appctx->st0 = STAT_HTTP_LAST;
}
s->task->nice = -32; /* small boost for HTTP statistics */