Instructions to set up a basic LAMP+SSH server environment
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
2.1 KiB

5 years ago
  1. Author: Pekka Helenius (~Fincer), 2018
  2. Patch: Implements 'ServerTokens None' to Apache2/httpd Hypertext Transfer Protocol Server
  3. Makes it possible to remove 'Server:' tag from HTTP header
  4. --- a/server/core.c
  5. +++ b/server/core.c
  6. @@ -3373,7 +3373,8 @@
  7. SrvTk_MINIMAL, /* eg: Apache/2.0.41 */
  8. SrvTk_OS, /* eg: Apache/2.0.41 (UNIX) */
  9. SrvTk_FULL, /* eg: Apache/2.0.41 (UNIX) PHP/4.2.2 FooBar/1.2b */
  10. - SrvTk_PRODUCT_ONLY /* eg: Apache */
  11. + SrvTk_PRODUCT_ONLY, /* eg: Apache */
  12. + SrvTk_NONE /* Returns nothing */
  13. };
  14. static enum server_token_type ap_server_tokens = SrvTk_FULL;
  15. @@ -3440,6 +3441,9 @@
  16. if (ap_server_tokens == SrvTk_PRODUCT_ONLY) {
  17. ap_add_version_component(pconf, AP_SERVER_BASEPRODUCT);
  18. }
  19. + else if (ap_server_tokens == SrvTk_NONE) {
  20. + ap_add_version_component(pconf, "");
  21. + }
  22. else if (ap_server_tokens == SrvTk_MINIMAL) {
  23. ap_add_version_component(pconf, AP_SERVER_BASEVERSION);
  24. }
  25. @@ -3487,11 +3491,14 @@
  26. else if (!strcasecmp(arg, "Prod") || !strcasecmp(arg, "ProductOnly")) {
  27. ap_server_tokens = SrvTk_PRODUCT_ONLY;
  28. }
  29. + else if (!strcasecmp(arg, "None")) {
  30. + ap_server_tokens = SrvTk_NONE;
  31. + }
  32. else if (!strcasecmp(arg, "Full")) {
  33. ap_server_tokens = SrvTk_FULL;
  34. }
  35. else {
  36. - return "ServerTokens takes 1 argument: 'Prod(uctOnly)', 'Major', 'Minor', 'Min(imal)', 'OS', or 'Full'";
  37. + return "ServerTokens takes 1 argument: 'Prod(uctOnly)', 'Major', 'Minor', 'Min(imal)', 'OS', 'Full' or 'None'";
  38. }
  39. return NULL;
  40. @@ -4369,7 +4376,7 @@
  41. "A numeric IP address:port, or the name of a host"),
  42. AP_INIT_TAKE1("ServerTokens", set_serv_tokens, NULL, RSRC_CONF,
  43. "Determine tokens displayed in the Server: header - Min(imal), "
  44. - "Major, Minor, Prod(uctOnly), OS, or Full"),
  45. + "Major, Minor, Prod(uctOnly), OS, Full or None"),
  46. AP_INIT_TAKE1("LimitRequestLine", set_limit_req_line, NULL, RSRC_CONF,
  47. "Limit on maximum size of an HTTP request line"),
  48. AP_INIT_TAKE1("LimitRequestFieldsize", set_limit_req_fieldsize, NULL,