aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-08-26 22:22:50 +0000
committerEric Andersen <andersen@codepoet.org>2004-08-26 22:22:50 +0000
commit97a1de10e95c44e1a2cec3c3c4fd8b39d4219318 (patch)
treef3f68262cd5f20fb0c14c210b31272f5e412caec
parent52499cb9ae01a67187c65ea43a48140b147968cf (diff)
downloadbusybox-w32-97a1de10e95c44e1a2cec3c3c4fd8b39d4219318.tar.gz
busybox-w32-97a1de10e95c44e1a2cec3c3c4fd8b39d4219318.tar.bz2
busybox-w32-97a1de10e95c44e1a2cec3c3c4fd8b39d4219318.zip
Vladimir N. Oleynik writes:
Ming-Ching, >>No. Here there are no mistakes. >>You using POST metod. >>For get data you should read from stdin CONTENT_LENGTH bytes. >Hower as I posted a little while ago, there is indeed a bug >in POST method if the CONTENT_LENGTH is bigger >than sizeof(wbuf[128]). So if your CGI script is expecting to >read the full CONTENT_LENGTH, it might block forever, >because it will only transfer sizeof(wbuf) to the CGI. Ok, Ok. I should find time to understand with a problem. Try attached patch. --w vodz
-rw-r--r--networking/httpd.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/networking/httpd.c b/networking/httpd.c
index 7322d143a..ff093c5f1 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -62,11 +62,11 @@
62 * The Deny/Allow IP logic: 62 * The Deny/Allow IP logic:
63 * 63 *
64 * - Default is to allow all. No addresses are denied unless 64 * - Default is to allow all. No addresses are denied unless
65 * denied with a D: rule. 65 * denied with a D: rule.
66 * - Order of Deny/Allow rules is significant 66 * - Order of Deny/Allow rules is significant
67 * - Deny rules take precedence over allow rules. 67 * - Deny rules take precedence over allow rules.
68 * - If a deny all rule (D:*) is used it acts as a catch-all for unmatched 68 * - If a deny all rule (D:*) is used it acts as a catch-all for unmatched
69 * addresses. 69 * addresses.
70 * - Specification of Allow all (A:*) is a no-op 70 * - Specification of Allow all (A:*) is a no-op
71 * 71 *
72 * Example: 72 * Example:
@@ -1244,19 +1244,29 @@ static int sendCgi(const char *url,
1244 } 1244 }
1245 } else if(bodyLen > 0 && post_readed_size == 0 && FD_ISSET(a_c_r, &readSet)) { 1245 } else if(bodyLen > 0 && post_readed_size == 0 && FD_ISSET(a_c_r, &readSet)) {
1246 count = bodyLen > sizeof(wbuf) ? sizeof(wbuf) : bodyLen; 1246 count = bodyLen > sizeof(wbuf) ? sizeof(wbuf) : bodyLen;
1247 count = bb_full_read(a_c_r, wbuf, count); 1247 count = safe_read(a_c_r, wbuf, count);
1248 if(count > 0) { 1248 if(count > 0) {
1249 post_readed_size += count; 1249 post_readed_size += count;
1250 bodyLen -= count; 1250 bodyLen -= count;
1251 } else { 1251 } else {
1252 bodyLen = 0; /* closed */ 1252 bodyLen = 0; /* closed */
1253 } 1253 }
1254 } else if(FD_ISSET(inFd, &readSet)) { 1254 }
1255 if(FD_ISSET(inFd, &readSet)) {
1255 int s = a_c_w; 1256 int s = a_c_w;
1256 char *rbuf = config->buf; 1257 char *rbuf = config->buf;
1257 1258
1259#ifndef PIPE_BUF
1260# define PIPESIZE 4096 /* amount of buffering in a pipe */
1261#else
1262# define PIPESIZE PIPE_BUF
1263#endif
1264#if PIPESIZE >= MAX_MEMORY_BUFF
1265# error "PIPESIZE >= MAX_MEMORY_BUFF"
1266#endif
1267
1258 // There is something to read 1268 // There is something to read
1259 count = bb_full_read(inFd, rbuf, MAX_MEMORY_BUFF-1); 1269 count = safe_read(inFd, rbuf, PIPESIZE);
1260 if (count == 0) 1270 if (count == 0)
1261 break; /* closed */ 1271 break; /* closed */
1262 if (count > 0) { 1272 if (count > 0) {