|
|
- Author: Pekka Helenius (~Fincer), 2018
-
- Patch: Implements 'ServerTokens None' to Apache2/httpd Hypertext Transfer Protocol Server
- Makes it possible to remove 'Server:' tag from HTTP header
-
- --- a/server/core.c
- +++ b/server/core.c
- @@ -3373,7 +3373,8 @@
- SrvTk_MINIMAL, /* eg: Apache/2.0.41 */
- SrvTk_OS, /* eg: Apache/2.0.41 (UNIX) */
- SrvTk_FULL, /* eg: Apache/2.0.41 (UNIX) PHP/4.2.2 FooBar/1.2b */
- - SrvTk_PRODUCT_ONLY /* eg: Apache */
- + SrvTk_PRODUCT_ONLY, /* eg: Apache */
- + SrvTk_NONE /* Returns nothing */
- };
- static enum server_token_type ap_server_tokens = SrvTk_FULL;
-
- @@ -3440,6 +3441,9 @@
- if (ap_server_tokens == SrvTk_PRODUCT_ONLY) {
- ap_add_version_component(pconf, AP_SERVER_BASEPRODUCT);
- }
- + else if (ap_server_tokens == SrvTk_NONE) {
- + ap_add_version_component(pconf, "");
- + }
- else if (ap_server_tokens == SrvTk_MINIMAL) {
- ap_add_version_component(pconf, AP_SERVER_BASEVERSION);
- }
- @@ -3487,11 +3491,14 @@
- else if (!strcasecmp(arg, "Prod") || !strcasecmp(arg, "ProductOnly")) {
- ap_server_tokens = SrvTk_PRODUCT_ONLY;
- }
- + else if (!strcasecmp(arg, "None")) {
- + ap_server_tokens = SrvTk_NONE;
- + }
- else if (!strcasecmp(arg, "Full")) {
- ap_server_tokens = SrvTk_FULL;
- }
- else {
- - return "ServerTokens takes 1 argument: 'Prod(uctOnly)', 'Major', 'Minor', 'Min(imal)', 'OS', or 'Full'";
- + return "ServerTokens takes 1 argument: 'Prod(uctOnly)', 'Major', 'Minor', 'Min(imal)', 'OS', 'Full' or 'None'";
- }
-
- return NULL;
- @@ -4369,7 +4376,7 @@
- "A numeric IP address:port, or the name of a host"),
- AP_INIT_TAKE1("ServerTokens", set_serv_tokens, NULL, RSRC_CONF,
- "Determine tokens displayed in the Server: header - Min(imal), "
- - "Major, Minor, Prod(uctOnly), OS, or Full"),
- + "Major, Minor, Prod(uctOnly), OS, Full or None"),
- AP_INIT_TAKE1("LimitRequestLine", set_limit_req_line, NULL, RSRC_CONF,
- "Limit on maximum size of an HTTP request line"),
- AP_INIT_TAKE1("LimitRequestFieldsize", set_limit_req_fieldsize, NULL,
|