]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: http/applets: Handle all applets intercepting HTTP requests the same way
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 1 Mar 2019 10:44:26 +0000 (11:44 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 19 Mar 2019 08:54:20 +0000 (09:54 +0100)
In addition to stats and cache applets, there are also HTTP applet services
declared in an http-request rule. All these applets are now handled the same
way. Among other things, the header Expect is handled at the same place for all
these applets.

src/proto_http.c
src/proto_htx.c
src/stream.c

index bd6a15a8815664724feaf610f53d58cdeed3c0ac..6373966977b42aad4bf5b93e2d48d4232fd2ea27 100644 (file)
@@ -2639,8 +2639,7 @@ int http_process_req_common(struct stream *s, struct channel *req, int an_bit, s
 
 
        /* Proceed with the stats now. */
-       if (unlikely(objt_applet(s->target) == &http_stats_applet) ||
-           unlikely(objt_applet(s->target) == &http_cache_applet)) {
+       if (unlikely(objt_applet(s->target))) {
                /* process the stats request now */
                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);
index 9a06419b1b8ff49b47d4539efb358fccdcb24ed5..9e0a135641957ab6510cb19015cbedd303b3c371 100644 (file)
@@ -612,10 +612,8 @@ int htx_process_req_common(struct stream *s, struct channel *req, int an_bit, st
                        goto return_bad_req;
        }
 
-       /* Proceed with the stats now. */
-       if (unlikely(objt_applet(s->target) == &http_stats_applet) ||
-           unlikely(objt_applet(s->target) == &http_cache_applet)) {
-               /* process the stats request now */
+       /* Proceed with the applets now. */
+       if (unlikely(objt_applet(s->target))) {
                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);
 
index af3e1177fc8b11a1054fbdd91514520775a95708..d4cda4bc82841e30c37815aa5925ca3f7d4a44e6 100644 (file)
@@ -1207,15 +1207,6 @@ enum act_return process_use_service(struct act_rule *rule, struct proxy *px,
                appctx = si_appctx(&s->si[1]);
                memset(&appctx->ctx, 0, sizeof(appctx->ctx));
                appctx->rule = rule;
-
-               /* enable the minimally required analyzers in case of HTTP
-                * keep-alive to properly handle keep-alive and compression
-                * on the HTTP response.
-                */
-               if (rule->from == ACT_F_HTTP_REQ) {
-                       s->req.analysers &= AN_REQ_FLT_HTTP_HDRS | AN_REQ_FLT_END;
-                       s->req.analysers |= AN_REQ_HTTP_XFER_BODY;
-               }
        }
        else
                appctx = si_appctx(&s->si[1]);
@@ -1233,16 +1224,17 @@ enum act_return process_use_service(struct act_rule *rule, struct proxy *px,
                default: return ACT_RET_YIELD;
        }
 
+       if (rule->from != ACT_F_HTTP_REQ) {
+               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);
+
+               /* The flag SF_ASSIGNED prevent from server assignment. */
+               s->flags |= SF_ASSIGNED;
+       }
+
        /* Now we can schedule the applet. */
        si_cant_get(&s->si[1]);
        appctx_wakeup(appctx);
-
-       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);
-
-       /* The flag SF_ASSIGNED prevent from server assignment. */
-       s->flags |= SF_ASSIGNED;
-
        return ACT_RET_STOP;
 }