Commit f9eec3b3 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Respect remote MAX_FRAME_SIZE

parent 5043df49
......@@ -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;
......
......@@ -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"
......
......@@ -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)
......
......@@ -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)
{
......
......@@ -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);
}
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