410-httpd_cgi_headers.patch 684 B

12345678910111213141516
  1. --- a/networking/httpd.c
  2. +++ b/networking/httpd.c
  3. @@ -1222,10 +1222,10 @@ static NOINLINE void cgi_io_loop_and_exi
  4. if (full_write(STDOUT_FILENO, HTTP_200, sizeof(HTTP_200)-1) != sizeof(HTTP_200)-1)
  5. break;
  6. }
  7. - /* Commented out:
  8. - if (!strstr(rbuf, "ontent-")) {
  9. - full_write(s, "Content-type: text/plain\r\n\r\n", 28);
  10. + if (!strstr(rbuf, "ontent-") && !strstr(rbuf, "ocation:")) {
  11. + full_write(1, "Content-type: text/plain\r\n\r\n", 28);
  12. }
  13. + /* Previously commented out:
  14. * Counter-example of valid CGI without Content-type:
  15. * echo -en "HTTP/1.0 302 Found\r\n"
  16. * echo -en "Location: http://www.busybox.net\r\n"