[6.0] 002a27a6b Apply the 3 least significant digit rule of status code on H/2

Reza Naghibi reza at naghibi.com
Wed May 20 13:55:07 UTC 2020


commit 002a27a6bd7a0934af14e5cbab530050ed4a4f6a
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Fri Apr 24 16:24:54 2020 +0200

    Apply the 3 least significant digit rule of status code on H/2
    
    In VCL we allow status codes larger then 999, and do modulo 1000 when
    sending it to the client. But the code to apply the modulo was missing in
    H/2.
    
    This issue was uncovered and reported by @Francois-v3.
    
    Fixes first case of: #3301
    
    Conflicts:
        bin/varnishd/http2/cache_http2_deliver.c

diff --git a/bin/varnishd/http2/cache_http2_deliver.c b/bin/varnishd/http2/cache_http2_deliver.c
index 94018edd7..ee255067e 100644
--- a/bin/varnishd/http2/cache_http2_deliver.c
+++ b/bin/varnishd/http2/cache_http2_deliver.c
@@ -238,7 +238,7 @@ h2_build_headers(struct vsb *resp, struct req *req)
 
 	AN(VSB_new(resp, req->ws->f, l, VSB_FIXEDLEN));
 
-	l = h2_status(buf, req->resp->status);
+	l = h2_status(buf, req->resp->status % 1000);
 	VSB_bcat(resp, buf, l);
 
 	hp = req->resp;


More information about the varnish-commit mailing list