mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-16 00:00:07 +01:00
h2: never send more than file length
This commit is contained in:
parent
e4e774b8f2
commit
8dcb4ca753
1 changed files with 4 additions and 1 deletions
|
@ -507,7 +507,7 @@ send_raw:
|
||||||
(wp & 0x1f) == LWS_WRITE_HTTP_FINAL) &&
|
(wp & 0x1f) == LWS_WRITE_HTTP_FINAL) &&
|
||||||
wsi->u.http.tx_content_length) {
|
wsi->u.http.tx_content_length) {
|
||||||
wsi->u.http.tx_content_remain -= len;
|
wsi->u.http.tx_content_remain -= len;
|
||||||
lwsl_info("%s: content_remain = %llu\n", __func__,
|
lwsl_info("%s: wsi %p: tx_content_remain = %llu\n", __func__, wsi,
|
||||||
(unsigned long long)wsi->u.http.tx_content_remain);
|
(unsigned long long)wsi->u.http.tx_content_remain);
|
||||||
if (!wsi->u.http.tx_content_remain) {
|
if (!wsi->u.http.tx_content_remain) {
|
||||||
lwsl_info("%s: selecting final write mode\n", __func__);
|
lwsl_info("%s: selecting final write mode\n", __func__);
|
||||||
|
@ -639,6 +639,9 @@ LWS_VISIBLE int lws_serve_http_file_fragment(struct lws *wsi)
|
||||||
|
|
||||||
poss = context->pt_serv_buf_size - n - LWS_H2_FRAME_HEADER_LENGTH;
|
poss = context->pt_serv_buf_size - n - LWS_H2_FRAME_HEADER_LENGTH;
|
||||||
|
|
||||||
|
if (poss > wsi->u.http.tx_content_remain)
|
||||||
|
poss = wsi->u.http.tx_content_remain;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if there is a hint about how much we will do well to send at one time,
|
* if there is a hint about how much we will do well to send at one time,
|
||||||
* restrict ourselves to only trying to send that.
|
* restrict ourselves to only trying to send that.
|
||||||
|
|
Loading…
Add table
Reference in a new issue