From: Christopher Faulet Date: Fri, 14 Jun 2019 08:31:25 +0000 (+0200) Subject: MINOR: mux-h1: Set flags about the request's scheme on the start-line X-Git-Tag: v2.0.0~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=42993a86c9ee1cd6e921395dd446617d79b64a18;p=thirdparty%2Fhaproxy.git MINOR: mux-h1: Set flags about the request's scheme on the start-line We first try to figure out if the URI of the start-line is absolute or not. So, if it does not start by a slash ("/"), it means the URI is an absolute one and the flag HTX_SL_F_HAS_SCHM is set. Then checks are performed to know if the scheme is "http" or "https" and the corresponding flag is set, HTX_SL_F_SCHM_HTTP or HTX_SL_F_SCHM_HTTPS. Other schemes, for instance ftp, are ignored. --- diff --git a/src/mux_h1.c b/src/mux_h1.c index 2a6e401599..638d203674 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -1078,6 +1078,14 @@ static size_t h1_process_headers(struct h1s *h1s, struct h1m *h1m, struct htx *h if (!sl || !htx_add_all_headers(htx, hdrs)) goto error; sl->info.req.meth = h1s->meth; + + /* Check if the uri contains an explicit scheme and if it is + * "http" or "https". */ + if (h1sl.rq.u.len && h1sl.rq.u.ptr[0] != '/') { + sl->flags |= HTX_SL_F_HAS_SCHM; + if (h1sl.rq.u.len > 4 && (h1sl.rq.u.ptr[0] | 0x20) == 'h') + sl->flags |= ((h1sl.rq.u.ptr[4] == ':') ? HTX_SL_F_SCHM_HTTP : HTX_SL_F_SCHM_HTTPS); + } } else { if (h1_eval_htx_res_size(h1m, &h1sl, hdrs) > max) {