[asterisk-commits] qwell: branch 1.8 r309204 - /branches/1.8/main/http.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 1 16:25:49 CST 2011


Author: qwell
Date: Tue Mar  1 16:25:44 2011
New Revision: 309204

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=309204
Log:
Fix consistency of CRLFs on HTTP headers that get sent out.

(closes issue #18186)
Reported by: nivaldomjunior
Patches: 
      18186-httpheadernewline.diff uploaded by qwell (license 4)

Modified:
    branches/1.8/main/http.c

Modified: branches/1.8/main/http.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/http.c?view=diff&rev=309204&r1=309203&r2=309204
==============================================================================
--- branches/1.8/main/http.c (original)
+++ branches/1.8/main/http.c Tue Mar  1 16:25:44 2011
@@ -276,7 +276,7 @@
 
 	ast_str_set(&http_header, 0, "Content-type: %s\r\n"
 		"ETag: %s\r\n"
-		"Last-Modified: %s",
+		"Last-Modified: %s\r\n",
 		mtype,
 		etag,
 		timebuf);
@@ -367,7 +367,7 @@
 };
 
 
-/* send http/1.1 responce */
+/* send http/1.1 response */
 /* free content variable and close socket*/
 void ast_http_send(struct ast_tcptls_session_instance *ser,
 	enum ast_http_method method, int status_code, const char *status_title,
@@ -385,7 +385,7 @@
 
 	ast_strftime(timebuf, sizeof(timebuf), "%a, %d %b %Y %H:%M:%S GMT", ast_localtime(&now, &tm, "GMT"));
 
-	/* calc conetnt length */
+	/* calc content length */
 	if (out) {
 		content_length += strlen(ast_str_buffer(out));
 	}
@@ -402,7 +402,8 @@
 		"Connection: close\r\n"
 		"%s"
 		"Content-Length: %d\r\n"
-		"%s\r\n\r\n",
+		"%s"
+		"\r\n",
 		status_code, status_title ? status_title : "OK",
 		ast_get_version(),
 		timebuf,
@@ -457,7 +458,7 @@
 
 	ast_str_set(&http_headers, 0,
 		"WWW-authenticate: Digest algorithm=MD5, realm=\"%s\", nonce=\"%08lx\", qop=\"auth\", opaque=\"%08lx\"%s\r\n"
-		"Content-type: text/html",
+		"Content-type: text/html\r\n",
 		realm ? realm : "Asterisk",
 		nonce,
 		opaque,
@@ -479,7 +480,7 @@
 	return;
 }
 
-/* send http error responce and close socket*/
+/* send http error response and close socket*/
 void ast_http_error(struct ast_tcptls_session_instance *ser, int status_code, const char *status_title, const char *text)
 {
 	struct ast_str *http_headers = ast_str_create(40);
@@ -491,7 +492,7 @@
 		return;
 	}
 
-	ast_str_set(&http_headers, 0, "Content-type: text/html");
+	ast_str_set(&http_headers, 0, "Content-type: text/html\r\n");
 
 	ast_str_set(&out, 0,
 		"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\r\n"




More information about the asterisk-commits mailing list