Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
bf6ce0f7
Commit
bf6ce0f7
authored
Mar 29, 2017
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve the handling of h2 frame-reception when the connection closes.
Insist we get the frames we expect.
parent
ec9c04d6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
14 deletions
+32
-14
t02003.vtc
bin/varnishtest/tests/t02003.vtc
+2
-1
vtc_http2.c
bin/varnishtest/vtc_http2.c
+30
-13
No files found.
bin/varnishtest/tests/t02003.vtc
View file @
bf6ce0f7
...
...
@@ -269,8 +269,9 @@ client c1 {
client c1 {
stream 0 {
# SETTING unknown v
la
ue
# SETTING unknown v
al
ue
sendhex "000006 04 00 00000000 ffff00000000"
rxsettings
txping
rxping
} -run
...
...
bin/varnishtest/vtc_http2.c
View file @
bf6ce0f7
...
...
@@ -177,27 +177,30 @@ get_bytes(const struct http *hp, char *buf, int n)
if
(
i
<
0
&&
errno
==
EINTR
)
continue
;
if
(
i
==
0
)
vtc_log
(
hp
->
vl
,
hp
->
fatal
,
vtc_log
(
hp
->
vl
,
3
,
"HTTP2 rx timeout (fd:%d %u ms)"
,
hp
->
fd
,
hp
->
timeout
);
if
(
i
<
0
)
vtc_log
(
hp
->
vl
,
hp
->
fatal
,
vtc_log
(
hp
->
vl
,
3
,
"HTTP2 rx failed (fd:%d poll: %s)"
,
hp
->
fd
,
strerror
(
errno
));
assert
(
i
>
0
);
if
(
i
<=
0
)
return
(
i
);
i
=
read
(
hp
->
fd
,
buf
,
n
);
if
(
!
(
pfd
[
0
].
revents
&
POLLIN
))
vtc_log
(
hp
->
vl
,
4
,
"HTTP2 rx poll (fd:%d revents: %x n=%d, i=%d)"
,
hp
->
fd
,
pfd
[
0
].
revents
,
n
,
i
);
if
(
i
==
0
)
vtc_log
(
hp
->
vl
,
hp
->
fatal
,
vtc_log
(
hp
->
vl
,
3
,
"HTTP2 rx EOF (fd:%d read: %s)"
,
hp
->
fd
,
strerror
(
errno
));
if
(
i
<
0
)
vtc_log
(
hp
->
vl
,
hp
->
fatal
,
vtc_log
(
hp
->
vl
,
3
,
"HTTP2 rx failed (fd:%d read: %s)"
,
hp
->
fd
,
strerror
(
errno
));
if
(
i
<=
0
)
return
(
i
);
n
-=
i
;
}
return
(
1
);
...
...
@@ -729,7 +732,12 @@ receive_frame(void *priv)
AZ
(
pthread_mutex_unlock
(
&
hp
->
mtx
));
if
(
!
get_bytes
(
hp
,
hdr
,
9
))
{
vtc_log
(
hp
->
vl
,
1
,
"could not get header"
);
AZ
(
pthread_mutex_lock
(
&
hp
->
mtx
));
VTAILQ_FOREACH
(
s
,
&
hp
->
streams
,
list
)
AZ
(
pthread_cond_signal
(
&
s
->
cond
));
AZ
(
pthread_mutex_unlock
(
&
hp
->
mtx
));
vtc_log
(
hp
->
vl
,
hp
->
fatal
,
"could not get frame header"
);
return
(
NULL
);
}
ALLOC_OBJ
(
f
,
FRAME_MAGIC
);
...
...
@@ -747,7 +755,15 @@ receive_frame(void *priv)
f
->
data
=
malloc
(
f
->
size
+
1L
);
AN
(
f
->
data
);
f
->
data
[
f
->
size
]
=
'\0'
;
AN
(
get_bytes
(
hp
,
f
->
data
,
f
->
size
));
if
(
get_bytes
(
hp
,
f
->
data
,
f
->
size
)
<=
0
)
{
AZ
(
pthread_mutex_lock
(
&
hp
->
mtx
));
VTAILQ_FOREACH
(
s
,
&
hp
->
streams
,
list
)
AZ
(
pthread_cond_signal
(
&
s
->
cond
));
AZ
(
pthread_mutex_unlock
(
&
hp
->
mtx
));
vtc_log
(
hp
->
vl
,
hp
->
fatal
,
"could not get frame body"
);
return
(
NULL
);
}
}
/* is the corresponding stream waiting? */
...
...
@@ -2331,12 +2347,13 @@ cmd_rxpush(CMD_ARGS)
(void)cmd; \
(void)av; \
CAST_OBJ_NOTNULL(s, priv, STREAM_MAGIC); \
if ((s->frame = rxstuff(s))) \
return; \
if (s->frame->type != TYPE_ ## upctype) \
vtc_fatal(vl, "Received frame of type %d " \
"is invalid for %s", \
s->frame->type, "rx" #lctype); \
s->frame = rxstuff(s); \
if (s->frame != NULL && s->frame->type != TYPE_ ## upctype) \
vtc_fatal(vl, \
"Wrong frame type %s (%d) wanted %s", \
s->frame->type < TYPE_MAX ? \
h2_types[s->frame->type] : "?", \
s->frame->type, #upctype); \
}
/* SECTION: stream.spec.prio_rxprio rxprio
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment