Commit 1299d611 authored by Deomid Ryabkov's avatar Deomid Ryabkov Committed by Cesanta Bot

Add MG_HIDE_SERVER_INFO

Closes https://github.com/cesanta/mos-libs/pull/2

CL: Add MG_HIDE_SERVER_INFO

PUBLISHED_FROM=ed8a5b65f1c8238df414cd1c1f8bb1f579082f55
parent 244ff92e
...@@ -6872,8 +6872,11 @@ const char *mg_status_message(int status_code) { ...@@ -6872,8 +6872,11 @@ const char *mg_status_message(int status_code) {
void mg_send_response_line_s(struct mg_connection *nc, int status_code, void mg_send_response_line_s(struct mg_connection *nc, int status_code,
const struct mg_str extra_headers) { const struct mg_str extra_headers) {
mg_printf(nc, "HTTP/1.1 %d %s\r\nServer: %s\r\n", status_code, mg_printf(nc, "HTTP/1.1 %d %s\r\n", status_code,
mg_status_message(status_code), mg_version_header); mg_status_message(status_code));
#ifndef MG_HIDE_SERVER_INFO
mg_printf(nc, "Server: %s\r\n", mg_version_header);
#endif
if (extra_headers.len > 0) { if (extra_headers.len > 0) {
mg_printf(nc, "%.*s\r\n", (int) extra_headers.len, extra_headers.p); mg_printf(nc, "%.*s\r\n", (int) extra_headers.len, extra_headers.p);
} }
......
...@@ -1311,8 +1311,11 @@ const char *mg_status_message(int status_code) { ...@@ -1311,8 +1311,11 @@ const char *mg_status_message(int status_code) {
void mg_send_response_line_s(struct mg_connection *nc, int status_code, void mg_send_response_line_s(struct mg_connection *nc, int status_code,
const struct mg_str extra_headers) { const struct mg_str extra_headers) {
mg_printf(nc, "HTTP/1.1 %d %s\r\nServer: %s\r\n", status_code, mg_printf(nc, "HTTP/1.1 %d %s\r\n", status_code,
mg_status_message(status_code), mg_version_header); mg_status_message(status_code));
#ifndef MG_HIDE_SERVER_INFO
mg_printf(nc, "Server: %s\r\n", mg_version_header);
#endif
if (extra_headers.len > 0) { if (extra_headers.len > 0) {
mg_printf(nc, "%.*s\r\n", (int) extra_headers.len, extra_headers.p); mg_printf(nc, "%.*s\r\n", (int) extra_headers.len, extra_headers.p);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment