[PATCH 5/6] Fix Content-type header name to Content-Type

Sergey Ponomarev stokito at gmail.com
Sat Jan 9 21:09:50 UTC 2021


It's better to return header names in proper case because they may be improperly parsed on client's side e.g. it may be some case sensitive comparison in some shell script.

Signed-off-by: Sergey Ponomarev <stokito at gmail.com>
---
 networking/httpd.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/networking/httpd.c b/networking/httpd.c
index 72c1ce937..285c8e655 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -1134,7 +1134,7 @@ static void send_headers(unsigned responseNum)
 
 	if ((responseNum != HTTP_NOT_MODIFIED) && (responseNum != HTTP_OK || found_mime_type)) {
 		len += sprintf(iobuf + len,
-				"Content-type: %s\r\n",
+				"Content-Type: %s\r\n",
 				/* if it's error message, then it's HTML */
 				(responseNum != HTTP_OK ? "text/html" : found_mime_type)
 		);
@@ -1503,9 +1503,9 @@ static NOINLINE void cgi_io_loop_and_exit(int fromCgi_rd, int toCgi_wr, int post
 					}
 					/* Commented out:
 					if (!strstr(rbuf, "ontent-")) {
-						full_write(s, "Content-type: text/plain\r\n\r\n", 28);
+						full_write(s, "Content-Type: text/plain\r\n\r\n", 28);
 					}
-					 * Counter-example of valid CGI without Content-type:
+					 * Counter-example of valid CGI without Content-Type:
 					 * echo -en "HTTP/1.1 302 Found\r\n"
 					 * echo -en "Location: http://www.busybox.net\r\n"
 					 * echo -en "\r\n"
@@ -1820,7 +1820,7 @@ static NOINLINE void send_file_and_exit(const char *url, int what)
 	 * (happens if you abort downloads from local httpd): */
 	signal(SIGPIPE, SIG_IGN);
 
-	/* If not found, default is to not send "Content-type:" */
+	/* If not found, default is to not send "Content-Type:" */
 	/*found_mime_type = NULL; - already is */
 	suffix = strrchr(url, '.');
 	if (suffix) {
@@ -1886,7 +1886,7 @@ static NOINLINE void send_file_and_exit(const char *url, int what)
 	}
 
 	if (DEBUG)
-		bb_error_msg("sending file '%s' content-type: %s",
+		bb_error_msg("sending file '%s' Content-Type: %s",
 			url, found_mime_type);
 
 #if ENABLE_FEATURE_HTTPD_RANGES
-- 
2.27.0



More information about the busybox mailing list