aboutsummaryrefslogtreecommitdiff
path: root/networking/httpd.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/httpd.c')
-rw-r--r--networking/httpd.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/networking/httpd.c b/networking/httpd.c
index 4094061a8..4da7e5c65 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -947,7 +947,7 @@ static void log_and_exit(void)
947 /* Why?? 947 /* Why??
948 (this also messes up stdin when user runs httpd -i from terminal) 948 (this also messes up stdin when user runs httpd -i from terminal)
949 ndelay_on(0); 949 ndelay_on(0);
950 while (read(0, iobuf, IOBUF_SIZE) > 0) 950 while (read(STDIN_FILENO, iobuf, IOBUF_SIZE) > 0)
951 continue; 951 continue;
952 */ 952 */
953 953
@@ -1023,7 +1023,7 @@ static void send_headers(int responseNum)
1023 1023
1024 if (DEBUG) 1024 if (DEBUG)
1025 fprintf(stderr, "headers: '%s'\n", iobuf); 1025 fprintf(stderr, "headers: '%s'\n", iobuf);
1026 full_write(1, iobuf, len); 1026 full_write(STDOUT_FILENO, iobuf, len);
1027 if (DEBUG) 1027 if (DEBUG)
1028 fprintf(stderr, "writing error page: '%s'\n", error_page); 1028 fprintf(stderr, "writing error page: '%s'\n", error_page);
1029 return send_file_and_exit(error_page, SEND_BODY); 1029 return send_file_and_exit(error_page, SEND_BODY);
@@ -1062,7 +1062,7 @@ static void send_headers(int responseNum)
1062 } 1062 }
1063 if (DEBUG) 1063 if (DEBUG)
1064 fprintf(stderr, "headers: '%s'\n", iobuf); 1064 fprintf(stderr, "headers: '%s'\n", iobuf);
1065 if (full_write(1, iobuf, len) != len) { 1065 if (full_write(STDOUT_FILENO, iobuf, len) != len) {
1066 if (verbose > 1) 1066 if (verbose > 1)
1067 bb_perror_msg("error"); 1067 bb_perror_msg("error");
1068 log_and_exit(); 1068 log_and_exit();
@@ -1090,7 +1090,7 @@ static int get_line(void)
1090 1090
1091 while (1) { 1091 while (1) {
1092 if (hdr_cnt <= 0) { 1092 if (hdr_cnt <= 0) {
1093 hdr_cnt = safe_read(0, hdr_buf, sizeof(hdr_buf)); 1093 hdr_cnt = safe_read(STDIN_FILENO, hdr_buf, sizeof(hdr_buf));
1094 if (hdr_cnt <= 0) 1094 if (hdr_cnt <= 0)
1095 break; 1095 break;
1096 hdr_ptr = hdr_buf; 1096 hdr_ptr = hdr_buf;
@@ -1202,8 +1202,8 @@ static NOINLINE void cgi_io_loop_and_exit(int fromCgi_rd, int toCgi_wr, int post
1202 * and there *is* data to read from the peer 1202 * and there *is* data to read from the peer
1203 * (POSTDATA) */ 1203 * (POSTDATA) */
1204 //count = post_len > (int)sizeof(hdr_buf) ? (int)sizeof(hdr_buf) : post_len; 1204 //count = post_len > (int)sizeof(hdr_buf) ? (int)sizeof(hdr_buf) : post_len;
1205 //count = safe_read(0, hdr_buf, count); 1205 //count = safe_read(STDIN_FILENO, hdr_buf, count);
1206 count = safe_read(0, hdr_buf, sizeof(hdr_buf)); 1206 count = safe_read(STDIN_FILENO, hdr_buf, sizeof(hdr_buf));
1207 if (count > 0) { 1207 if (count > 0) {
1208 hdr_cnt = count; 1208 hdr_cnt = count;
1209 hdr_ptr = hdr_buf; 1209 hdr_ptr = hdr_buf;
@@ -1237,8 +1237,8 @@ static NOINLINE void cgi_io_loop_and_exit(int fromCgi_rd, int toCgi_wr, int post
1237 /* eof (or error) and there was no "HTTP", 1237 /* eof (or error) and there was no "HTTP",
1238 * so write it, then write received data */ 1238 * so write it, then write received data */
1239 if (out_cnt) { 1239 if (out_cnt) {
1240 full_write(1, HTTP_200, sizeof(HTTP_200)-1); 1240 full_write(STDOUT_FILENO, HTTP_200, sizeof(HTTP_200)-1);
1241 full_write(1, rbuf, out_cnt); 1241 full_write(STDOUT_FILENO, rbuf, out_cnt);
1242 } 1242 }
1243 break; /* CGI stdout is closed, exiting */ 1243 break; /* CGI stdout is closed, exiting */
1244 } 1244 }
@@ -1247,7 +1247,7 @@ static NOINLINE void cgi_io_loop_and_exit(int fromCgi_rd, int toCgi_wr, int post
1247 /* "Status" header format is: "Status: 302 Redirected\r\n" */ 1247 /* "Status" header format is: "Status: 302 Redirected\r\n" */
1248 if (out_cnt >= 8 && memcmp(rbuf, "Status: ", 8) == 0) { 1248 if (out_cnt >= 8 && memcmp(rbuf, "Status: ", 8) == 0) {
1249 /* send "HTTP/1.0 " */ 1249 /* send "HTTP/1.0 " */
1250 if (full_write(1, HTTP_200, 9) != 9) 1250 if (full_write(STDOUT_FILENO, HTTP_200, 9) != 9)
1251 break; 1251 break;
1252 rbuf += 8; /* skip "Status: " */ 1252 rbuf += 8; /* skip "Status: " */
1253 count = out_cnt - 8; 1253 count = out_cnt - 8;
@@ -1256,7 +1256,7 @@ static NOINLINE void cgi_io_loop_and_exit(int fromCgi_rd, int toCgi_wr, int post
1256 /* Did CGI add "HTTP"? */ 1256 /* Did CGI add "HTTP"? */
1257 if (memcmp(rbuf, HTTP_200, 4) != 0) { 1257 if (memcmp(rbuf, HTTP_200, 4) != 0) {
1258 /* there is no "HTTP", do it ourself */ 1258 /* there is no "HTTP", do it ourself */
1259 if (full_write(1, HTTP_200, sizeof(HTTP_200)-1) != sizeof(HTTP_200)-1) 1259 if (full_write(STDOUT_FILENO, HTTP_200, sizeof(HTTP_200)-1) != sizeof(HTTP_200)-1)
1260 break; 1260 break;
1261 } 1261 }
1262 /* Commented out: 1262 /* Commented out:
@@ -1276,7 +1276,7 @@ static NOINLINE void cgi_io_loop_and_exit(int fromCgi_rd, int toCgi_wr, int post
1276 if (count <= 0) 1276 if (count <= 0)
1277 break; /* eof (or error) */ 1277 break; /* eof (or error) */
1278 } 1278 }
1279 if (full_write(1, rbuf, count) != count) 1279 if (full_write(STDOUT_FILENO, rbuf, count) != count)
1280 break; 1280 break;
1281 if (DEBUG) 1281 if (DEBUG)
1282 fprintf(stderr, "cgi read %d bytes: '%.*s'\n", count, count, rbuf); 1282 fprintf(stderr, "cgi read %d bytes: '%.*s'\n", count, count, rbuf);
@@ -1632,7 +1632,7 @@ static void send_file_and_exit(const char *url, int what)
1632 while ((count = safe_read(f, iobuf, IOBUF_SIZE)) > 0) { 1632 while ((count = safe_read(f, iobuf, IOBUF_SIZE)) > 0) {
1633 ssize_t n; 1633 ssize_t n;
1634 USE_FEATURE_HTTPD_RANGES(if (count > range_len) count = range_len;) 1634 USE_FEATURE_HTTPD_RANGES(if (count > range_len) count = range_len;)
1635 n = full_write(1, iobuf, count); 1635 n = full_write(STDOUT_FILENO, iobuf, count);
1636 if (count != n) 1636 if (count != n)
1637 break; 1637 break;
1638 USE_FEATURE_HTTPD_RANGES(range_len -= count;) 1638 USE_FEATURE_HTTPD_RANGES(range_len -= count;)