[master] f9eec3b Respect remote MAX_FRAME_SIZE
Poul-Henning Kamp
phk at FreeBSD.org
Thu Sep 1 09:34:11 CEST 2016
commit f9eec3b3cb52ba6a31ba13f95cd1fb7f1c4f0dd5
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Thu Sep 1 07:33:17 2016 +0000
Respect remote MAX_FRAME_SIZE
diff --git a/bin/varnishd/http2/cache_http2.h b/bin/varnishd/http2/cache_http2.h
index 1378ef8..3bf1fdc 100644
--- a/bin/varnishd/http2/cache_http2.h
+++ b/bin/varnishd/http2/cache_http2.h
@@ -50,7 +50,12 @@ enum h2_stream_e {
#define H2_FRAME_FLAGS(l,u,v) extern const uint8_t H2FF_##u;
#include "tbl/h2_frames.h"
-#define H2_SETTINGS_N 7
+enum h2setting {
+#define H2_SETTINGS(n,v,d) H2S_##n = v,
+#include "tbl/h2_settings.h"
+#undef H2_SETTINGS
+ H2_SETTINGS_N
+};
struct h2_req {
unsigned magic;
diff --git a/bin/varnishd/http2/cache_http2_deliver.c b/bin/varnishd/http2/cache_http2_deliver.c
index 14b3d8a..f205e23 100644
--- a/bin/varnishd/http2/cache_http2_deliver.c
+++ b/bin/varnishd/http2/cache_http2_deliver.c
@@ -44,7 +44,6 @@
#include "../cache/cache_filter.h"
#include "../cache/cache_transport.h"
-#include "../http1/cache_http1.h"
#include "../http2/cache_http2.h"
#include "vct.h"
diff --git a/bin/varnishd/http2/cache_http2_panic.c b/bin/varnishd/http2/cache_http2_panic.c
index 085c5c4..0605862 100644
--- a/bin/varnishd/http2/cache_http2_panic.c
+++ b/bin/varnishd/http2/cache_http2_panic.c
@@ -47,8 +47,6 @@
#include "vend.h"
#include "vsb.h"
-#include "vtcp.h"
-#include "vtim.h"
void
h2_sess_panic(struct vsb *vsb, const struct sess *sp)
diff --git a/bin/varnishd/http2/cache_http2_proto.c b/bin/varnishd/http2/cache_http2_proto.c
index e013b6d..4175367 100644
--- a/bin/varnishd/http2/cache_http2_proto.c
+++ b/bin/varnishd/http2/cache_http2_proto.c
@@ -55,12 +55,6 @@ enum h2frame {
#include "tbl/h2_frames.h"
};
-enum h2setting {
-#define H2_SETTINGS(n,v,d) H2S_##n = v,
-#include "tbl/h2_settings.h"
-#undef H2_SETTINGS
-};
-
static const char *
h2_framename(enum h2frame h2f)
{
diff --git a/bin/varnishd/http2/cache_http2_send.c b/bin/varnishd/http2/cache_http2_send.c
index 70f48bf..0ea2690 100644
--- a/bin/varnishd/http2/cache_http2_send.c
+++ b/bin/varnishd/http2/cache_http2_send.c
@@ -100,15 +100,36 @@ H2_Send(struct worker *wrk, struct h2_req *r2, int flush,
{
int retval;
struct h2_sess *h2;
+ uint32_t mfs, tf;
+ const char *p;
(void)flush;
+ AN(ptr);
CHECK_OBJ_NOTNULL(r2, H2_REQ_MAGIC);
h2 = r2->h2sess;
CHECK_OBJ_NOTNULL(h2, H2_SESS_MAGIC);
Lck_Lock(&h2->sess->mtx);
- retval = H2_Send_Frame(wrk, h2, type, flags, len, r2->stream, ptr);
+ mfs = h2->their_settings[H2S_MAX_FRAME_SIZE];
+ if (len < mfs) {
+ retval = H2_Send_Frame(wrk, h2,
+ type, flags, len, r2->stream, ptr);
+ } else if (type == H2_FRAME_DATA) {
+ p = ptr;
+ do {
+ tf = mfs;
+ if (tf > len)
+ tf = len;
+ retval = H2_Send_Frame(wrk, h2, type,
+ tf == len ? flags : 0,
+ tf, r2->stream, p);
+ p += tf;
+ len -= tf;
+ } while (len > 0);
+ } else {
+ INCOMPL();
+ }
Lck_Unlock(&h2->sess->mtx);
return (retval);
}
More information about the varnish-commit
mailing list