diff --git a/configs/samples/http.conf.sample b/configs/samples/http.conf.sample index 1920a1c920..bd9794c5a9 100644 --- a/configs/samples/http.conf.sample +++ b/configs/samples/http.conf.sample @@ -69,9 +69,9 @@ bindaddr=127.0.0.1 ; ; Whether Asterisk should serve a status page showing the running ; configuration of this built-in HTTP server. -; Default is yes. +; Default is no. ; -;enable_status=no +;enable_status=yes ; ; Redirect one URI to another. This is how you would set a ; default page. diff --git a/main/http.c b/main/http.c index 38aa5654c8..9d7ae3d6aa 100644 --- a/main/http.c +++ b/main/http.c @@ -381,6 +381,34 @@ out403: return 0; } +static void str_append_escaped(struct ast_str **str, const char *in) +{ + const char *cur = in; + + while(*cur) { + switch (*cur) { + case '<': + ast_str_append(str, 0, "<"); + break; + case '>': + ast_str_append(str, 0, ">"); + break; + case '&': + ast_str_append(str, 0, "&"); + break; + case '"': + ast_str_append(str, 0, """); + break; + default: + ast_str_append(str, 0, "%c", *cur); + break; + } + cur++; + } + + return; +} + static int httpstatus_callback(struct ast_tcptls_session_instance *ser, const struct ast_http_uri *urih, const char *uri, enum ast_http_method method, struct ast_variable *get_vars, @@ -419,13 +447,21 @@ static int httpstatus_callback(struct ast_tcptls_session_instance *ser, } ast_str_append(&out, 0, "