HTTP: For httpd server, need option to define server name for security purposes

Added a new config property [servername] to the http.conf file; updated the http server to use the new property when sending responses, for showing http status through the CLI and when reporting status through the 'httpstatus' webpage.

ASTERISK-24316 #close
Reported By: Andrew Nagy
Review: https://reviewboard.asterisk.org/r/4374/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@431471 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Ashley Sanders
2015-01-30 16:52:12 +00:00
parent 43dd42d8ae
commit 112d23c73e
3 changed files with 147 additions and 61 deletions

View File

@@ -200,6 +200,28 @@ void ast_http_send(struct ast_tcptls_session_instance *ser, enum ast_http_method
int status_code, const char *status_title, struct ast_str *http_header,
struct ast_str *out, int fd, unsigned int static_content);
/*!
* \brief Creates and sends a formatted http response message.
* \param ser TCP/TLS session object
* \param status_code HTTP response code (200/401/403/404/500)
* \param status_title English equivalent to the status_code parameter
* \param http_header_data The formatted text to use in the http header
* \param text Additional informational text to use in the
* response
*
* \note Function constructs response headers from the status_code, status_title and
* http_header_data parameters.
*
* The response body is created as HTML content, from the status_code,
* status_title, and the text parameters.
*
* The http_header_data parameter will be freed as a result of calling function.
*
* \since 13.2.0
*/
void ast_http_create_response(struct ast_tcptls_session_instance *ser, int status_code,
const char *status_title, struct ast_str *http_header_data, const char *text);
/*! \brief Send http "401 Unauthorized" response and close socket */
void ast_http_auth(struct ast_tcptls_session_instance *ser, const char *realm, const unsigned long nonce, const unsigned long opaque, int stale, const char *text);