aboutsummaryrefslogtreecommitdiffstats
path: root/main/http.c
diff options
context:
space:
mode:
authorqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2011-03-01 22:26:37 +0000
committerqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2011-03-01 22:26:37 +0000
commit397a462eb1e17c16ee49705e08ded7ac5c5ffb92 (patch)
tree8b1882605fe6392d9139b69c46048c36973d8d02 /main/http.c
parentdc80957907884ad571a13f4e3a771fd34cb080b0 (diff)
Merged revisions 309204 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r309204 | qwell | 2011-03-01 16:25:44 -0600 (Tue, 01 Mar 2011) | 7 lines 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) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@309209 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/http.c')
-rw-r--r--main/http.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/main/http.c b/main/http.c
index 5d8579464..1c4a9ca60 100644
--- a/main/http.c
+++ b/main/http.c
@@ -278,7 +278,7 @@ static int static_callback(struct ast_tcptls_session_instance *ser,
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);
@@ -369,7 +369,7 @@ static struct ast_http_uri staticuri = {
};
-/* 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,
@@ -387,7 +387,7 @@ void ast_http_send(struct ast_tcptls_session_instance *ser,
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));
}
@@ -404,7 +404,8 @@ void ast_http_send(struct ast_tcptls_session_instance *ser,
"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,
@@ -459,7 +460,7 @@ void ast_http_auth(struct ast_tcptls_session_instance *ser, const char *realm,
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,
@@ -481,7 +482,7 @@ void ast_http_auth(struct ast_tcptls_session_instance *ser, const char *realm,
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);
@@ -493,7 +494,7 @@ void ast_http_error(struct ast_tcptls_session_instance *ser, int status_code, co
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"