[6.0] ec6a1e1dd http2_proto: Introduce a custom BROKE_WINDOW error

Simon Stridsberg simon.stridsberg at varnish-software.com
Mon Mar 18 18:20:05 UTC 2024


commit ec6a1e1ddbb84004c0f0ad06344f67b954b572ac
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Thu Nov 16 16:03:42 2023 +0100

    http2_proto: Introduce a custom BROKE_WINDOW error
    
    Conflicts:
            bin/varnishd/http2/cache_http2_send.c
            include/tbl/h2_error.h

diff --git a/bin/varnishd/http2/cache_http2_proto.c b/bin/varnishd/http2/cache_http2_proto.c
index 0b1167f8c..c141d464c 100644
--- a/bin/varnishd/http2/cache_http2_proto.c
+++ b/bin/varnishd/http2/cache_http2_proto.c
@@ -1328,7 +1328,7 @@ h2_stream_tmo(struct h2_sess *h2, const struct h2_req *r2, vtim_real now)
 		VSLb(h2->vsl, SLT_Debug,
 		     "H2: stream %u: Hit idle_send_timeout waiting for"
 		     " WINDOW_UPDATE", r2->stream);
-		h2e = H2SE_CANCEL;
+		h2e = H2SE_BROKE_WINDOW;
 	}
 
 	if (h2e == NULL && r2->t_send != 0 &&
diff --git a/bin/varnishd/http2/cache_http2_send.c b/bin/varnishd/http2/cache_http2_send.c
index b78c95713..b3396a6f1 100644
--- a/bin/varnishd/http2/cache_http2_send.c
+++ b/bin/varnishd/http2/cache_http2_send.c
@@ -412,12 +412,14 @@ H2_Send(struct worker *wrk, struct h2_req *r2, h2_frame ftyp, uint8_t flags,
     uint32_t len, const void *ptr, uint64_t *counter)
 {
 	uint64_t dummy_counter;
+	h2_error h2e;
 
 	if (counter == NULL)
 		counter = &dummy_counter;
 
 	h2_send(wrk, r2, ftyp, flags, len, ptr, counter);
 
-	if (h2_errcheck(r2, r2->h2sess) == H2SE_CANCEL)
-		H2_Send_RST(wrk, r2->h2sess, r2, r2->stream, H2SE_CANCEL);
+	h2e = h2_errcheck(r2, r2->h2sess);
+	if (h2e != NULL && h2e->val == H2SE_CANCEL->val)
+		H2_Send_RST(wrk, r2->h2sess, r2, r2->stream, h2e);
 }
diff --git a/include/tbl/h2_error.h b/include/tbl/h2_error.h
index 8f3485c24..1664eb99a 100644
--- a/include/tbl/h2_error.h
+++ b/include/tbl/h2_error.h
@@ -154,6 +154,13 @@ H2_ERROR(
        /* descr */     "http/2 rapid reset detected"
 )
 
+H2_ERROR(
+	/* name */	BROKE_WINDOW,
+	/* val */	8, /* CANCEL */
+	/* types */	2,
+	/* reason */	SC_NULL,
+	/* descr */	"http/2 stream out of window credits"
+)
 #  undef H2_CUSTOM_ERRORS
 #endif
 


More information about the varnish-commit mailing list