]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: h2: Set flags about the request's scheme on the start-line
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 14 Jun 2019 08:25:47 +0000 (10:25 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 14 Jun 2019 09:13:32 +0000 (11:13 +0200)
The flag HTX_SL_F_HAS_SCHM is always set because H2 requests have always an
explicit scheme. Then, the pseudo-header ":scheme" is tested. If it is set to
"http", the flag HTX_SL_F_SCHM_HTTP is set. Otherwise, for all other cases, the
flag HTX_SL_F_SCHM_HTTPS is set. For now, it seems reasonable to have a fallback
on the scheme "https".

src/h2.c

index 84b8dbe779a927d857336794f36b8d1c5a6bfdfe..9681aca53205b667f8b7d1ddfb0e47eca1b222d9 100644 (file)
--- a/src/h2.c
+++ b/src/h2.c
@@ -555,6 +555,8 @@ static struct htx_sl *h2_prepare_htx_reqline(uint32_t fields, struct ist *phdr,
                goto fail;
 
        sl->info.req.meth = find_http_meth(phdr[H2_PHDR_IDX_METH].ptr, phdr[H2_PHDR_IDX_METH].len);
+       sl->flags |= HTX_SL_F_HAS_SCHM;
+       sl->flags |= (isteqi(phdr[H2_PHDR_IDX_SCHM], ist("http")) ? HTX_SL_F_SCHM_HTTP : HTX_SL_F_SCHM_HTTPS);
        return sl;
  fail:
        return NULL;