[master] 5fd8055 Add a xport->req_fail() for H2
Poul-Henning Kamp
phk at FreeBSD.org
Tue Mar 21 14:39:05 CET 2017
commit 5fd805510aaf960b613ead15add444786b083647
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Mar 21 13:37:46 2017 +0000
Add a xport->req_fail() for H2
Fixes: #2258
diff --git a/bin/varnishd/http1/cache_http1_fsm.c b/bin/varnishd/http1/cache_http1_fsm.c
index 4b00488..5a7c958 100644
--- a/bin/varnishd/http1/cache_http1_fsm.c
+++ b/bin/varnishd/http1/cache_http1_fsm.c
@@ -243,14 +243,14 @@ struct transport HTTP1_transport = {
.name = "HTTP/1",
.magic = TRANSPORT_MAGIC,
.deliver = V1D_Deliver,
- .unwait = http1_unwait,
+ .minimal_response = http1_minimal_response,
+ .new_session = http1_new_session,
+ .reembark = http1_reembark,
.req_body = http1_req_body,
.req_fail = http1_req_fail,
- .new_session = http1_new_session,
- .sess_panic = http1_sess_panic,
.req_panic = http1_req_panic,
- .reembark = http1_reembark,
- .minimal_response = http1_minimal_response,
+ .sess_panic = http1_sess_panic,
+ .unwait = http1_unwait,
};
/*----------------------------------------------------------------------
diff --git a/bin/varnishd/http2/cache_http2.h b/bin/varnishd/http2/cache_http2.h
index 89b85df..bd9e778 100644
--- a/bin/varnishd/http2/cache_http2.h
+++ b/bin/varnishd/http2/cache_http2.h
@@ -225,3 +225,6 @@ int h2_rxframe(struct worker *, struct h2_sess *);
h2_error h2_set_setting(struct h2_sess *, const uint8_t *);
void h2_req_body(struct req*);
task_func_t h2_do_req;
+#ifdef TRANSPORT_MAGIC
+vtr_req_fail_f h2_req_fail;
+#endif
diff --git a/bin/varnishd/http2/cache_http2_proto.c b/bin/varnishd/http2/cache_http2_proto.c
index 3ab643e..117690c 100644
--- a/bin/varnishd/http2/cache_http2_proto.c
+++ b/bin/varnishd/http2/cache_http2_proto.c
@@ -663,6 +663,15 @@ h2_req_body(struct req *req)
/**********************************************************************/
+void __match_proto__(vtr_req_fail_f)
+h2_req_fail(struct req *req, enum sess_close reason)
+{
+ assert(reason > 0);
+ assert(req->sp->fd != 0);
+}
+
+/**********************************************************************/
+
static enum htc_status_e __match_proto__(htc_complete_f)
h2_frame_complete(struct http_conn *htc)
{
diff --git a/bin/varnishd/http2/cache_http2_session.c b/bin/varnishd/http2/cache_http2_session.c
index 6922166..ce28251 100644
--- a/bin/varnishd/http2/cache_http2_session.c
+++ b/bin/varnishd/http2/cache_http2_session.c
@@ -364,10 +364,11 @@ h2_reembark(struct worker *wrk, struct req *req)
struct transport H2_transport = {
.name = "H2",
.magic = TRANSPORT_MAGIC,
- .new_session = h2_new_session,
- .sess_panic = h2_sess_panic,
.deliver = h2_deliver,
- .req_body = h2_req_body,
.minimal_response = h2_minimal_response,
+ .new_session = h2_new_session,
.reembark = h2_reembark,
+ .req_body = h2_req_body,
+ .req_fail = h2_req_fail,
+ .sess_panic = h2_sess_panic,
};
diff --git a/bin/varnishtest/tests/r02258.vtc b/bin/varnishtest/tests/r02258.vtc
index ab2fac3..707d4b6 100644
--- a/bin/varnishtest/tests/r02258.vtc
+++ b/bin/varnishtest/tests/r02258.vtc
@@ -1,7 +1,6 @@
varnishtest "Streaming range premature finish"
server s1 {
- non_fatal
rxreq
txresp -nolen -hdr "Content-length: 9"
delay 1
@@ -10,6 +9,7 @@ server s1 {
send "BLA"
delay .3
send "BL"
+ delay .3
} -start
varnish v1 -vcl+backend { } -start
@@ -22,3 +22,30 @@ client c1 {
recv 8
expect_close
} -run
+
+delay .3
+
+server s1 {
+ rxreq
+ txresp -nolen -hdr "Content-length: 9"
+ delay 1
+ send "BLA"
+ delay .4
+ send "BLA"
+ delay .3
+ send "BL"
+} -start
+
+varnish v1 -cliok "param.set feature +http2"
+
+client c1 {
+ stream 1 {
+ txreq -hdr "range" "bytes=0-16"
+ rxhdrs
+ expect resp.status == 206
+ expect resp.http.content-length == 9
+ rxdata -all
+ } -run
+} -run
+
+
More information about the varnish-commit
mailing list