aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--networking/httpd.c15
-rw-r--r--shell/hush.c3
2 files changed, 4 insertions, 14 deletions
diff --git a/networking/httpd.c b/networking/httpd.c
index aa8ce8dcb..d44ec271a 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -259,18 +259,11 @@
259#if ENABLE_FEATURE_USE_SENDFILE 259#if ENABLE_FEATURE_USE_SENDFILE
260# include <sys/sendfile.h> 260# include <sys/sendfile.h>
261#endif 261#endif
262/* amount of buffering in a pipe */
263#ifndef PIPE_BUF
264# define PIPE_BUF 4096
265#endif
266 262
267#define DEBUG 0 263#define DEBUG 0
268 264
269#define IOBUF_SIZE 8192 265#define IOBUF_SIZE 8192
270#define MAX_HTTP_HEADERS_SIZE ((8*1024) - 16) 266#define MAX_HTTP_HEADERS_SIZE (32*1024)
271#if PIPE_BUF >= IOBUF_SIZE
272# error "PIPE_BUF >= IOBUF_SIZE"
273#endif
274 267
275#define HEADER_READ_TIMEOUT 60 268#define HEADER_READ_TIMEOUT 60
276 269
@@ -1413,10 +1406,10 @@ static NOINLINE void cgi_io_loop_and_exit(int fromCgi_rd, int toCgi_wr, int post
1413 * CGI may output a few first bytes and then wait 1406 * CGI may output a few first bytes and then wait
1414 * for POSTDATA without closing stdout. 1407 * for POSTDATA without closing stdout.
1415 * With full_read we may wait here forever. */ 1408 * With full_read we may wait here forever. */
1416 count = safe_read(fromCgi_rd, rbuf + out_cnt, PIPE_BUF - 8); 1409 count = safe_read(fromCgi_rd, rbuf + out_cnt, IOBUF_SIZE - 8);
1417 if (count <= 0) { 1410 if (count <= 0) {
1418 /* eof (or error) and there was no "HTTP", 1411 /* eof (or error) and there was no "HTTP",
1419 * so write it, then write received data */ 1412 * send "HTTP/1.0 200 OK\r\n", then send received data */
1420 if (out_cnt) { 1413 if (out_cnt) {
1421 full_write(STDOUT_FILENO, HTTP_200, sizeof(HTTP_200)-1); 1414 full_write(STDOUT_FILENO, HTTP_200, sizeof(HTTP_200)-1);
1422 full_write(STDOUT_FILENO, rbuf, out_cnt); 1415 full_write(STDOUT_FILENO, rbuf, out_cnt);
@@ -1454,7 +1447,7 @@ static NOINLINE void cgi_io_loop_and_exit(int fromCgi_rd, int toCgi_wr, int post
1454 out_cnt = -1; /* buffering off */ 1447 out_cnt = -1; /* buffering off */
1455 } 1448 }
1456 } else { 1449 } else {
1457 count = safe_read(fromCgi_rd, rbuf, PIPE_BUF); 1450 count = safe_read(fromCgi_rd, rbuf, IOBUF_SIZE);
1458 if (count <= 0) 1451 if (count <= 0)
1459 break; /* eof (or error) */ 1452 break; /* eof (or error) */
1460 } 1453 }
diff --git a/shell/hush.c b/shell/hush.c
index d745148f4..b3ae73b9b 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -363,9 +363,6 @@
363#ifndef F_DUPFD_CLOEXEC 363#ifndef F_DUPFD_CLOEXEC
364# define F_DUPFD_CLOEXEC F_DUPFD 364# define F_DUPFD_CLOEXEC F_DUPFD
365#endif 365#endif
366#ifndef PIPE_BUF
367# define PIPE_BUF 4096 /* amount of buffering in a pipe */
368#endif
369 366
370#if ENABLE_FEATURE_SH_EMBEDDED_SCRIPTS && !(ENABLE_ASH || ENABLE_SH_IS_ASH || ENABLE_BASH_IS_ASH) 367#if ENABLE_FEATURE_SH_EMBEDDED_SCRIPTS && !(ENABLE_ASH || ENABLE_SH_IS_ASH || ENABLE_BASH_IS_ASH)
371# include "embedded_scripts.h" 368# include "embedded_scripts.h"