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 2a6e401..638d203 100644
--- a/src/mux_h1.c
+++ b/src/mux_h1.c
@@ -1078,6 +1078,14 @@
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) {