summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faulet <cfaulet@haproxy.com>2021-01-21 17:32:58 +0100
committerChristopher Faulet <cfaulet@haproxy.com>2021-01-26 15:00:18 +0100
commitff4dc825fe7528ae0387509626eb0e7b414badb4 (patch)
tree48cd5e235f4c433ea91cba169ca163f864619a28
parent37269e9a00e1fb5417e2148c7a39e06c3f61d4e7 (diff)
downloadhaproxy-ff4dc825fe7528ae0387509626eb0e7b414badb4.tar.gz
MEDIUM: http-ana: Do nothing in wait-for-request analyzer if not htx
If http_wait_for_request() analyzer is called with a non-htx stream, nothing is performed and we return immediatly. For now, it is totally unexpected. But it will be true during TCP to H1 upgrades, once fixed. Indeed, there will be a transition period during these upgrades. First the mux will be upgraded and the not the stream, and finally the stream will be upgraded by the mux once ready. In the meantime, the stream will still be in raw mode. Nothing will be performed in wait-for-request analyzer because it will be the mux responsibility to handle errors. This patch is required to fix the TCP to H1 upgrades.
-rw-r--r--src/http_ana.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/http_ana.c b/src/http_ana.c
index dd6ac4167..7816ad563 100644
--- a/src/http_ana.c
+++ b/src/http_ana.c
@@ -92,9 +92,20 @@ int http_wait_for_request(struct stream *s, struct channel *req, int an_bit)
DBG_TRACE_ENTER(STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA, s, txn, msg);
- htx = htxbuf(&req->buf);
+ if (unlikely(!IS_HTX_STRM(s))) {
+ /* It is only possible when a TCP stream is upgrade to HTTP.
+ * There is a transition period during which there is no
+ * data. The stream is still in raw mode and SF_IGNORE flag is
+ * still set. When this happens, the new mux is responsible to
+ * handle all errors. Thus we may leave immediatly.
+ */
+ BUG_ON(!(s->flags & SF_IGNORE) || !c_empty(&s->req));
+
+ DBG_TRACE_LEAVE(STRM_EV_STRM_ANA, s);
+ return 0;
+ }
- BUG_ON(htx_is_empty(htx) || htx->first == -1);
+ htx = htxbuf(&req->buf);
/* Parsing errors are caught here */
if (htx->flags & (HTX_FL_PARSING_ERROR|HTX_FL_PROCESSING_ERROR)) {