mirror of
https://github.com/lammertb/libhttp.git
synced 2025-12-22 04:02:04 +03:00
@@ -5431,7 +5431,6 @@ static void send_file_data(struct mg_connection *conn,
|
|||||||
{
|
{
|
||||||
char buf[MG_BUF_LEN];
|
char buf[MG_BUF_LEN];
|
||||||
int to_read, num_read, num_written;
|
int to_read, num_read, num_written;
|
||||||
int loop_cnt = 0;
|
|
||||||
int64_t size;
|
int64_t size;
|
||||||
|
|
||||||
if (!filep || !conn) {
|
if (!filep || !conn) {
|
||||||
@@ -5456,10 +5455,11 @@ static void send_file_data(struct mg_connection *conn,
|
|||||||
off_t sf_offs = (off_t)offset;
|
off_t sf_offs = (off_t)offset;
|
||||||
ssize_t sf_sent;
|
ssize_t sf_sent;
|
||||||
int sf_file = fileno(filep->fp);
|
int sf_file = fileno(filep->fp);
|
||||||
|
int loop_cnt = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
/* 2147479552 (0x7FFFF000) is a limit found by experiment on 64
|
/* 2147479552 (0x7FFFF000) is a limit found by experiment on
|
||||||
* bit Linux (2^31 minus one memory page of 4k?). */
|
* 64 bit Linux (2^31 minus one memory page of 4k?). */
|
||||||
size_t sf_tosend =
|
size_t sf_tosend =
|
||||||
(size_t)((len < 0x7FFFF000) ? len : 0x7FFFF000);
|
(size_t)((len < 0x7FFFF000) ? len : 0x7FFFF000);
|
||||||
sf_sent =
|
sf_sent =
|
||||||
@@ -5474,9 +5474,14 @@ static void send_file_data(struct mg_connection *conn,
|
|||||||
* /sys/ and /proc/ file system.
|
* /sys/ and /proc/ file system.
|
||||||
* Use the regular user mode copy code instead. */
|
* Use the regular user mode copy code instead. */
|
||||||
break;
|
break;
|
||||||
|
} else if (sf_sent == 0) {
|
||||||
|
/* No error, but 0 bytes sent. May be EOF? */
|
||||||
|
mg_sleep(1);
|
||||||
|
loop_cnt = -1;
|
||||||
|
/* TODO(high): Maybe just return here. --> Test required */
|
||||||
}
|
}
|
||||||
|
|
||||||
loop_cnt++;
|
loop_cnt++;
|
||||||
|
|
||||||
} while ((len > 0) && (sf_sent >= 0));
|
} while ((len > 0) && (sf_sent >= 0));
|
||||||
|
|
||||||
if (sf_sent > 0) {
|
if (sf_sent > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user