]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-h2: Forward clients scheme to servers checking start-line flags
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 14 Jun 2019 08:46:51 +0000 (10:46 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 14 Jun 2019 09:13:32 +0000 (11:13 +0200)
By default, the scheme "https" is always used. But when an explicit scheme was
defined and when this scheme is "http", we use it in the request sent to the
server. This is done by checking flags of the start-line. If the flag
HTX_SL_F_HAS_SCHM is set, it means an explicit scheme was defined on the client
side. And if the flag HTX_SL_F_SCHM_HTTP is set, it means the scheme "http" was
used.

src/mux_h2.c

index 898425658674673fb2bab4b523ca2225f879856b..c1ee2c4e69234ff2d047a92f2543e4cbf28a9309 100644 (file)
@@ -4718,7 +4718,14 @@ static size_t h2s_htx_bck_make_req_headers(struct h2s *h2s, struct htx *htx)
         */
        if (sl->info.req.meth != HTTP_METH_CONNECT) {
                /* encode the scheme which is always "https" (or 0x86 for "http") */
-               if (!hpack_encode_scheme(&outbuf, ist("https"))) {
+               struct ist scheme;
+
+               if ((sl->flags & (HTX_SL_F_HAS_SCHM|HTX_SL_F_SCHM_HTTP)) == (HTX_SL_F_HAS_SCHM|HTX_SL_F_SCHM_HTTP))
+                       scheme = ist("http");
+               else
+                       scheme = ist("https");
+
+               if (!hpack_encode_scheme(&outbuf, scheme)) {
                        /* output full */
                        if (b_space_wraps(mbuf))
                                goto realign_again;