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.
diff --git a/src/proto_http.c b/src/proto_http.c
index 1d75b05..bd6a15a 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -1314,12 +1314,8 @@
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_DATA)
- req->analysers |= AN_REQ_HTTP_BODY;
+ if (appctx->ctx.stats.flags & STAT_ADMIN)
appctx->st0 = STAT_HTTP_POST;
- }
else {
/* POST without admin level */
appctx->ctx.stats.flags &= ~STAT_CHUNKED;
@@ -2649,6 +2645,8 @@
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);
+ http_handle_expect_hdr(s, req, msg);
+
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
if (!(s->flags & SF_FINST_MASK))
@@ -2658,6 +2656,9 @@
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_HTTP_XFER_BODY;
+
+ req->flags |= CF_SEND_DONTWAIT;
+ s->flags |= SF_ASSIGNED;
goto done;
}
diff --git a/src/proto_htx.c b/src/proto_htx.c
index 22ad491..9a06419 100644
--- a/src/proto_htx.c
+++ b/src/proto_htx.c
@@ -619,6 +619,9 @@
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);
+ 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
s->flags |= SF_ERR_LOCAL; // to mark that it comes from the proxy
if (!(s->flags & SF_FINST_MASK))
@@ -628,6 +631,9 @@
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_HTTP_XFER_BODY;
+
+ req->flags |= CF_SEND_DONTWAIT;
+ s->flags |= SF_ASSIGNED;
goto done;
}
@@ -4916,12 +4922,8 @@
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)
- req->analysers |= AN_REQ_HTTP_BODY;
+ if (appctx->ctx.stats.flags & STAT_ADMIN)
appctx->st0 = STAT_HTTP_POST;
- }
else {
/* POST without admin level */
appctx->ctx.stats.flags &= ~STAT_CHUNKED;