Commit 5b70451f authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Fixes to and better test-coverage of exception paths in H2 upgrade.

parent 42044142
......@@ -181,7 +181,6 @@ h2_del_req(struct worker *wrk, struct h2_req *r2)
Req_Release(r2->req);
if (r)
return;
/* All streams gone, including stream #0, clean up */
req = h2->srq;
Req_Cleanup(sp, wrk, req);
......
......@@ -192,11 +192,12 @@ h2_b64url_settings(struct h2_sess *h2, struct req *req)
/**********************************************************************/
static int
h2_ou_session(const struct worker *wrk, struct h2_sess *h2,
h2_ou_session(struct worker *wrk, struct h2_sess *h2,
struct req *req)
{
ssize_t sz;
enum htc_status_e hs;
struct h2_req *r2;
if (h2_b64url_settings(h2, req)) {
VSLb(h2->vsl, SLT_Debug, "H2: Bad HTTP-Settings");
......@@ -220,7 +221,7 @@ h2_ou_session(const struct worker *wrk, struct h2_sess *h2,
HTC_RxInit(h2->htc, h2->ws);
/* Start req thread */
(void)h2_new_req(wrk, h2, 1, req);
r2 = h2_new_req(wrk, h2, 1, req);
req->req_step = R_STP_RECV;
req->transport = &H2_transport;
req->req_step = R_STP_TRANSPORT;
......@@ -233,7 +234,8 @@ h2_ou_session(const struct worker *wrk, struct h2_sess *h2,
hs = HTC_RxStuff(h2->htc, H2_prism_complete,
NULL, NULL, NAN, h2->sess->t_idle + cache_param->timeout_idle, 256);
if (hs != HTC_S_COMPLETE) {
VSLb(h2->vsl, SLT_Debug, "H2: No OU PRISM (hs=%d)", hs);
VSLb(h2->vsl, SLT_Debug, "H2: No/Bad OU PRISM (hs=%d)", hs);
h2_del_req(wrk, r2);
return (0);
}
XXXAZ(Pool_Task(wrk->pool, &req->task, TASK_QUEUE_REQ));
......@@ -285,11 +287,7 @@ h2_new_session(struct worker *wrk, void *arg)
h2->req0 = h2_new_req(wrk, h2, 0, NULL);
if (req->err_code == H2_OU_MARKER && !h2_ou_session(wrk, h2, req)) {
CNT_AcctLogCharge(wrk->stats, req);
VCL_Rel(&req->vcl);
Req_Release(req);
h2_del_req(wrk, h2->req0);
SES_Delete(h2->sess, SC_RX_JUNK, NAN);
return;
}
assert(HTC_S_COMPLETE == H2_prism_complete(h2->htc));
......
......@@ -8,9 +8,17 @@ server s1 {
varnish v1 -vcl+backend {} -start
varnish v1 -cliok "param.set feature +http2"
varnish v1 -cliok "param.set debug +syncvsl"
varnish v1 -cliok "param.set feature -http2"
client c1 {
txpri
expect_close
} -run
varnish v1 -cliok "param.set feature +http2"
client c1 {
stream 1 {
txprio -weight 10 -stream 0
......
......@@ -27,16 +27,41 @@ client c1 {
server s1 {
rxreq
expect req.url == /upgrade
expect req.url == /upgrade1
expect req.http.host == foo.bar
expect req.bodylen == 4
txresp -status 401 -bodylen 8
rxreq
expect req.url == /upgrade2
expect req.http.host == foo.bar
barrier b1 sync
txresp -status 401 -bodylen 11
txresp -status 402 -bodylen 11
} -start
delay .5
varnish v1 -cliok "param.set feature +http2"
# We don't support upgrades with body
client c1 {
send "POST /upgrade1 HTTP/1.1\r\n"
send "Host: foo.bar\r\n"
send "Upgrade: h2c\r\n"
send "HTTP2-Settings: AAMAAABkAAQAAP__\r\n"
send "Content-Length: 4\r\n"
send "\r\n"
send "FOO\n"
rxresp
expect resp.status == 401
expect resp.bodylen == 8
} -run
delay .5
client c1 {
send "GET /upgrade HTTP/1.1\r\n"
send "GET /upgrade2 HTTP/1.1\r\n"
send "Host: foo.bar\r\n"
send "Upgrade: h2c\r\n"
send "HTTP2-Settings: AAMAAABkAAQAAP__\r\n"
......@@ -56,7 +81,7 @@ client c1 {
barrier b1 sync
stream 1 {
rxresp
expect resp.status == 401
expect resp.status == 402
expect resp.bodylen == 11
} -run
} -run
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment