mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 05:41:26 +02:00
MINOR: stats/cache: Handle the header Expect when applets are registered
First of all, it is a way to handle 100-Continue for the cache without duplicating code. Then, for the stats, it is no longer necessary to wait for the request body.
This commit is contained in:
parent
4a28a536a3
commit
bcf242a1d5
@ -1314,12 +1314,8 @@ int http_handle_stats(struct stream *s, struct channel *req)
|
|||||||
if (txn->meth == HTTP_METH_GET || txn->meth == HTTP_METH_HEAD)
|
if (txn->meth == HTTP_METH_GET || txn->meth == HTTP_METH_HEAD)
|
||||||
appctx->st0 = STAT_HTTP_HEAD;
|
appctx->st0 = STAT_HTTP_HEAD;
|
||||||
else if (txn->meth == HTTP_METH_POST && (msg->flags & HTTP_MSGF_CNT_LEN)) {
|
else if (txn->meth == HTTP_METH_POST && (msg->flags & HTTP_MSGF_CNT_LEN)) {
|
||||||
if (appctx->ctx.stats.flags & STAT_ADMIN) {
|
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)
|
|
||||||
req->analysers |= AN_REQ_HTTP_BODY;
|
|
||||||
appctx->st0 = STAT_HTTP_POST;
|
appctx->st0 = STAT_HTTP_POST;
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
/* POST without admin level */
|
/* POST without admin level */
|
||||||
appctx->ctx.stats.flags &= ~STAT_CHUNKED;
|
appctx->ctx.stats.flags &= ~STAT_CHUNKED;
|
||||||
@ -2649,6 +2645,8 @@ int http_process_req_common(struct stream *s, struct channel *req, int an_bit, s
|
|||||||
if (sess->fe == s->be) /* report it if the request was intercepted by the frontend */
|
if (sess->fe == s->be) /* report it if the request was intercepted by the frontend */
|
||||||
_HA_ATOMIC_ADD(&sess->fe->fe_counters.intercepted_req, 1);
|
_HA_ATOMIC_ADD(&sess->fe->fe_counters.intercepted_req, 1);
|
||||||
|
|
||||||
|
http_handle_expect_hdr(s, req, msg);
|
||||||
|
|
||||||
if (!(s->flags & SF_ERR_MASK)) // this is not really an error but it is
|
if (!(s->flags & SF_ERR_MASK)) // this is not really an error but it is
|
||||||
s->flags |= SF_ERR_LOCAL; // to mark that it comes from the proxy
|
s->flags |= SF_ERR_LOCAL; // to mark that it comes from the proxy
|
||||||
if (!(s->flags & SF_FINST_MASK))
|
if (!(s->flags & SF_FINST_MASK))
|
||||||
@ -2658,6 +2656,9 @@ int http_process_req_common(struct stream *s, struct channel *req, int an_bit, s
|
|||||||
req->analysers &= (AN_REQ_HTTP_BODY | AN_REQ_FLT_HTTP_HDRS | AN_REQ_FLT_END);
|
req->analysers &= (AN_REQ_HTTP_BODY | AN_REQ_FLT_HTTP_HDRS | AN_REQ_FLT_END);
|
||||||
req->analysers &= ~AN_REQ_FLT_XFER_DATA;
|
req->analysers &= ~AN_REQ_FLT_XFER_DATA;
|
||||||
req->analysers |= AN_REQ_HTTP_XFER_BODY;
|
req->analysers |= AN_REQ_HTTP_XFER_BODY;
|
||||||
|
|
||||||
|
req->flags |= CF_SEND_DONTWAIT;
|
||||||
|
s->flags |= SF_ASSIGNED;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -619,6 +619,9 @@ int htx_process_req_common(struct stream *s, struct channel *req, int an_bit, st
|
|||||||
if (sess->fe == s->be) /* report it if the request was intercepted by the frontend */
|
if (sess->fe == s->be) /* report it if the request was intercepted by the frontend */
|
||||||
_HA_ATOMIC_ADD(&sess->fe->fe_counters.intercepted_req, 1);
|
_HA_ATOMIC_ADD(&sess->fe->fe_counters.intercepted_req, 1);
|
||||||
|
|
||||||
|
if (htx_handle_expect_hdr(s, htx, msg) == -1)
|
||||||
|
goto return_bad_req;
|
||||||
|
|
||||||
if (!(s->flags & SF_ERR_MASK)) // this is not really an error but it is
|
if (!(s->flags & SF_ERR_MASK)) // this is not really an error but it is
|
||||||
s->flags |= SF_ERR_LOCAL; // to mark that it comes from the proxy
|
s->flags |= SF_ERR_LOCAL; // to mark that it comes from the proxy
|
||||||
if (!(s->flags & SF_FINST_MASK))
|
if (!(s->flags & SF_FINST_MASK))
|
||||||
@ -628,6 +631,9 @@ int htx_process_req_common(struct stream *s, struct channel *req, int an_bit, st
|
|||||||
req->analysers &= (AN_REQ_HTTP_BODY | AN_REQ_FLT_HTTP_HDRS | AN_REQ_FLT_END);
|
req->analysers &= (AN_REQ_HTTP_BODY | AN_REQ_FLT_HTTP_HDRS | AN_REQ_FLT_END);
|
||||||
req->analysers &= ~AN_REQ_FLT_XFER_DATA;
|
req->analysers &= ~AN_REQ_FLT_XFER_DATA;
|
||||||
req->analysers |= AN_REQ_HTTP_XFER_BODY;
|
req->analysers |= AN_REQ_HTTP_XFER_BODY;
|
||||||
|
|
||||||
|
req->flags |= CF_SEND_DONTWAIT;
|
||||||
|
s->flags |= SF_ASSIGNED;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4916,12 +4922,8 @@ static int htx_handle_stats(struct stream *s, struct channel *req)
|
|||||||
if (txn->meth == HTTP_METH_GET || txn->meth == HTTP_METH_HEAD)
|
if (txn->meth == HTTP_METH_GET || txn->meth == HTTP_METH_HEAD)
|
||||||
appctx->st0 = STAT_HTTP_HEAD;
|
appctx->st0 = STAT_HTTP_HEAD;
|
||||||
else if (txn->meth == HTTP_METH_POST) {
|
else if (txn->meth == HTTP_METH_POST) {
|
||||||
if (appctx->ctx.stats.flags & STAT_ADMIN) {
|
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)
|
|
||||||
req->analysers |= AN_REQ_HTTP_BODY;
|
|
||||||
appctx->st0 = STAT_HTTP_POST;
|
appctx->st0 = STAT_HTTP_POST;
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
/* POST without admin level */
|
/* POST without admin level */
|
||||||
appctx->ctx.stats.flags &= ~STAT_CHUNKED;
|
appctx->ctx.stats.flags &= ~STAT_CHUNKED;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user