diff --git a/src/config.c b/src/config.c index 4f5e108..92cd6a3 100644 --- a/src/config.c +++ b/src/config.c @@ -128,6 +128,7 @@ static int configure_http_request_ms(char *); static int configure_http_request_limit(char *); static int configure_http_body_disk_offload(char *); static int configure_http_body_disk_path(char *); +static int configure_http_server_version(char *); static int configure_validator(char *); static int configure_params(char *); static int configure_validate(char *); @@ -254,6 +255,7 @@ static struct { { "http_request_limit", configure_http_request_limit }, { "http_body_disk_offload", configure_http_body_disk_offload }, { "http_body_disk_path", configure_http_body_disk_path }, + { "http_server_version", configure_http_server_version }, { "websocket_maxframe", configure_websocket_maxframe }, { "websocket_timeout", configure_websocket_timeout }, #endif @@ -1291,6 +1293,14 @@ configure_http_body_disk_path(char *path) return (KORE_RESULT_OK); } +static int +configure_http_server_version(char *version) +{ + http_server_version(version); + + return (KORE_RESULT_OK); +} + static int configure_http_hsts_enable(char *option) { diff --git a/src/http.c b/src/http.c index 78ce822..616c648 100644 --- a/src/http.c +++ b/src/http.c @@ -185,12 +185,14 @@ http_init(void) header_buf = kore_buf_alloc(HTTP_HEADER_BUFSIZE); ckhdr_buf = kore_buf_alloc(HTTP_COOKIE_BUFSIZE); - l = snprintf(http_version, sizeof(http_version), - "server: kore (%s)\r\n", kore_version); - if (l == -1 || (size_t)l >= sizeof(http_version)) - fatal("http_init(): http_version buffer too small"); + if (!http_version_len) { + l = snprintf(http_version, sizeof(http_version), + "server: kore (%s)\r\n", kore_version); + if (l == -1 || (size_t)l >= sizeof(http_version)) + fatal("http_init(): http_version buffer too small"); - http_version_len = l; + http_version_len = l; + } prealloc = MIN((worker_max_connections / 10), 1000); kore_pool_init(&http_request_pool, "http_request_pool",