Quellcode durchsuchen

Linux shell scripts used as CGI process must still return \r\n at the end of header lines

bel2125 vor 9 Jahren
Ursprung
Commit
a6eb2d232f
2 geänderte Dateien mit 6 neuen und 6 gelöschten Zeilen
  1. 2 2
      test/linux.cgi
  2. 4 4
      test/public_server.c

+ 2 - 2
test/linux.cgi

@@ -1,7 +1,7 @@
 #!/bin/sh
 
-echo "Content-Type: text/plain"
-echo
+printf "Content-Type: text/plain\r\n"
+printf "\r\n"
 
 echo "This is a shell script called by CGI:"
 echo

+ 4 - 4
test/public_server.c

@@ -983,10 +983,10 @@ START_TEST(test_request_handlers)
 #else
 	f = fopen("test.cgi", "w");
 	cgi_script_content = "#!/bin/sh\n\n"
-	                     "echo \"Connection: close\"\n"
-	                     "echo \"Content-Type: text/plain\"\n"
-	                     "echo\n"
-	                     "echo \"CGI test\"\n"
+	                     "printf \"Connection: close\\r\\n\"\n"
+	                     "printf \"Content-Type: text/plain\\r\\n\"\n"
+	                     "printf \"\\r\\n\"\n"
+	                     "printf \"CGI test\\r\\n\"\n"
 	                     "\n";
 	fwrite(cgi_script_content, strlen(cgi_script_content), 1, f);
 	fclose(f);