mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
h2: server: file serving chunk restricted to max frame size from SETTINGS
This commit is contained in:
parent
faf091d8cd
commit
e5944a7da2
1 changed files with 17 additions and 2 deletions
|
@ -2986,6 +2986,9 @@ int lws_serve_http_file_fragment(struct lws *wsi)
|
|||
unsigned char *p, *pstart;
|
||||
#if defined(LWS_WITH_RANGES)
|
||||
unsigned char finished = 0;
|
||||
#endif
|
||||
#if defined(LWS_ROLE_H2)
|
||||
struct lws *nwsi;
|
||||
#endif
|
||||
int n, m;
|
||||
|
||||
|
@ -3067,8 +3070,20 @@ int lws_serve_http_file_fragment(struct lws *wsi)
|
|||
}
|
||||
#endif
|
||||
|
||||
poss = context->pt_serv_buf_size - (unsigned int)n -
|
||||
LWS_H2_FRAME_HEADER_LENGTH;
|
||||
poss = context->pt_serv_buf_size;
|
||||
|
||||
#if defined(LWS_ROLE_H2)
|
||||
/*
|
||||
* If it's h2, restrict any lump that we are sending to the
|
||||
* max h2 frame size the peer indicated he could handle in
|
||||
* his SETTINGS
|
||||
*/
|
||||
nwsi = lws_get_network_wsi(wsi);
|
||||
if (nwsi->h2.h2n &&
|
||||
poss > (lws_filepos_t)nwsi->h2.h2n->peer_set.s[H2SET_MAX_FRAME_SIZE])
|
||||
poss = (lws_filepos_t)nwsi->h2.h2n->peer_set.s[H2SET_MAX_FRAME_SIZE];
|
||||
#endif
|
||||
poss = poss - (lws_filepos_t)(n + LWS_H2_FRAME_HEADER_LENGTH);
|
||||
|
||||
if (wsi->http.tx_content_length)
|
||||
if (poss > wsi->http.tx_content_remain)
|
||||
|
|
Loading…
Add table
Reference in a new issue