[master] ff8d29ae5 Apply the 3 least significant digit rule of status code on H/2

Martin Blix Grydeland martin at varnish-software.com
Tue May 5 11:39:07 UTC 2020


commit ff8d29ae5a7e3eaeb30a4a7bf21efc89eed9f93a
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

diff --git a/bin/varnishd/http2/cache_http2_deliver.c b/bin/varnishd/http2/cache_http2_deliver.c
index 6996e879a..675e9bd29 100644
--- a/bin/varnishd/http2/cache_http2_deliver.c
+++ b/bin/varnishd/http2/cache_http2_deliver.c
@@ -232,7 +232,7 @@ h2_build_headers(struct vsb *resp, struct req *req)
 	uint8_t buf[6];
 	ssize_t sz, sz1;
 
-	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