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: https://origsvn.digium.com/svn/asterisk/trunk@309209 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
parent
ffe9e4acfc
commit
dc616cfe2c
15
main/http.c
15
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"
|
||||
|
|
Loading…
Reference in New Issue