You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2015/06/15 23:31:13 UTC

[1/4] trafficserver git commit: TS-3170 Remove / rename the configurations around PAC files

Repository: trafficserver
Updated Branches:
  refs/heads/master eff2e4a11 -> 78143684b


TS-3170 Remove / rename the configurations around PAC files


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/5abcec70
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/5abcec70
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/5abcec70

Branch: refs/heads/master
Commit: 5abcec70ec4f593bfadd17f8e7935001fedfd11a
Parents: f84df26
Author: Leif Hedstrom <zw...@apache.org>
Authored: Wed Jun 10 17:21:02 2015 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Mon Jun 15 13:04:54 2015 -0600

----------------------------------------------------------------------
 cmd/traffic_cop/traffic_cop.cc                  |  6 +-
 cmd/traffic_manager/MgmtHandlers.cc             |  2 +-
 doc/admin/explicit-proxy-caching.en.rst         | 11 ----
 doc/admin/forward-proxy.en.rst                  |  6 --
 .../admin/explicit-proxy-caching.en.po          |  4 +-
 .../ja/LC_MESSAGES/admin/forward-proxy.en.po    | 11 ----
 .../configuration/records.config.en.rst         | 27 +-------
 lib/perl/lib/Apache/TS/AdminClient.pm           |  4 +-
 mgmt/RecordsConfig.cc                           | 10 +--
 proxy/ReverseProxy.cc                           | 13 +---
 proxy/http/HttpConfig.cc                        |  4 +-
 proxy/http/HttpConfig.h                         |  4 +-
 proxy/http/HttpTransact.cc                      |  2 +-
 proxy/http/remap/UrlRewrite.cc                  | 67 ++------------------
 proxy/http/remap/UrlRewrite.h                   |  8 +--
 15 files changed, 26 insertions(+), 153 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5abcec70/cmd/traffic_cop/traffic_cop.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_cop/traffic_cop.cc b/cmd/traffic_cop/traffic_cop.cc
index 7adf89f..13c648b 100644
--- a/cmd/traffic_cop/traffic_cop.cc
+++ b/cmd/traffic_cop/traffic_cop.cc
@@ -92,7 +92,7 @@ static char manager_options[OPTIONS_LEN_MAX] = "";
 
 static char log_file[PATH_NAME_MAX] = "traffic.out";
 
-static int autoconf_port = 8083;
+static int synthetic_port = 8083;
 static int rs_port = 8088;
 static MgmtClusterType cluster_type = NO_CLUSTER;
 static int http_backdoor_port = 8084;
@@ -651,7 +651,7 @@ config_reload_records()
   Layout::relative_to(log_file, sizeof(log_file), logdir, log_filename);
 
   config_read_int("proxy.config.process_manager.mgmt_port", &http_backdoor_port, true);
-  config_read_int("proxy.config.admin.autoconf_port", &autoconf_port, true);
+  config_read_int("proxy.config.admin.synthetic_port", &synthetic_port, true);
   config_read_int("proxy.config.cluster.rsport", &rs_port, true);
   config_read_int("proxy.config.lm.sem_id", &sem_id, true);
   config_read_int("proxy.config.cop.init_sleep_time", &init_sleep_time, true);
@@ -1283,7 +1283,7 @@ test_server_http_port()
 
   // Generate a request for a the 'synthetic.txt' document the manager
   // servers up on the autoconf port.
-  snprintf(request, sizeof(request), "GET http://127.0.0.1:%d/synthetic.txt HTTP/1.0\r\n\r\n", autoconf_port);
+  snprintf(request, sizeof(request), "GET http://127.0.0.1:%d/synthetic.txt HTTP/1.0\r\n\r\n", synthetic_port);
 
   return test_http_port(http_backdoor_port, request, server_timeout * 1000, localhost, localhost);
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5abcec70/cmd/traffic_manager/MgmtHandlers.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_manager/MgmtHandlers.cc b/cmd/traffic_manager/MgmtHandlers.cc
index 8cb42f2..2db9459 100644
--- a/cmd/traffic_manager/MgmtHandlers.cc
+++ b/cmd/traffic_manager/MgmtHandlers.cc
@@ -232,7 +232,7 @@ mgmt_synthetic_main(void *)
   if (aconf_port_arg > 0) {
     publicPort = aconf_port_arg;
   } else {
-    found = (RecGetRecordInt("proxy.config.admin.autoconf_port", &tempInt) == REC_ERR_OKAY);
+    found = (RecGetRecordInt("proxy.config.admin.synthetic_port", &tempInt) == REC_ERR_OKAY);
     ink_release_assert(found);
     publicPort = (int)tempInt;
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5abcec70/doc/admin/explicit-proxy-caching.en.rst
----------------------------------------------------------------------
diff --git a/doc/admin/explicit-proxy-caching.en.rst b/doc/admin/explicit-proxy-caching.en.rst
index 86dd503..3608536 100644
--- a/doc/admin/explicit-proxy-caching.en.rst
+++ b/doc/admin/explicit-proxy-caching.en.rst
@@ -63,17 +63,6 @@ specify (in their browser settings) the URL from which the PAC file is
 loaded. You can store a PAC file on Traffic Server (or on any server in
 your network) and then provide the URL for this file to your clients.
 
-If you want to store a PAC file on the Traffic Server system, you
-must perform the following configuration:
-
--  Either copy an existing PAC file into the Traffic Server ``config``
-   directory or enter a script that defines the proxy server
-   configuration settings in the ``proxy.pac`` file provided. The file
-   is empty by default. A sample script is provided in `Sample PAC
-   File`_.
--  Specify the port Traffic Server uses to serve the PAC file. The
-   default port is 8083, see :ts:cv:`proxy.config.admin.autoconf_port`.
-
 Sample PAC File
 ---------------
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5abcec70/doc/admin/forward-proxy.en.rst
----------------------------------------------------------------------
diff --git a/doc/admin/forward-proxy.en.rst b/doc/admin/forward-proxy.en.rst
index 8420b1b..cee8ba6 100644
--- a/doc/admin/forward-proxy.en.rst
+++ b/doc/admin/forward-proxy.en.rst
@@ -103,12 +103,6 @@ Clients may be configured to use the default ``8080`` port on your Traffic Serve
 host as a proxy. This will result in all requests from that client browser being
 issued through the single forward proxy as configured.
 
-Alternatively, you may configure clients to use the more dynamic
-:ts:cv:`proxy.config.url_remap.default_to_server_pac` port, which will deliver a
-Javascript based PAC configuration to the client. This permits you to configure
-rules on which proxy servers are used for various types of requests, or to allow
-some requests to bypass proxies all together.
-
 Security Considerations
 =======================
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5abcec70/doc/locale/ja/LC_MESSAGES/admin/explicit-proxy-caching.en.po
----------------------------------------------------------------------
diff --git a/doc/locale/ja/LC_MESSAGES/admin/explicit-proxy-caching.en.po b/doc/locale/ja/LC_MESSAGES/admin/explicit-proxy-caching.en.po
index 5c02c63..cda9a04 100644
--- a/doc/locale/ja/LC_MESSAGES/admin/explicit-proxy-caching.en.po
+++ b/doc/locale/ja/LC_MESSAGES/admin/explicit-proxy-caching.en.po
@@ -106,8 +106,8 @@ msgstr ""
 
 #: ../../admin/explicit-proxy-caching.en.rst:74
 msgid ""
-"Specify the port Traffic Server uses to serve the PAC file. The default "
-"port is 8083, see :ts:cv:`proxy.config.admin.autoconf_port`."
+"Specify the port Traffic Server uses to serve the its synthetic healthchecks. The default "
+"port is 8083, see :ts:cv:`proxy.config.admin.synthetic_port`."
 msgstr ""
 
 #: ../../admin/explicit-proxy-caching.en.rst:78

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5abcec70/doc/locale/ja/LC_MESSAGES/admin/forward-proxy.en.po
----------------------------------------------------------------------
diff --git a/doc/locale/ja/LC_MESSAGES/admin/forward-proxy.en.po b/doc/locale/ja/LC_MESSAGES/admin/forward-proxy.en.po
index fa6bbf1..0add7b7 100644
--- a/doc/locale/ja/LC_MESSAGES/admin/forward-proxy.en.po
+++ b/doc/locale/ja/LC_MESSAGES/admin/forward-proxy.en.po
@@ -69,17 +69,6 @@ msgstr ""
 msgid "This request, then is translated by the proxy to::"
 msgstr "このリクエストはプロキシーによって次のように変換されます。::"
 
-#: ../../admin/forward-proxy.en.rst:44
-msgid ""
-"Apache Traffic Server offers two ways to User Agents: They can either be "
-"pointed directly to the default ``8080`` port. Alternatively, they can be "
-"pointed to the more dynamic :ts:cv:`proxy.config.url_remap."
-"default_to_server_pac`"
-msgstr ""
-"Apache Traffic Server はユーザーエージェントに二通りの方法を提供します。どち"
-"らもデフォルトの ``8080`` ポートを直接指定できます。あるいは、より動的にも指"
-"定できます。:ts:cv:`proxy.config.url_remap.default_to_server_pac`"
-
 #: ../../admin/forward-proxy.en.rst:48
 msgid ""
 "This port will then serve a JavaScript like configuration that User Agents "

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5abcec70/doc/reference/configuration/records.config.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/configuration/records.config.en.rst b/doc/reference/configuration/records.config.en.rst
index 70d5967..c027d35 100644
--- a/doc/reference/configuration/records.config.en.rst
+++ b/doc/reference/configuration/records.config.en.rst
@@ -417,9 +417,9 @@ Local Manager
 
    The semaphore ID for the local manager.
 
-.. ts:cv:: CONFIG proxy.config.admin.autoconf_port INT 8083
+.. ts:cv:: CONFIG proxy.config.admin.synthetic_port INT 8083
 
-   The autoconfiguration port.
+   The synthetic healthcheck port.
 
 .. ts:cv:: CONFIG proxy.config.admin.number_config_bak INT 3
 
@@ -2283,29 +2283,6 @@ URL Remap Rules
 
    Sets the name of the :file:`remap.config` file.
 
-.. ts:cv:: CONFIG proxy.config.url_remap.default_to_server_pac INT 0
-   :reloadable:
-
-   Enables (``1``) or disables (``0``) requests for a PAC file on the proxy
-   service port (8080 by default) to be redirected to the PAC
-   port. For this type of redirection to work, the variable
-   `proxy.config.reverse_proxy.enabled`_ must be set to ``1``.
-
-.. ts:cv:: CONFIG proxy.config.url_remap.default_to_server_pac_port INT -1
-   :reloadable:
-
-   Sets the PAC port so that PAC requests made to the Traffic Server
-   proxy service port are redirected this port. ``-1`` is the default
-   setting that sets the PAC port to the autoconfiguration port (the
-   default autoconfiguration port is 8083). This variable can be used
-   together with the `proxy.config.url_remap.default_to_server_pac`_
-   variable to get a PAC file from a different port. You must create
-   and run a process that serves a PAC file on this port. For example:
-   if you create a Perl script that listens on port 9000 and writes a
-   PAC file in response to any request, then you can set this variable
-   to ``9000``. Browsers that request the PAC file from a proxy server
-   on port 8080 will get the PAC file served by the Perl script.
-
 .. ts:cv:: CONFIG proxy.config.url_remap.remap_required INT 1
    :reloadable:
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5abcec70/lib/perl/lib/Apache/TS/AdminClient.pm
----------------------------------------------------------------------
diff --git a/lib/perl/lib/Apache/TS/AdminClient.pm b/lib/perl/lib/Apache/TS/AdminClient.pm
index 6dd8a6f..56c0c0c 100644
--- a/lib/perl/lib/Apache/TS/AdminClient.pm
+++ b/lib/perl/lib/Apache/TS/AdminClient.pm
@@ -310,7 +310,7 @@ The Apache Traffic Server Administration Manual will explain what these strings
  proxy.config.accept_threads
  proxy.config.task_threads
  proxy.config.admin.admin_user
- proxy.config.admin.autoconf_port
+ proxy.config.admin.synthetic_port
  proxy.config.admin.cli_path
  proxy.config.admin.number_config_bak
  proxy.config.admin.user_id
@@ -701,8 +701,6 @@ The Apache Traffic Server Administration Manual will explain what these strings
  proxy.config.udp.free_cancelled_pkts_sec
  proxy.config.udp.periodic_cleanup
  proxy.config.udp.send_retries
- proxy.config.url_remap.default_to_server_pac
- proxy.config.url_remap.default_to_server_pac_port
  proxy.config.url_remap.filename
  proxy.config.url_remap.pristine_host_hdr
  proxy.config.url_remap.remap_required

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5abcec70/mgmt/RecordsConfig.cc
----------------------------------------------------------------------
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index 7699d93..1ae8492 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -250,7 +250,9 @@ static const RecordElement RecordsConfig[] =
   ,
   {RECT_CONFIG, "proxy.config.cluster.log_bogus_mc_msgs", RECD_INT, "1", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
-  {RECT_CONFIG, "proxy.config.admin.autoconf_port", RECD_INT, "8083", RECU_RESTART_TM, RR_REQUIRED, RECC_INT, "[0-65535]", RECA_NULL}
+  {RECT_CONFIG, "proxy.config.admin.synthetic_port", RECD_INT, "8083", RECU_RESTART_TM, RR_REQUIRED, RECC_INT, "[0-65535]", RECA_NULL}
+  ,
+  {RECT_CONFIG, "proxy.config.admin.autoconf.localhost_only", RECD_INT, "1", RECU_RESTART_TM, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
   ,
   {RECT_CONFIG, "proxy.config.admin.admin_user", RECD_STRING, "admin", RECU_DYNAMIC, RR_REQUIRED, RECC_STR, ".+", RECA_NO_ACCESS}
   ,
@@ -1206,18 +1208,12 @@ static const RecordElement RecordsConfig[] =
   //##############################################################################
   {RECT_CONFIG, "proxy.config.reverse_proxy.enabled", RECD_INT, "1", RECU_DYNAMIC, RR_REQUIRED, RECC_INT, "[0-1]", RECA_NULL}
   ,
-  {RECT_CONFIG, "proxy.config.url_remap.default_to_server_pac", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_NULL, NULL, RECA_NULL}
-  ,
-  {RECT_CONFIG, "proxy.config.url_remap.default_to_server_pac_port", RECD_INT, "-1", RECU_DYNAMIC, RR_NULL, RECC_NULL, NULL, RECA_NULL}
-  ,
   {RECT_CONFIG, "proxy.config.url_remap.filename", RECD_STRING, "remap.config", RECU_DYNAMIC, RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
   {RECT_CONFIG, "proxy.config.url_remap.remap_required", RECD_INT, "1", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
   ,
   {RECT_CONFIG, "proxy.config.url_remap.pristine_host_hdr", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
   ,
-  {RECT_CONFIG, "proxy.config.url_remap.handle_backdoor_urls", RECD_INT, "0", RECU_RESTART_TS, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
-  ,
 
   //##############################################################################
   //#

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5abcec70/proxy/ReverseProxy.cc
----------------------------------------------------------------------
diff --git a/proxy/ReverseProxy.cc b/proxy/ReverseProxy.cc
index bd6b1e2..e16f917 100644
--- a/proxy/ReverseProxy.cc
+++ b/proxy/ReverseProxy.cc
@@ -56,10 +56,8 @@ remap_plugin_info *remap_pi_list; // We never reload the remap plugins, just app
 #define FILE_CHANGED 0
 #define REVERSE_CHANGED 1
 #define TSNAME_CHANGED 2
-#define AC_PORT_CHANGED 3
+#define SYNTH_PORT_CHANGED 3
 #define TRANS_CHANGED 4
-#define DEFAULT_TO_PAC_CHANGED 5
-#define DEFAULT_TO_PAC_PORT_CHANGED 7
 #define URL_REMAP_MODE_CHANGED 8
 #define HTTP_DEFAULT_REDIRECT_CHANGED 9
 
@@ -86,10 +84,7 @@ init_reverse_proxy()
   REC_RegisterConfigUpdateFunc("proxy.config.url_remap.filename", url_rewrite_CB, (void *)FILE_CHANGED);
   REC_RegisterConfigUpdateFunc("proxy.config.proxy_name", url_rewrite_CB, (void *)TSNAME_CHANGED);
   REC_RegisterConfigUpdateFunc("proxy.config.reverse_proxy.enabled", url_rewrite_CB, (void *)REVERSE_CHANGED);
-  REC_RegisterConfigUpdateFunc("proxy.config.admin.autoconf_port", url_rewrite_CB, (void *)AC_PORT_CHANGED);
-  REC_RegisterConfigUpdateFunc("proxy.config.url_remap.default_to_server_pac", url_rewrite_CB, (void *)DEFAULT_TO_PAC_CHANGED);
-  REC_RegisterConfigUpdateFunc("proxy.config.url_remap.default_to_server_pac_port", url_rewrite_CB,
-                               (void *)DEFAULT_TO_PAC_PORT_CHANGED);
+  REC_RegisterConfigUpdateFunc("proxy.config.admin.synthetic_port", url_rewrite_CB, (void *)SYNTH_PORT_CHANGED);
   REC_RegisterConfigUpdateFunc("proxy.config.http.referer_default_redirect", url_rewrite_CB, (void *)HTTP_DEFAULT_REDIRECT_CHANGED);
   return 0;
 }
@@ -183,14 +178,12 @@ url_rewrite_CB(const char * /* name ATS_UNUSED */, RecDataT /* data_type ATS_UNU
     break;
 
   case TSNAME_CHANGED:
-  case DEFAULT_TO_PAC_CHANGED:
-  case DEFAULT_TO_PAC_PORT_CHANGED:
   case FILE_CHANGED:
   case HTTP_DEFAULT_REDIRECT_CHANGED:
     eventProcessor.schedule_imm(new UR_UpdateContinuation(reconfig_mutex), ET_TASK);
     break;
 
-  case AC_PORT_CHANGED:
+  case SYNTH_PORT_CHANGED:
     // The AutoConf port does not current change on manager except at restart
     break;
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5abcec70/proxy/http/HttpConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
index 8aeb13a..2cd564f 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -1158,7 +1158,7 @@ HttpConfig::startup()
   HttpEstablishStaticConfigLongLong(c.post_copy_size, "proxy.config.http.post_copy_size");
 
   // Local Manager
-  HttpEstablishStaticConfigLongLong(c.autoconf_port, "proxy.config.admin.autoconf_port");
+  HttpEstablishStaticConfigLongLong(c.synthetic_port, "proxy.config.admin.synthetic_port");
 
   // Cluster time delta gets it own callback since it needs
   //  to use ink_atomic_swap
@@ -1415,7 +1415,7 @@ HttpConfig::reconfigure()
   params->post_copy_size = m_master.post_copy_size;
 
   // Local Manager
-  params->autoconf_port = m_master.autoconf_port;
+  params->synthetic_port = m_master.synthetic_port;
 
   m_id = configProcessor.set(m_id, params);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5abcec70/proxy/http/HttpConfig.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index 81b4dcb..52c4412 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -751,7 +751,7 @@ public:
   ////////////////////
   // Local Manager  //
   ////////////////////
-  MgmtInt autoconf_port;
+  MgmtInt synthetic_port;
 
 private:
   /////////////////////////////////////
@@ -853,7 +853,7 @@ inline HttpConfigParams::HttpConfigParams()
     cluster_time_delta(0), redirection_enabled(0), redirection_host_no_port(0), number_of_redirections(1), post_copy_size(2048),
     ignore_accept_mismatch(0), ignore_accept_language_mismatch(0), ignore_accept_encoding_mismatch(0),
     ignore_accept_charset_mismatch(0), send_100_continue_response(0), disallow_post_100_continue(0), parser_allow_non_http(1),
-    cache_open_write_fail_action(0), max_post_size(0), autoconf_port(0)
+    cache_open_write_fail_action(0), max_post_size(0), synthetic_port(0)
 {
 }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5abcec70/proxy/http/HttpTransact.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index cad0468..ca6338d 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -711,7 +711,7 @@ HttpTransact::StartRemapRequest(State *s)
 
   s->cop_test_page = (ptr_len_cmp(host, host_len, local_host_ip_str, sizeof(local_host_ip_str) - 1) == 0) &&
                      (ptr_len_cmp(path, path_len, syntxt, sizeof(syntxt) - 1) == 0) &&
-                     port == s->http_config_param->autoconf_port && s->method == HTTP_WKSIDX_GET &&
+                     port == s->http_config_param->synthetic_port && s->method == HTTP_WKSIDX_GET &&
                      s->orig_scheme == URL_WKSIDX_HTTP && ats_ip4_addr_cast(&s->client_info.addr.sa) == htonl(INADDR_LOOPBACK);
 
   //////////////////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5abcec70/proxy/http/remap/UrlRewrite.cc
----------------------------------------------------------------------
diff --git a/proxy/http/remap/UrlRewrite.cc b/proxy/http/remap/UrlRewrite.cc
index 4fcded9..0cf66f7 100644
--- a/proxy/http/remap/UrlRewrite.cc
+++ b/proxy/http/remap/UrlRewrite.cc
@@ -54,9 +54,9 @@ SetHomePageRedirectFlag(url_mapping *new_mapping, URL &new_to_url)
 // CTOR / DTOR for the UrlRewrite class.
 //
 UrlRewrite::UrlRewrite()
-  : nohost_rules(0), reverse_proxy(0), backdoor_enabled(0), mgmt_autoconf_port(0), default_to_pac(0), default_to_pac_port(0),
-    ts_name(NULL), http_default_redirect_url(NULL), num_rules_forward(0), num_rules_reverse(0), num_rules_redirect_permanent(0),
-    num_rules_redirect_temporary(0), num_rules_forward_with_recv_port(0), _valid(false)
+  : nohost_rules(0), reverse_proxy(0), mgmt_synthetic_port(0), ts_name(NULL), http_default_redirect_url(NULL), num_rules_forward(0),
+    num_rules_reverse(0), num_rules_redirect_permanent(0), num_rules_redirect_temporary(0), num_rules_forward_with_recv_port(0),
+    _valid(false)
 {
   ats_scoped_str config_file_path;
 
@@ -87,10 +87,7 @@ UrlRewrite::UrlRewrite()
   }
 
   REC_ReadConfigInteger(reverse_proxy, "proxy.config.reverse_proxy.enabled");
-  REC_ReadConfigInteger(mgmt_autoconf_port, "proxy.config.admin.autoconf_port");
-  REC_ReadConfigInteger(default_to_pac, "proxy.config.url_remap.default_to_server_pac");
-  REC_ReadConfigInteger(default_to_pac_port, "proxy.config.url_remap.default_to_server_pac_port");
-  REC_ReadConfigInteger(backdoor_enabled, "proxy.config.url_remap.handle_backdoor_urls");
+  REC_ReadConfigInteger(mgmt_synthetic_port, "proxy.config.admin.synthetic_port");
 
   if (0 == this->BuildTable(config_file_path)) {
     _valid = true;
@@ -125,35 +122,6 @@ UrlRewrite::SetReverseFlag(int flag)
 }
 
 /**
-  Allocaites via new, and setups the default mapping to the PAC generator
-  port which is used to serve the PAC (proxy autoconfig) file.
-
-*/
-url_mapping *
-UrlRewrite::SetupPacMapping()
-{
-  const char *from_url = "http:///";
-  const char *local_url = "http://127.0.0.1/";
-
-  url_mapping *mapping;
-  int pac_generator_port;
-
-  mapping = new url_mapping;
-
-  mapping->fromURL.create(NULL);
-  mapping->fromURL.parse(from_url, strlen(from_url));
-
-  mapping->toUrl.create(NULL);
-  mapping->toUrl.parse(local_url, strlen(local_url));
-
-  pac_generator_port = (default_to_pac_port < 0) ? mgmt_autoconf_port : default_to_pac_port;
-
-  mapping->toUrl.port_set(pac_generator_port);
-
-  return mapping;
-}
-
-/**
   Allocaites via new, and adds a mapping like this map /ink/rh
   http://{backdoor}/ink/rh
 
@@ -697,7 +665,6 @@ int
 UrlRewrite::BuildTable(const char *path)
 {
   BUILD_TABLE_INFO bti;
-  url_mapping *new_mapping = NULL;
 
   ink_assert(forward_mappings.empty());
   ink_assert(reverse_mappings.empty());
@@ -710,7 +677,6 @@ UrlRewrite::BuildTable(const char *path)
   ink_assert(num_rules_redirect_temporary == 0);
   ink_assert(num_rules_forward_with_recv_port == 0);
 
-
   forward_mappings.hash_lookup = ink_hash_table_create(InkHashTableKeyType_String);
   reverse_mappings.hash_lookup = ink_hash_table_create(InkHashTableKeyType_String);
   permanent_redirects.hash_lookup = ink_hash_table_create(InkHashTableKeyType_String);
@@ -722,31 +688,6 @@ UrlRewrite::BuildTable(const char *path)
     return 3;
   }
 
-  // Add the mapping for backdoor urls if enabled.
-  // This needs to be before the default PAC mapping for ""
-  // since this is more specific
-  if (unlikely(backdoor_enabled)) {
-    new_mapping = SetupBackdoorMapping();
-    if (TableInsert(forward_mappings.hash_lookup, new_mapping, "")) {
-      num_rules_forward++;
-    } else {
-      Warning("Could not insert backdoor mapping into store");
-      delete new_mapping;
-      return 3;
-    }
-  }
-  // Add the default mapping to the manager PAC file
-  //  if we need it
-  if (default_to_pac) {
-    new_mapping = SetupPacMapping();
-    if (TableInsert(forward_mappings.hash_lookup, new_mapping, "")) {
-      num_rules_forward++;
-    } else {
-      Warning("Could not insert pac mapping into store");
-      delete new_mapping;
-      return 3;
-    }
-  }
   // Destroy unused tables
   if (num_rules_forward == 0) {
     forward_mappings.hash_lookup = ink_hash_table_destroy(forward_mappings.hash_lookup);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5abcec70/proxy/http/remap/UrlRewrite.h
----------------------------------------------------------------------
diff --git a/proxy/http/remap/UrlRewrite.h b/proxy/http/remap/UrlRewrite.h
index 240f252..0720915 100644
--- a/proxy/http/remap/UrlRewrite.h
+++ b/proxy/http/remap/UrlRewrite.h
@@ -106,7 +106,6 @@ public:
   };
 
   void PerformACLFiltering(HttpTransact::State *s, url_mapping *mapping);
-  url_mapping *SetupPacMapping(); // manager proxy-autconfig mapping
   url_mapping *SetupBackdoorMapping();
   void PrintStore(MappingsStore &store);
 
@@ -163,12 +162,9 @@ public:
 
   int nohost_rules;
   int reverse_proxy;
-  int backdoor_enabled;
 
-  // Vars for PAC mapping
-  int mgmt_autoconf_port;
-  int default_to_pac;
-  int default_to_pac_port;
+  // Vars for synthetic health checks
+  int mgmt_synthetic_port;
 
   char *ts_name; // Used to send redirects when no host info
 


[2/4] trafficserver git commit: TS-3170 First stab at cleaning out the mgmt web server stuff TS-3170 Remove all of web2, implement very basic server

Posted by zw...@apache.org.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/mgmt/web2/WebHttpContext.cc
----------------------------------------------------------------------
diff --git a/mgmt/web2/WebHttpContext.cc b/mgmt/web2/WebHttpContext.cc
deleted file mode 100644
index 63a3324..0000000
--- a/mgmt/web2/WebHttpContext.cc
+++ /dev/null
@@ -1,106 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-/************* ***************************
- *
- *  WebHttpContext.cc - the http web-ui transaction state
- *
- *
- ****************************************************************************/
-
-#include "ink_config.h"
-#include "WebHttpContext.h"
-
-//-------------------------------------------------------------------------
-// WebHttpContextCreate
-//
-// Wraps a WebHttpContext around a WebHttpConInfo and WebHttpConInfo's
-// internal WebContext.  Note that the returned WebHttpContext will
-// keep pointers into the WebHttpConInfo and WebContext structures.
-// Be careful not to delete/free the WebHttpConInfo or WebContext
-// before WebHttpContext is done with them.
-//-------------------------------------------------------------------------
-
-WebHttpContext *
-WebHttpContextCreate(WebHttpConInfo *whci)
-{
-  WebHttpContext *whc = (WebHttpContext *)ats_malloc(sizeof(WebHttpContext));
-
-  // memset to 0; note strings are zero'd too
-  memset(whc, 0, sizeof(WebHttpContext));
-
-  whc->request = new httpMessage();
-  whc->response_hdr = new httpResponse();
-  whc->response_bdy = new textBuffer(8192);
-  whc->submit_warn = new textBuffer(256);
-  whc->submit_note = new textBuffer(256);
-  whc->submit_warn_ht = ink_hash_table_create(InkHashTableKeyType_String);
-  whc->submit_note_ht = ink_hash_table_create(InkHashTableKeyType_String);
-  whc->si.fd = whci->fd;
-
-  // keep pointers into the context passed to us
-  whc->client_info = whci->clientInfo;
-  whc->default_file = whci->context->defaultFile;
-  whc->doc_root = whci->context->docRoot;
-  whc->doc_root_len = whci->context->docRootLen;
-
-  // set server_state
-  if (whci->context == &autoconfContext) {
-    whc->server_state |= WEB_HTTP_SERVER_STATE_AUTOCONF;
-  }
-
-  return whc;
-}
-
-//-------------------------------------------------------------------------
-// WebHttpContextDestroy
-//-------------------------------------------------------------------------
-
-void
-WebHttpContextDestroy(WebHttpContext *whc)
-{
-  if (whc) {
-    if (whc->request)
-      delete (whc->request);
-    if (whc->response_hdr)
-      delete (whc->response_hdr);
-    if (whc->response_bdy)
-      delete (whc->response_bdy);
-    if (whc->submit_warn)
-      delete (whc->submit_warn);
-    if (whc->submit_note)
-      delete (whc->submit_note);
-    if (whc->query_data_ht)
-      ink_hash_table_destroy_and_xfree_values(whc->query_data_ht);
-    if (whc->post_data_ht)
-      ink_hash_table_destroy_and_xfree_values(whc->post_data_ht);
-    if (whc->submit_warn_ht)
-      ink_hash_table_destroy(whc->submit_warn_ht);
-    if (whc->submit_note_ht)
-      ink_hash_table_destroy(whc->submit_note_ht);
-
-    ats_free(whc->top_level_render_file);
-    ats_free(whc->cache_query_result);
-    ats_free(whc);
-  }
-}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/mgmt/web2/WebHttpContext.h
----------------------------------------------------------------------
diff --git a/mgmt/web2/WebHttpContext.h b/mgmt/web2/WebHttpContext.h
deleted file mode 100644
index a73a35f..0000000
--- a/mgmt/web2/WebHttpContext.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-/************* ***************************
- *
- *  WebHttpContext.h - the http web-ui transaction state
- *
- *
- ****************************************************************************/
-
-#ifndef _WEB_HTTP_CONTEXT_H_
-#define _WEB_HTTP_CONTEXT_H_
-
-#include "ink_hash_table.h"
-#include "TextBuffer.h"
-
-#include "WebGlobals.h"
-#include "mgmtapi.h"
-#include "WebHttpMessage.h"
-#include "WebUtils.h"
-
-struct WebHttpContext {
-  uint32_t request_state;       // client request state
-  uint32_t server_state;        // bit-mask of enabled server features
-  httpMessage *request;         // client request
-  httpResponse *response_hdr;   // server response headers
-  textBuffer *response_bdy;     // server repsonse body
-  textBuffer *submit_warn;      // submit warn text
-  textBuffer *submit_note;      // submit info text
-  InkHashTable *query_data_ht;  // client query name/value hash-table
-  InkHashTable *post_data_ht;   // client POST name/value hash-table
-  InkHashTable *submit_warn_ht; // ht of warn submission records
-  InkHashTable *submit_note_ht; // ht of info submission records
-  sockaddr_in *client_info;     // client conection information
-  SocketInfo si;                // socket information
-
-  char *top_level_render_file; // top-level file to render
-  char *cache_query_result;    // cache inspector query result
-
-  const char *default_file; // default file
-  const char *doc_root;     // document root
-  int doc_root_len;         // length of doc_root
-};
-
-WebHttpContext *WebHttpContextCreate(WebHttpConInfo *whci);
-void WebHttpContextDestroy(WebHttpContext *whc);
-
-#endif // _WEB_HTTP_CONTEXT_H_

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/mgmt/web2/WebHttpMessage.cc
----------------------------------------------------------------------
diff --git a/mgmt/web2/WebHttpMessage.cc b/mgmt/web2/WebHttpMessage.cc
deleted file mode 100644
index ee16cff..0000000
--- a/mgmt/web2/WebHttpMessage.cc
+++ /dev/null
@@ -1,513 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-#include "ink_platform.h"
-#include "ink_defs.h"
-#include "ink_string.h"
-#include "ink_time.h"
-#include "ink_memory.h"
-
-#include "WebUtils.h"
-#include "WebHttpMessage.h"
-#include "TextBuffer.h"
-#include "MIME.h"
-#include "I_Version.h"
-
-/****************************************************************************
- *
- *  WebHttpMessage.cc - classes to store information about incoming requests
- *                        and create hdrs for outgoing requests
- *
- *
- *
- ****************************************************************************/
-
-const char *const httpStatStr[] = {
-  "100 Continue\r\n", "101 Switching Protocols\r\n", "200 OK\r\n", "201 Created\r\n", "202 Accepted\r\n",
-  "203 Non-Authorative Information\r\n", "204 No Content\r\n", "205 Reset Content\r\n", "206 Partial Content\r\n",
-  "300 Multiple Choices\r\n", "301 Moved Permanently\r\n", "302 Moved Temporarily\r\n", "303 See Other\r\n", "304 Not Modified\r\n",
-  "305 Use Proxy\r\n", "400 Bad Request\r\n", "401 Unauthorized\r\n", "402 Payment Required\r\n", "403 Forbidden\r\n",
-  "404 Not Found\r\n", "500 Internal Server Error\r\n", "501 Not Implemented\r\n", "502 Bad Gateway\r\n",
-  "503 Service Unvailable\r\n", "504 Gateway Timeout\r\n", "505 HTTP Version Not Supported\r\n"};
-
-const char *const httpStatCode[] = {"100", "101", "200", "201", "202", "203", "204", "205", "206", "300", "301", "302", "303",
-                                    "304", "305", "400", "401", "402", "403", "404", "500", "501", "502", "503", "504", "505"};
-
-const char *const contentTypeStr[] = {"text/plain", "text/html", "text/css", "text/unknown", "image/gif", "image/jpeg", "image/png",
-                                      "application/java-vm", "application/x-javascript", "application/x-x509-ca-cert",
-                                      "application/x-ns-proxy-autoconfig", "application/zip"};
-
-
-// httpMessage::httpMessage()
-//
-httpMessage::httpMessage()
-{
-  method = METHOD_NONE;
-  header = NULL;
-  body = NULL;
-  scheme = SCHEME_NONE;
-  file = NULL;
-  query = NULL;
-  conLen = -1;
-  referer = NULL;
-  conType_str = NULL;
-  authMessage = NULL;
-  parser = new Tokenizer(" \t\n\r");
-  modificationTime = -1;
-  modContentLength = -1;
-  client_request = NULL;
-}
-
-void
-httpMessage::getLogInfo(const char **request)
-{
-  *request = client_request;
-}
-
-// returns zero if everything was OK or non-zero if
-// the request was malformed
-int
-httpMessage::addRequestLine(char *request)
-{
-  const char *method_str;
-  const char *scheme_str;
-  const char *URI;
-  char *tmp;
-  int requestLen;
-
-  // Make a copy of the string so that we
-  //   log it later
-  client_request = ats_strdup(request);
-  requestLen = strlen(client_request);
-  if (requestLen > 0 && client_request[requestLen - 1] == '\r') {
-    client_request[requestLen - 1] = '\0';
-  }
-
-  parser->Initialize(request, SHARE_TOKS);
-  method_str = (*parser)[0];
-  URI = (*parser)[1];
-  scheme_str = (*parser)[2];
-
-  // Check for an empty request
-  if (method_str == NULL) {
-    return 1;
-  }
-  // Determine Method
-  if (strcmp(method_str, "GET") == 0) {
-    method = METHOD_GET;
-  } else if (strcmp(method_str, "POST") == 0) {
-    method = METHOD_POST;
-  } else if (strcmp(method_str, "HEAD") == 0) {
-    method = METHOD_HEAD;
-  } else {
-    method = METHOD_NONE;
-  }
-
-  if (URI == NULL) {
-    return 1;
-  }
-  // Get the scheme
-  //
-  //  We only understand HTTP/1.0
-  //
-  //  If a browser asks for HTTP, we send back 1.0
-  //  If there is no scheme, assume HTTP
-  //  If there is another scheme, mark it unknown
-  //
-  if (scheme_str == NULL) {
-    scheme = SCHEME_NONE;
-  } else {
-    if (strncasecmp(scheme_str, "HTTP", 4) == 0) {
-      scheme = SCHEME_HTTP;
-    } else if (strncasecmp(scheme_str, "SHTTP", 5) == 0) {
-      scheme = SCHEME_SHTTP;
-    } else {
-      scheme = SCHEME_UNKNOWN;
-    }
-  }
-
-  // Now sort out the file verses query portion of the
-  // the request
-  //
-  // First check to see if the client sent us a full URL
-  if (strncmp("http://", URI, 7) == 0) {
-    URI = strstr(URI + 7, "/");
-    if (URI == NULL) {
-      return 1;
-    }
-  }
-  // Now allocate space for the document path portion
-  //  of the URI along with the query if any
-  unsigned int amtToAllocate = strlen(URI) + 1;
-  file = new char[amtToAllocate];
-  ink_strlcpy(file, URI, amtToAllocate + 1);
-  tmp = strstr(file, "?");
-  if (tmp != NULL) {
-    // There is a form submission
-    *tmp = '\0';
-    query = tmp + 1;
-    // Remove trailing "\"
-    query[strlen(query)] = '\0';
-  }
-
-  return 0;
-}
-
-void
-httpMessage::addHeader(char *hdr)
-{
-  const char *authType;
-  const char *auth;
-  int len;
-  const char *hdrName;
-  const char *hdrArg1;
-
-  parser->Initialize(hdr, SHARE_TOKS);
-  hdrName = (*parser)[0];
-  hdrArg1 = (*parser)[1];
-
-  // All headers require at least tokens
-  if (hdrName == NULL || hdrArg1 == NULL) {
-    return;
-  }
-
-  if (strncasecmp("Content-length:", hdrName, 15) == 0) {
-    conLen = atoi(hdrArg1);
-  } else if (strncasecmp("Referer:", hdrName, 8) == 0) {
-    unsigned int amtToAllocate = strlen(hdrArg1);
-    referer = new char[amtToAllocate + 1];
-    ink_strlcpy(referer, hdrArg1, amtToAllocate + 1);
-  } else if (strncasecmp("Content-type:", hdrName, 13) == 0) {
-    unsigned int amtToAllocate = strlen(hdrArg1);
-    conType_str = new char[amtToAllocate + 1];
-    ink_strlcpy(conType_str, hdrArg1, amtToAllocate + 1);
-  } else if (strncasecmp("Authorization:", hdrName, 14) == 0) {
-    authType = hdrArg1;
-    if (strcmp(authType, "Basic") == 0) {
-      auth = (*parser)[2];
-      len = strlen(auth) + 1;
-      authMessage = new char[len];
-      ink_strlcpy(authMessage, auth, len);
-    }
-  } else if (strncasecmp("If-Modified-Since:", hdrName, 18) == 0) {
-    // Disabled due to thread safety issues
-    getModDate();
-  }
-}
-
-
-// httpMessage::getModDate()
-//
-//  A function to extract info from the If-Modified-Since http
-//   header.
-//
-//  Currently brokens since both strptime and mktime are not thread
-//   safe
-//
-void
-httpMessage::getModDate()
-{
-  // Since the dates have spaces in them, we have to recontruct
-  //   them.  Sigh.
-  int i = 1;
-  int numDateFields;
-  int dateSize = 0;
-  char *dateStr;
-  const char *clStr;
-  int tmpLen;
-  Tokenizer *equalTok = NULL;
-
-  // First, figure out the number of fields
-  for (i = 1; (*parser)[i] != NULL && strstr((*parser)[i++], ";") == NULL;)
-    ;
-  numDateFields = i - 1;
-
-  if (numDateFields > 0) {
-    // Next, figure out the size of the string we need
-    for (i = 0; i < numDateFields; i++) {
-      dateSize += strlen((*parser)[i + 1]);
-    }
-    dateStr = new char[dateSize + 1 + numDateFields];
-    *dateStr = '\0';
-
-    // Rebuild the date string from the parsed
-    //   stuff
-    for (i = 0; i < numDateFields; i++) {
-      ink_strlcat(dateStr, (*parser)[i + 1], dateSize + 1);
-      tmpLen = strlen(dateStr);
-      dateStr[tmpLen] = ' ';
-      dateStr[tmpLen + 1] = '\0';
-    }
-
-    // There could be junk of the end of array like a ;
-    tmpLen = strlen(dateStr);
-    while (!isalpha(dateStr[tmpLen])) {
-      dateStr[tmpLen] = '\0';
-      tmpLen--;
-    }
-
-    modificationTime = mime_parse_date(dateStr);
-    delete[] dateStr;
-
-    // Now figure out the content length from if modified
-    if (parser->count() > (unsigned)(numDateFields + 1)) {
-      clStr = (*parser)[numDateFields + 1];
-      equalTok = new Tokenizer("=\r\n");
-      equalTok->Initialize(clStr);
-      if (strcasecmp("length", (*equalTok)[0]) == 0) {
-        modContentLength = atoi((*equalTok)[1]);
-      }
-      delete equalTok;
-    }
-  }
-}
-
-// httpMessage::addRequestBody(int fd)
-//
-//  Read the request body of of the socket and make a local
-//     copy of the entire thing.  Return zero if all went ok
-//     or return -1 with there was an error
-int
-httpMessage::addRequestBody(SocketInfo socketD)
-{
-  char *nextRead;
-  int bytesRead = 0;
-  int readResult;
-
-  if (conLen < 0) {
-    return 0;
-  }
-
-  body = new char[conLen + 1];
-  nextRead = body;
-
-  while (bytesRead < conLen) {
-    readResult = socket_read(socketD, nextRead, conLen - bytesRead);
-
-    if (readResult <= 0) {
-      // There was an error on the read.
-      *nextRead = '\0';
-      return -1;
-    } else {
-      bytesRead += readResult;
-      nextRead += readResult;
-    }
-  }
-  *nextRead = '\0';
-  return 0;
-}
-
-httpMessage::~httpMessage()
-{
-  delete[] body;
-  delete[] file;
-  delete[] referer;
-  delete[] conType_str;
-  delete[] authMessage;
-
-  ats_free(client_request);
-  delete parser;
-}
-
-/* 01/14/99 elam -
- * Commented out because g++ is not happy with iostream.h
-void httpMessage::Print() {
-  cout << "Method: " << method << endl;
-  cout << "File: " << file << endl;
-  cout << "Query: " << query << endl;
-  cout << "Scheme: " << scheme << endl;
-  cout << "Content Length: " << conLen << endl;
-  cout << "First Header: " << header << endl;
-  cout << "Message Body: " << body << endl << endl;
-}
- */
-
-httpResponse::httpResponse()
-{
-  // Default is no refresh header;
-  refresh = -1;
-  conLen = -1;
-  conType = TEXT_HTML;
-  explicitConType = NULL;
-  refreshURL = NULL;
-  lastMod = -1;
-  authRealm = NULL;
-  dateResponse = NULL;
-  status = STATUS_INTERNAL_SERVER_ERROR;
-  locationURL = NULL;
-  cachable = 1;
-}
-
-httpResponse::~httpResponse()
-{
-  ats_free(explicitConType);
-  ats_free(authRealm);
-  ats_free(refreshURL);
-  ats_free(locationURL);
-  ats_free(dateResponse);
-}
-
-int
-httpResponse::writeHdr(SocketInfo socketD)
-{
-  const char versionStr[] = "HTTP/1.0 ";
-  const char serverStr[] = "Server: ";
-  const char managerStr[] = "Traffic Manager ";
-  const char noStoreStr[] = "Cache-Control: no-store\r\n";
-  const char noCacheStr[] = "Pragma: no-cache\r\n";
-  const char lenStr[] = "Content-length: ";
-  const char refreshStr[] = "Refresh: ";
-  const char authStr[] = "WWW-Authenticate: Basic realm=\"";
-  const char dateStr[] = "Date: ";
-  const char lastModStr[] = "Last-modified: ";
-  const char locationStr[] = "Location: ";
-  const char refreshURLStr[] = "; URL=";
-  time_t currentTime;
-  const int bufSize = 512;
-  char buffer[bufSize];
-  char *reply;
-  int bytesWritten;
-  textBuffer hdr(4096);
-
-  hdr.copyFrom(versionStr, strlen(versionStr));
-
-  // Record the status
-  hdr.copyFrom(httpStatStr[status], strlen(httpStatStr[status]));
-
-  // Record Server Name
-  hdr.copyFrom(serverStr, strlen(serverStr));
-  hdr.copyFrom(managerStr, strlen(managerStr));
-  // XXX hdr.copyFrom(appVersionInfo.VersionStr, strlen(appVersionInfo.VersionStr));
-  hdr.copyFrom("\r\n", 2);
-
-  // Record refresh
-  if (refresh >= 0) {
-    hdr.copyFrom(refreshStr, strlen(refreshStr));
-    snprintf(buffer, bufSize - 1, "%d", refresh);
-    hdr.copyFrom(buffer, strlen(buffer));
-    if (refreshURL != NULL) {
-      hdr.copyFrom(refreshURLStr, strlen(refreshURLStr));
-      hdr.copyFrom(refreshURL, strlen(refreshURL));
-    }
-    hdr.copyFrom("\r\n", 2);
-  }
-
-  // Location Header
-  if (locationURL != NULL) {
-    hdr.copyFrom(locationStr, strlen(locationStr));
-    hdr.copyFrom(locationURL, strlen(locationURL));
-    hdr.copyFrom("\r\n", 2);
-  }
-
-  // Always send the current time
-  currentTime = time(NULL);
-  mime_format_date(buffer, currentTime);
-  // We were able to genarate the date string
-  hdr.copyFrom(dateStr, strlen(dateStr));
-  hdr.copyFrom(buffer, strlen(buffer));
-  hdr.copyFrom("\r\n", 2);
-  dateResponse = ats_strdup(buffer);
-
-  // Not cachable if marked not cachable, or has no L-M date
-  if ((getCachable() == 0) || (lastMod == -1)) {
-    // Use "Control-Control: no-store" for HTTP 1.1
-    // compliant browsers.
-    hdr.copyFrom(noStoreStr, strlen(noStoreStr));
-    // For non-1.1 compliant browsers, we'll set
-    // "Pragma: no-cache" just to be safe
-    hdr.copyFrom(noCacheStr, strlen(noCacheStr));
-  } else if (lastMod != -1) {
-    // Send the last modified time if we have it
-    mime_format_date(buffer, lastMod);
-    // We were able to genarate the date string
-    hdr.copyFrom(lastModStr, strlen(lastModStr));
-    hdr.copyFrom(buffer, strlen(buffer));
-    hdr.copyFrom("\r\n", 2);
-  }
-
-  snprintf(buffer, sizeof(buffer), "Content-type: %s\r\n", contentTypeStr[conType]);
-  hdr.copyFrom(buffer, strlen(buffer));
-
-  // Issue an authentication challenge if we are
-  //  authorized
-  if (status == STATUS_UNAUTHORIZED) {
-    hdr.copyFrom(authStr, strlen(authStr));
-    hdr.copyFrom(authRealm, strlen(authRealm));
-    hdr.copyFrom("\"\r\n", 3);
-  }
-
-  if (conLen >= 0) {
-    hdr.copyFrom(lenStr, strlen(lenStr));
-    snprintf(buffer, sizeof(buffer), "%d", conLen);
-    hdr.copyFrom(buffer, strlen(buffer));
-    hdr.copyFrom("\r\n", 2);
-  }
-  // End of Header marked by empty line
-  hdr.copyFrom("\r\n", 2);
-
-  reply = hdr.bufPtr();
-  bytesWritten = socket_write(socketD, reply, strlen(reply));
-  return bytesWritten;
-}
-
-
-void
-httpResponse::setContentType(const char *str)
-{
-  if (str != NULL) {
-    explicitConType = ats_strdup(str);
-  }
-}
-
-void
-httpResponse::setRealm(const char *realm)
-{
-  if (realm != NULL) {
-    authRealm = ats_strdup(realm);
-  }
-}
-
-void
-httpResponse::setRefreshURL(const char *url)
-{
-  if (url != NULL) {
-    refreshURL = ats_strdup(url);
-  }
-}
-
-void
-httpResponse::setLocationURL(const char *url)
-{
-  if (url != NULL) {
-    locationURL = ats_strdup(url);
-  }
-}
-
-
-void
-httpResponse::getLogInfo(const char **date, HttpStatus_t *statusIn, int *length)
-{
-  *date = dateResponse;
-  *statusIn = status;
-  *length = conLen;
-}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/mgmt/web2/WebHttpMessage.h
----------------------------------------------------------------------
diff --git a/mgmt/web2/WebHttpMessage.h b/mgmt/web2/WebHttpMessage.h
deleted file mode 100644
index 9635d5b..0000000
--- a/mgmt/web2/WebHttpMessage.h
+++ /dev/null
@@ -1,307 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-#ifndef _WEB_HTTP_MESSAGE
-#define _WEB_HTTP_MESSAGE
-
-#include <time.h>
-#include "Tokenizer.h"
-#include "WebUtils.h"
-
-/****************************************************************************
- *
- *  WebHttpMessage.h - classes to store information about incoming requests
- *                        and create hdrs for outgoing requests
- *
- *
- *
- ****************************************************************************/
-
-/* define method       */
-enum Method_t {
-  METHOD_NONE = 0,
-  METHOD_OPTIONS,
-  METHOD_GET,
-  METHOD_HEAD,
-  METHOD_POST,
-  METHOD_PUT,
-  METHOD_DELETE,
-  METHOD_TRACE,
-  METHOD_CONNECT
-};
-
-/* defined http status codes constants */
-enum HttpStatus_t {
-  STATUS_CONTINUE = 0,
-  STATUS_SWITCHING_PROTOCOL,
-
-  STATUS_OK,
-  STATUS_CREATED,
-  STATUS_ACCEPTED,
-  STATUS_NON_AUTHORITATIVE_INFORMATION,
-  STATUS_NO_CONTENT,
-  STATUS_RESET_CONTENT,
-  STATUS_PARTIAL_CONTENT,
-
-  STATUS_MULTIPLE_CHOICES,
-  STATUS_MOVED_PERMANENTLY,
-  STATUS_MOVED_TEMPORARILY,
-  STATUS_SEE_OTHER,
-  STATUS_NOT_MODIFIED,
-  STATUS_USE_PROXY,
-
-  STATUS_BAD_REQUEST,
-  STATUS_UNAUTHORIZED,
-  STATUS_PAYMENT_REQUIRED,
-  STATUS_FORBIDDEN,
-  STATUS_NOT_FOUND,
-
-  STATUS_INTERNAL_SERVER_ERROR,
-  STATUS_NOT_IMPLEMENTED,
-  STATUS_BAD_GATEWAY,
-  STATUS_SERVICE_UNAVAILABLE,
-  STATUS_GATEWAY_TIMEOUT,
-  STATUS_HTTPVER_NOT_SUPPORTED
-};
-
-/* define scheme type */
-enum Scheme_t {
-  SCHEME_UNKNOWN = -1,
-  SCHEME_NONE = 0,
-  SCHEME_HTTP,
-  SCHEME_SHTTP,
-};
-
-enum Content_t {
-  TEXT_PLAIN = 0,
-  TEXT_HTML,
-  TEXT_CSS,
-  TEXT_UNKNOWN,
-  IMAGE_GIF,
-  IMAGE_JPEG,
-  IMAGE_PNG,
-  APP_JAVA,
-  APP_JAVASCRIPT,
-  APP_X509,
-  APP_AUTOCONFIG,
-  APP_ZIP
-};
-
-extern const char *const httpStatStr[];
-extern const char *const httpStatCode[];
-extern const char *const contentTypeStr[];
-
-class httpMessage
-{
-public:
-  httpMessage();
-  ~httpMessage();
-
-  Method_t
-  getMethod()
-  {
-    return method;
-  };
-  const char *
-  getFile()
-  {
-    return file;
-  };
-  const char *
-  getQuery()
-  {
-    return query;
-  };
-  Scheme_t
-  getScheme()
-  {
-    return scheme;
-  };
-  const char *
-  getHeader()
-  {
-    return header;
-  };
-  char *
-  getBody()
-  {
-    return body;
-  };
-  int
-  getConLen()
-  {
-    return conLen;
-  };
-  const char *
-  getReferer()
-  {
-    if (referer != NULL) {
-      return referer;
-    }
-    return NULL;
-  };
-  const char *
-  getContentType()
-  {
-    return conType_str;
-  };
-  const char *
-  getAuthMessage()
-  {
-    return authMessage;
-  };
-  time_t
-  getModTime()
-  {
-    return modificationTime;
-  };
-
-  int addRequestLine(char *);
-  void addHeader(char *);
-  int addRequestBody(SocketInfo socketD);
-
-  //  void Print();
-  void getLogInfo(const char **request);
-
-private:
-  httpMessage(const httpMessage &);
-  void getModDate();
-  Method_t method;
-  char *file;
-  // char* referer;
-  char *query;
-  Scheme_t scheme;
-  char *header;
-  char *body;
-  int conLen;
-  char *referer;
-  char *conType_str;
-  char *authMessage;
-  Tokenizer *parser;
-  time_t modificationTime;
-  int modContentLength;
-  char *client_request; // Request as the client sent it.  For logs
-};
-
-class httpResponse
-{
-public:
-  httpResponse();
-  ~httpResponse();
-
-  void
-  setContentType(Content_t ct)
-  {
-    conType = ct;
-  };
-  // If this method is called, it will override the content type
-  // stored in conType. Example: "Content-type: text/html\r\n".
-  void setContentType(const char *str);
-
-  void
-  setLength(int x)
-  {
-    conLen = x;
-  };
-  int
-  getLength()
-  {
-    return conLen;
-  };
-
-  void
-  setStatus(HttpStatus_t s)
-  {
-    status = s;
-  };
-  HttpStatus_t
-  getStatus()
-  {
-    return status;
-  };
-
-
-  void
-  setRefresh(int i)
-  {
-    refresh = i;
-  };
-  int
-  getRefresh()
-  {
-    return refresh;
-  };
-
-  const char *
-  getRefreshURL()
-  {
-    return refreshURL;
-  };
-  void setRefreshURL(const char *url);
-
-  const char *
-  getLocationURL()
-  {
-    return locationURL;
-  };
-  void setLocationURL(const char *url);
-
-  void setRealm(const char *);
-  void
-  setLastMod(time_t lm)
-  {
-    lastMod = lm;
-  };
-
-  void
-  setCachable(int c)
-  {
-    if ((cachable = c) == 0) {
-      lastMod = -1;
-    }
-  }
-  int
-  getCachable()
-  {
-    return cachable;
-  }
-
-  int writeHdr(SocketInfo socketD);
-  void getLogInfo(const char **date, HttpStatus_t *status, int *legth);
-
-private:
-  httpResponse(const httpResponse &);
-  HttpStatus_t status;
-  int refresh;
-  int conLen;
-  Content_t conType;
-  char *explicitConType;
-  char *authRealm;
-  char *refreshURL;
-  char *locationURL;
-  time_t lastMod;
-  int cachable;
-  char *dateResponse; // for logs
-};
-
-#endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/mgmt/web2/WebIntrMain.cc
----------------------------------------------------------------------
diff --git a/mgmt/web2/WebIntrMain.cc b/mgmt/web2/WebIntrMain.cc
deleted file mode 100644
index eeacdd9..0000000
--- a/mgmt/web2/WebIntrMain.cc
+++ /dev/null
@@ -1,533 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-/************* ***************************
- *
- *  WebIntrMain.cc - main loop for the Web Interface
- *
- *
- *
- ****************************************************************************/
-
-#include "libts.h"
-#include "I_Layout.h"
-#include "LocalManager.h"
-#include "Alarms.h"
-#include "WebHttp.h"
-#include "WebGlobals.h"
-#include "MgmtUtils.h"
-#include "WebMgmtUtils.h"
-#include "WebIntrMain.h"
-#include "Diags.h"
-#include "MgmtSocket.h"
-#include "NetworkUtilsRemote.h"
-
-// INKqa09866
-#include "TSControlMain.h"
-#include "EventControlMain.h"
-
-#if !defined(linux)
-// Solaris header files forget this one
-extern "C" {
-int usleep(unsigned int useconds);
-}
-#endif
-
-typedef int fd;
-static RecInt autoconf_localhost_only = 1;
-
-#define SOCKET_TIMEOUT 10 * 60
-
-
-WebInterFaceGlobals wGlobals;
-
-// There are two web ports maintained
-//
-//  One is for administration.  This port serves
-//     all the configuration and monitoring info.
-//     Most sites will have some security features
-//     (authentication and SSL) active on this
-//     port since it system administrator access
-//  The other is for things that we want to serve
-//     insecurely.  Client auto configuration falls
-//     in this category.  The public key for the
-//     administration server is another example
-//
-WebContext autoconfContext;
-
-// Used for storing argument values
-int aconf_port_arg = -1;
-
-// int checkWebContext(WebContext* wctx, char* desc)
-//
-//    Checks out a WebContext to make sure that the
-//      directory exists and that the default file
-//      exists
-//
-//    returns 0 if everything is OK
-//    returns 1 if something is missing
-//
-int
-checkWebContext(WebContext *wctx, const char *desc)
-{
-  struct stat fInfo;
-  textBuffer defaultFile(256);
-
-  if (wctx->docRoot == NULL) {
-    mgmt_log(stderr, "[checkWebContext] No document root specified for %s\n", desc);
-    return 1;
-  }
-
-  if (stat(wctx->docRoot, &fInfo) < 0) {
-    mgmt_log(stderr, "[checkWebContext] Unable to access document root '%s' for %s : %s\n", wctx->docRoot, desc, strerror(errno));
-    return 1;
-  }
-
-  if (!S_ISDIR(fInfo.st_mode)) {
-    mgmt_log(stderr, "[checkWebContext] Document root '%s' for %s is not a directory\n", wctx->docRoot, desc);
-    return 1;
-  }
-
-  if (wctx->defaultFile == NULL) {
-    mgmt_log(stderr, "[checkWebContext] No default document specified for %s\n", desc);
-    return 1;
-  }
-
-  defaultFile.copyFrom(wctx->docRoot, strlen(wctx->docRoot));
-  defaultFile.copyFrom("/", 1);
-  defaultFile.copyFrom(wctx->defaultFile, strlen(wctx->defaultFile));
-
-  if (stat(defaultFile.bufPtr(), &fInfo) < 0) {
-    mgmt_log(stderr, "Unable to access default document, %s, for %s : %s\n", wctx->defaultFile, desc, strerror(errno));
-    return 1;
-  }
-
-  if (!S_ISREG(fInfo.st_mode)) {
-    mgmt_log(stderr, "[checkWebContext] Default document for %s is not a file\n", desc);
-    return 1;
-  }
-
-  return 0;
-}
-
-//  fd newTcpSocket(int port)
-//
-//  returns a file descriptor associated with a new socket
-//    on the specified port
-//
-//  If the socket could not be created, returns -1
-//
-//  Thread Safe: NO!  Call only from main Web interface thread
-//
-static fd
-newTcpSocket(int port)
-{
-  struct sockaddr_in socketInfo;
-  fd socketFD;
-  int one = 1;
-
-  memset(&socketInfo, 0, sizeof(sockaddr_in));
-
-  // Create the new TCP Socket
-  if ((socketFD = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {
-    mgmt_fatal(stderr, errno, "[newTcpSocket]: %s", "Unable to Create Socket\n");
-    return -1;
-  }
-  // Specify our port number is network order
-  memset(&socketInfo, 0, sizeof(socketInfo));
-  socketInfo.sin_family = AF_INET;
-  socketInfo.sin_port = htons(port);
-  if (autoconf_localhost_only == 1) {
-    socketInfo.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
-  } else {
-    socketInfo.sin_addr.s_addr = htonl(INADDR_ANY);
-  }
-
-  // Allow for immediate re-binding to port
-  if (setsockopt(socketFD, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof(int)) < 0) {
-    mgmt_fatal(stderr, errno, "[newTcpSocket] Unable to set socket options.\n");
-  }
-  // Bind the port to the socket
-  if (bind(socketFD, (sockaddr *)&socketInfo, sizeof(socketInfo)) < 0) {
-    mgmt_elog(stderr, 0, "[newTcpSocket] Unable to bind port %d to socket: %s\n", port, strerror(errno));
-    close_socket(socketFD);
-    return -1;
-  }
-  // Listen on the new socket
-  if (listen(socketFD, 5) < 0) {
-    mgmt_elog(stderr, errno, "[newTcpSocket] %s\n", "Unable to listen on the socket");
-    close_socket(socketFD);
-    return -1;
-  }
-  // Set the close on exec flag so our children do not
-  //  have this socket open
-  if (fcntl(socketFD, F_SETFD, 1) < 0) {
-    mgmt_elog(stderr, errno, "[newTcpSocket] Unable to set close on exec flag\n");
-  }
-
-  return socketFD;
-}
-
-// Keep track of the number of service threads for debugging
-//  purposes
-static volatile int32_t numServiceThr = 0;
-
-void *
-serviceThrReaper(void * /* arg ATS_UNUSED */)
-{
-  int numJoined;
-
-  lmgmt->syslogThrInit();
-
-  while (1) {
-    numJoined = 0;
-
-    // coverity[lock][lockagain]
-    ink_mutex_acquire(&wGlobals.serviceThrLock);
-
-    for (int i = 0; i < MAX_SERVICE_THREADS; i++) {
-      if (wGlobals.serviceThrArray[i].threadId != 0) {
-        if (wGlobals.serviceThrArray[i].waitingForJoin == true) {
-          // fprintf(stderr, "Joining on thread %d in slot %d\n",
-          //       wGlobals.serviceThrArray[i].threadId, i);
-
-          // Join on threads that have exited so we recycle their thrIds and
-          //     stack space
-          ink_assert(wGlobals.serviceThrArray[i].threadId > 0);
-          ink_thread_join(wGlobals.serviceThrArray[i].threadId);
-
-          wGlobals.serviceThrArray[i].fd = -1;
-          wGlobals.serviceThrArray[i].threadId = 0;
-          wGlobals.serviceThrArray[i].startTime = 0;
-          wGlobals.serviceThrArray[i].waitingForJoin = false;
-          wGlobals.serviceThrArray[i].alreadyShutdown = false;
-
-          numJoined++;
-        }
-      }
-    }
-
-    ink_mutex_release(&wGlobals.serviceThrLock);
-
-    for (int j = 0; j < numJoined; j++) {
-      ink_sem_post(&wGlobals.serviceThrCount);
-      ink_atomic_increment((int32_t *)&numServiceThr, -1);
-    }
-
-    usleep(300000);
-  }
-
-  return NULL;
-} // END serviceThrReaper()
-
-static bool
-api_socket_is_restricted()
-{
-  RecInt intval;
-
-  // If the socket is not administratively restricted, check whether we have platform
-  // support. Otherwise, default to making it restricted.
-  if (RecGetRecordInt("proxy.config.admin.api.restricted", &intval) == REC_ERR_OKAY) {
-    if (intval == 0) {
-      return !mgmt_has_peereid();
-    }
-  }
-
-  return true;
-}
-
-void *
-webIntr_main(void *)
-{
-  fd socketFD = -1;   // FD for incoming HTTP connections
-  fd autoconfFD = -1; // FD for incoming autoconf connections
-  fd clientFD = -1;   // FD for accepted connections
-  fd mgmtapiFD = -1;  // FD for the api interface to issue commands
-  fd eventapiFD = -1; // FD for the api and clients to handle event callbacks
-
-  // dg: added init to get rid of compiler warnings
-  fd acceptFD = 0;             // FD that is ready for accept
-  UIthr_t serviceThr = NO_THR; // type for new service thread
-
-  struct sockaddr_in *clientInfo; // Info about client connection
-  ink_thread thrId;               // ID of service thread we just spawned
-  fd_set selectFDs;               // FD set passed to select
-  int publicPort = -1;            // Port for incoming autoconf connections
-#if !defined(linux)
-  sigset_t allSigs; // Set of all signals
-#endif
-  char pacFailMsg[] = "Auto-Configuration Service Failed to Initialize";
-  //  char gphFailMsg[] = "Dynamic Graph Service Failed to Initialize";
-  char mgmtapiFailMsg[] = "Traffic server management API service Interface Failed to Initialize.";
-
-  RecInt tempInt;
-  bool found;
-
-  int addrLen;
-  int i;
-
-#if !defined(linux)
-  // Start by blocking all signals
-  sigfillset(&allSigs);
-  ink_thread_sigsetmask(SIG_SETMASK, &allSigs, NULL);
-#endif
-
-  lmgmt->syslogThrInit();
-
-  // Set up the threads management
-  ink_sem_init(&wGlobals.serviceThrCount, MAX_SERVICE_THREADS);
-  ink_mutex_init(&wGlobals.serviceThrLock, "Web Interface Mutex");
-  wGlobals.serviceThrArray = new serviceThr_t[MAX_SERVICE_THREADS];
-  for (i = 0; i < MAX_SERVICE_THREADS; i++) {
-    // coverity[missing_lock]
-    wGlobals.serviceThrArray[i].threadId = 0;
-    // coverity[missing_lock]
-    wGlobals.serviceThrArray[i].fd = -1;
-    // coverity[missing_lock]
-    wGlobals.serviceThrArray[i].startTime = 0;
-    // coverity[missing_lock]
-    wGlobals.serviceThrArray[i].waitingForJoin = false;
-  }
-  ink_thread_create(serviceThrReaper, NULL);
-
-  // Init mutex to only allow one submissions at a time
-  ink_mutex_init(&wGlobals.submitLock, "Submission Mutex");
-
-  // Fix for INKqa10514
-  found = (RecGetRecordInt("proxy.config.admin.autoconf.localhost_only", &autoconf_localhost_only) == REC_ERR_OKAY);
-  ink_assert(found);
-
-  // Set up the client autoconfiguration context
-  //
-  //  Since autoconf is public access, turn security
-  //     features off
-  if (aconf_port_arg > 0) {
-    publicPort = aconf_port_arg;
-  } else {
-    found = (RecGetRecordInt("proxy.config.admin.autoconf_port", &tempInt) == REC_ERR_OKAY);
-    publicPort = (int)tempInt;
-    ink_assert(found);
-  }
-  Debug("ui", "[WebIntrMain] Starting Client AutoConfig Server on Port %d", publicPort);
-
-  found = (RecGetRecordString_Xmalloc("proxy.config.admin.autoconf.doc_root", &(autoconfContext.docRoot)) == REC_ERR_OKAY);
-  ink_assert(found);
-
-  if (autoconfContext.docRoot == NULL) {
-    mgmt_fatal(stderr, 0, "[WebIntrMain] No Client AutoConf Root\n");
-  } else {
-    struct stat s;
-    int err;
-
-    if ((err = stat(autoconfContext.docRoot, &s)) < 0) {
-      ats_free(autoconfContext.docRoot);
-      autoconfContext.docRoot = RecConfigReadConfigDir();
-      if ((err = stat(autoconfContext.docRoot, &s)) < 0) {
-        mgmt_elog(0, "[WebIntrMain] unable to stat() directory '%s': %d %d, %s\n", autoconfContext.docRoot, err, errno,
-                  strerror(errno));
-        mgmt_elog(0, "[WebIntrMain] please set the 'TS_ROOT' environment variable\n");
-        mgmt_fatal(stderr, 0, "[WebIntrMain] No Client AutoConf Root\n");
-      }
-    }
-    autoconfContext.docRootLen = strlen(autoconfContext.docRoot);
-  }
-  autoconfContext.defaultFile = "/proxy.pac";
-
-  // INKqa09866
-  // fire up interface for ts configuration through API; use absolute path from root to
-  // set up socket paths;
-  ats_scoped_str rundir(RecConfigReadRuntimeDir());
-  ats_scoped_str apisock(Layout::relative_to(rundir, MGMTAPI_MGMT_SOCKET_NAME));
-  ats_scoped_str eventsock(Layout::relative_to(rundir, MGMTAPI_EVENT_SOCKET_NAME));
-
-  mode_t oldmask = umask(0);
-  mode_t newmode = api_socket_is_restricted() ? 00700 : 00777;
-
-  mgmtapiFD = bind_unix_domain_socket(apisock, newmode);
-  if (mgmtapiFD == -1) {
-    mgmt_log(stderr, "[WebIntrMain] Unable to set up socket for handling management API calls. API socket path = %s\n",
-             (const char *)apisock);
-    lmgmt->alarm_keeper->signalAlarm(MGMT_ALARM_WEB_ERROR, mgmtapiFailMsg);
-  }
-
-  eventapiFD = bind_unix_domain_socket(eventsock, newmode);
-  if (eventapiFD == -1) {
-    mgmt_log(stderr, "[WebIntrMain] Unable to set up so for handling management API event calls. Event Socket path: %s\n",
-             (const char *)eventsock);
-  }
-
-  umask(oldmask);
-
-  // launch threads
-  // create thread for mgmtapi
-  ink_thread_create(ts_ctrl_main, &mgmtapiFD);
-  ink_thread_create(event_callback_main, &eventapiFD);
-
-  // initialize mgmt api plugins
-  // mgmt_plugin_init(config_path);
-
-  // Check our web contexts to make sure everything is
-  //  OK.  If it is, go ahead and fire up the interfaces
-  if (checkWebContext(&autoconfContext, "Browser Auto-Configuration") != 0) {
-    lmgmt->alarm_keeper->signalAlarm(MGMT_ALARM_WEB_ERROR, pacFailMsg);
-  } else {
-    if ((autoconfFD = newTcpSocket(publicPort)) < 0) {
-      mgmt_elog(stderr, errno, "[WebIntrMain] Unable to start client autoconf server\n");
-      lmgmt->alarm_keeper->signalAlarm(MGMT_ALARM_WEB_ERROR, pacFailMsg);
-    }
-  }
-
-  // Initialze WebHttp Module
-  WebHttpInit();
-
-  while (1) {
-    FD_ZERO(&selectFDs);
-
-    if (socketFD >= 0) {
-      FD_SET(socketFD, &selectFDs);
-    }
-
-    if (autoconfFD >= 0) {
-      FD_SET(autoconfFD, &selectFDs);
-    }
-
-    // TODO: Should we check return value?
-    mgmt_select(FD_SETSIZE, &selectFDs, (fd_set *)NULL, (fd_set *)NULL, NULL);
-
-    if (autoconfFD >= 0 && FD_ISSET(autoconfFD, &selectFDs)) {
-      acceptFD = autoconfFD;
-      serviceThr = AUTOCONF_THR;
-    } else {
-      ink_assert(!"[webIntrMain] Error on mgmt_select()\n");
-    }
-    ink_sem_wait(&wGlobals.serviceThrCount);
-    ink_atomic_increment((int32_t *)&numServiceThr, 1);
-
-    // coverity[alloc_fn]
-    clientInfo = (struct sockaddr_in *)ats_malloc(sizeof(struct sockaddr_in));
-    addrLen = sizeof(struct sockaddr_in);
-
-    // coverity[noescape]
-    if ((clientFD = mgmt_accept(acceptFD, (sockaddr *)clientInfo, &addrLen)) < 0) {
-      mgmt_log(stderr, "[WebIntrMain]: %s%s\n", "Accept on incoming connection failed: ", strerror(errno));
-      ink_sem_post(&wGlobals.serviceThrCount);
-      ink_atomic_increment((int32_t *)&numServiceThr, -1);
-    } else { // Accept succeeded
-      if (safe_setsockopt(clientFD, IPPROTO_TCP, TCP_NODELAY, SOCKOPT_ON, sizeof(int)) < 0) {
-        mgmt_log(stderr, "[WebIntrMain]Failed to set sock options: %s\n", strerror(errno));
-      }
-
-      // Accept OK
-      ink_mutex_acquire(&wGlobals.serviceThrLock);
-
-      // If this a web manager, make sure that it is from an allowed ip addr
-      if (serviceThr == AUTOCONF_THR && autoconf_localhost_only != 0 && strcmp(inet_ntoa(clientInfo->sin_addr), "127.0.0.1") != 0) {
-        mgmt_log("WARNING: connect by disallowed client %s, closing\n", inet_ntoa(clientInfo->sin_addr));
-        ink_sem_post(&wGlobals.serviceThrCount);
-        ink_atomic_increment((int32_t *)&numServiceThr, -1);
-        ats_free(clientInfo);
-        close_socket(clientFD);
-      } else { // IP is allowed
-
-        for (i = 0; i < MAX_SERVICE_THREADS; i++) {
-          if (wGlobals.serviceThrArray[i].threadId == 0) {
-            //
-            wGlobals.serviceThrArray[i].fd = clientFD;
-            wGlobals.serviceThrArray[i].startTime = time(NULL);
-            wGlobals.serviceThrArray[i].waitingForJoin = false;
-            wGlobals.serviceThrArray[i].alreadyShutdown = false;
-            wGlobals.serviceThrArray[i].type = serviceThr;
-            wGlobals.serviceThrArray[i].clientInfo = clientInfo;
-            thrId = ink_thread_create(serviceThrMain, &wGlobals.serviceThrArray[i], 0);
-            // fprintf (stderr, "New Service Thread %d in slot %d\n", thrId, i);
-
-            if (thrId > 0) {
-              wGlobals.serviceThrArray[i].threadId = thrId;
-            } else {
-              // Failed to create thread
-              mgmt_elog(stderr, errno, "[WebIntrMain] Failed to create service thread\n");
-              wGlobals.serviceThrArray[i].threadId = 0;
-              wGlobals.serviceThrArray[i].fd = -1;
-              close_socket(clientFD);
-              ink_sem_post(&wGlobals.serviceThrCount);
-              ink_atomic_increment((int32_t *)&numServiceThr, -1);
-            }
-
-            break;
-          } else if (i == MAX_SERVICE_THREADS - 1) {
-            mgmt_fatal(stderr, 0, "[WebIntrMain] Syncronizaion Failure\n");
-            _exit(1);
-          }
-        }
-      }
-
-      ink_mutex_release(&wGlobals.serviceThrLock);
-    }
-  }                                  // end while(1)
-  ink_release_assert(!"impossible"); // should never get here
-  return NULL;
-}
-
-// void* serviceThrMain(void* info)
-//
-// Thread main for any type of service thread
-//
-void *
-serviceThrMain(void *info)
-{
-  serviceThr_t *threadInfo = (serviceThr_t *)info;
-  WebHttpConInfo httpInfo;
-
-  lmgmt->syslogThrInit();
-
-  // Do our work
-  switch (threadInfo->type) {
-  case NO_THR: // dg: added to handle init value
-    ink_assert(false);
-    break;
-  case AUTOCONF_THR:
-    httpInfo.fd = threadInfo->fd;
-    httpInfo.context = &autoconfContext;
-    httpInfo.clientInfo = threadInfo->clientInfo;
-    WebHttpHandleConnection(&httpInfo);
-    break;
-  default:
-    // Handled here:
-    // GRAPH_THR
-    break;
-  }
-
-  ats_free(threadInfo->clientInfo);
-
-  // Mark ourselves ready to be reaped
-  ink_mutex_acquire(&wGlobals.serviceThrLock);
-
-  threadInfo->waitingForJoin = true;
-  threadInfo->fd = -1;
-
-  ink_mutex_release(&wGlobals.serviceThrLock);
-
-  // Call exit so that we properly release system resources
-  ink_thread_exit(NULL);
-  return NULL; // No Warning
-}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/mgmt/web2/WebIntrMain.h
----------------------------------------------------------------------
diff --git a/mgmt/web2/WebIntrMain.h b/mgmt/web2/WebIntrMain.h
deleted file mode 100644
index ce78f1b..0000000
--- a/mgmt/web2/WebIntrMain.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-#ifndef _WEB_INTR_MAIN_H_
-#define _WEB_INTR_MAIN_H_
-
-/****************************************************************************
- *
- *  WebIntrMain.h - main loop for the Web Interface
- *
- ****************************************************************************/
-
-struct WebContext;
-
-#include "P_RecCore.h"
-
-void *webIntr_main(void *);
-void *serviceThrMain(void *info);
-
-extern int aconf_port_arg;
-
-#endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/mgmt/web2/WebOverview.cc
----------------------------------------------------------------------
diff --git a/mgmt/web2/WebOverview.cc b/mgmt/web2/WebOverview.cc
deleted file mode 100644
index 8372706..0000000
--- a/mgmt/web2/WebOverview.cc
+++ /dev/null
@@ -1,663 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-/****************************************************************************
- *
- *  WebOverview.cc - code to overview page
- *
- *
- ****************************************************************************/
-
-#include "libts.h"
-
-#include "WebOverview.h"
-#include "WebGlobals.h"
-#include "WebMgmtUtils.h"
-
-#include "LocalManager.h"
-#include "ClusterCom.h"
-#include "MgmtUtils.h"
-#include "MgmtDefs.h"
-#include "Diags.h"
-
-// Make this pointer to avoid nasty destruction
-//   problems do to alarm
-//   fork, execl, exit squences
-overviewPage *overviewGenerator;
-
-overviewRecord::overviewRecord(unsigned long inet_addr, bool local, ClusterPeerInfo *cpi)
-{
-  char *name_l; // hostname looked up from node record
-  bool name_found;
-  struct in_addr nameFailed;
-
-  inetAddr = inet_addr;
-
-  this->up = false;
-  this->localNode = local;
-
-  // If this is the local node, there is no cluster peer info
-  //   record.  Remote nodes require a cluster peer info record
-  ink_assert((local == false && cpi != NULL) || (local == true && cpi == NULL));
-
-  // Set up the copy of the records array and initialize it
-  if (local == true) {
-    node_rec_data.num_recs = 0;
-    node_rec_data.recs = NULL;
-    recordArraySize = 0;
-    node_rec_first_ix = 0;
-  } else {
-    node_rec_data.num_recs = cpi->node_rec_data.num_recs;
-    recordArraySize = node_rec_data.num_recs * sizeof(RecRecord);
-    node_rec_data.recs = new RecRecord[recordArraySize];
-    memcpy(node_rec_data.recs, cpi->node_rec_data.recs, recordArraySize);
-
-    // Recaculate the old relative index
-    RecGetRecordOrderAndId(node_rec_data.recs[0].name, &node_rec_first_ix, NULL);
-  }
-
-
-  // Query for the name of the node.  If it is not there, some
-  //   their cluster ip address
-  name_l = this->readString("proxy.node.hostname_FQ", &name_found);
-  if (name_found == false || name_l == NULL) {
-    nameFailed.s_addr = inetAddr;
-    mgmt_log("[overviewRecord::overviewRecord] Unable to find hostname for %s\n", inet_ntoa(nameFailed));
-    ats_free(name_l); // about to overwrite name_l, so we need to free it first
-    name_l = ats_strdup(inet_ntoa(nameFailed));
-  }
-
-  const size_t hostNameLen = strlen(name_l) + 1;
-  this->hostname = new char[hostNameLen];
-  ink_strlcpy(this->hostname, name_l, hostNameLen);
-  ats_free(name_l);
-}
-
-overviewRecord::~overviewRecord()
-{
-  delete[] hostname;
-
-  if (localNode == false) {
-    delete[] node_rec_data.recs;
-  }
-}
-
-// void overviewRecord::updateStatus(time_t, ClusterPeerInfo*)
-// updates up/down status based on the cluster peer info record
-//
-//   currentTime is the value of localtime(time()) - sent in as
-//     a parameter so we do not have to make repetitive system calls.
-//     overviewPage::checkForUpdates can just make one call
-//
-//   cpi - is a pointer to a structure we got from ClusterCom that represnets
-//         information about this node
-//
-//   a machine is up if we have heard from it in the last 15 seconds
-//
-void
-overviewRecord::updateStatus(time_t currentTime, ClusterPeerInfo *cpi)
-{
-  // Update if the node is up or down
-  if (currentTime - cpi->idle_ticks > 15) {
-    up = false;
-  } else {
-    up = true;
-  }
-
-  // Update the node records by copying them from cpi
-  //  (remote nodes only)
-  if (localNode == false) {
-    memcpy(node_rec_data.recs, cpi->node_rec_data.recs, recordArraySize);
-    RecGetRecordOrderAndId(node_rec_data.recs[0].name, &node_rec_first_ix, NULL);
-  }
-}
-
-// overview::readInteger
-//
-//  Accessor functions for node records.  For remote node,
-//    we get the value in the node_data array we maintain
-//    in this object.  For the node, we do not maintain any data
-//    and rely on lmgmt->record_data for both the retrieval
-//    code and the records array
-//
-//  Locking should be done by overviewPage::accessLock.
-//  CALLEE is responsible for obtaining and releasing the lock
-//
-RecInt
-overviewRecord::readInteger(const char *name, bool *found)
-{
-  RecInt rec = 0;
-  int rec_status = REC_ERR_OKAY;
-  int order = -1;
-  if (localNode == false) {
-    rec_status = RecGetRecordOrderAndId(name, &order, NULL);
-    if (rec_status == REC_ERR_OKAY) {
-      order -= node_rec_first_ix; // Offset
-      ink_release_assert(order < node_rec_data.num_recs);
-      ink_assert(order < node_rec_data.num_recs);
-      rec = node_rec_data.recs[order].data.rec_int;
-    }
-  } else {
-    rec_status = RecGetRecordInt(name, &rec);
-  }
-
-  if (found) {
-    *found = (rec_status == REC_ERR_OKAY);
-  } else {
-    mgmt_log(stderr, "node variables '%s' not found!\n");
-  }
-  return rec;
-}
-
-RecFloat
-overviewRecord::readFloat(const char *name, bool *found)
-{
-  RecFloat rec = 0.0;
-  int rec_status = REC_ERR_OKAY;
-  int order = -1;
-  if (localNode == false) {
-    rec_status = RecGetRecordOrderAndId(name, &order, NULL);
-    if (rec_status == REC_ERR_OKAY) {
-      order -= node_rec_first_ix; // Offset
-      ink_release_assert(order < node_rec_data.num_recs);
-      ink_assert(order < node_rec_data.num_recs);
-      rec = node_rec_data.recs[order].data.rec_float;
-    }
-  } else {
-    rec_status = RecGetRecordFloat(name, &rec);
-  }
-
-  if (found) {
-    *found = (rec_status == REC_ERR_OKAY);
-  } else {
-    mgmt_log(stderr, "node variables '%s' not found!\n");
-  }
-  return rec;
-}
-
-RecString
-overviewRecord::readString(const char *name, bool *found)
-{
-  RecString rec = NULL;
-  int rec_status = REC_ERR_OKAY;
-  int order = -1;
-  if (localNode == false) {
-    rec_status = RecGetRecordOrderAndId(name, &order, NULL);
-    if (rec_status == REC_ERR_OKAY) {
-      order -= node_rec_first_ix; // Offset
-      ink_release_assert(order < node_rec_data.num_recs);
-      ink_assert(order < node_rec_data.num_recs);
-      rec = ats_strdup(node_rec_data.recs[order].data.rec_string);
-    }
-  } else {
-    rec_status = RecGetRecordString_Xmalloc(name, &rec);
-  }
-
-  if (found) {
-    *found = (rec_status == REC_ERR_OKAY);
-  } else {
-    mgmt_log(stderr, "node variables '%s' not found!\n");
-  }
-  return rec;
-}
-
-//  overview::readData, read RecData according varType
-//
-//  Accessor functions for node records.  For remote node,
-//    we get the value in the node_data array we maintain
-//    in this object.  For the node, we do not maintain any data
-//    and rely on lmgmt->record_data for both the retrieval
-//    code and the records array
-//
-//  Locking should be done by overviewPage::accessLock.
-//  CALLEE is responsible for obtaining and releasing the lock
-//
-RecData
-overviewRecord::readData(RecDataT varType, const char *name, bool *found)
-{
-  int rec_status = REC_ERR_OKAY;
-  int order = -1;
-  RecData rec;
-  RecDataClear(RECD_NULL, &rec);
-
-  if (localNode == false) {
-    rec_status = RecGetRecordOrderAndId(name, &order, NULL);
-    if (rec_status == REC_ERR_OKAY) {
-      order -= node_rec_first_ix; // Offset
-      ink_release_assert(order < node_rec_data.num_recs);
-      ink_assert(order < node_rec_data.num_recs);
-      RecDataSet(varType, &rec, &node_rec_data.recs[order].data);
-    } else {
-      Fatal("node variables '%s' not found!\n", name);
-    }
-  } else
-    rec_status = RecGetRecord_Xmalloc(name, varType, &rec, true);
-
-  if (found) {
-    *found = (rec_status == REC_ERR_OKAY);
-  } else {
-    mgmt_log(stderr, "node variables '%s' not found!\n");
-  }
-  return rec;
-}
-
-bool
-overviewRecord::varFloatFromName(const char *name, MgmtFloat *value)
-{
-  bool found = false;
-
-  if (value)
-    *value = readFloat((char *)name, &found);
-
-  return found;
-}
-
-overviewPage::overviewPage() : sortRecords(10, false)
-{
-  ink_mutex_init(&accessLock, "overviewRecord");
-  nodeRecords = ink_hash_table_create(InkHashTableKeyType_Word);
-  numHosts = 0;
-  ourAddr = 0; // We will update this when we add the record for
-  //  this machine
-}
-
-overviewPage::~overviewPage()
-{
-  // Since we only have one global object and we never destruct it
-  //  do not actually free memeory since it causes problems the
-  //  process is vforked, and the child execs something
-  // The below code is DELIBERTLY commented out
-  //
-  // ink_mutex_destroy(&accessLock);
-  // ink_hash_table_destroy(nodeRecords);
-}
-
-// overviewPage::checkForUpdates - updates node records as to whether peers
-//    are up or down
-void
-overviewPage::checkForUpdates()
-{
-  ClusterPeerInfo *tmp;
-  InkHashTableEntry *entry;
-  InkHashTableIteratorState iterator_state;
-  overviewRecord *current;
-  time_t currentTime;
-  bool newHostAdded = false;
-
-  // grok through the cluster communication stuff and update information
-  //  about hosts in the cluster
-  //
-  ink_mutex_acquire(&accessLock);
-  ink_mutex_acquire(&(lmgmt->ccom->mutex));
-  currentTime = time(NULL);
-  for (entry = ink_hash_table_iterator_first(lmgmt->ccom->peers, &iterator_state); entry != NULL;
-       entry = ink_hash_table_iterator_next(lmgmt->ccom->peers, &iterator_state)) {
-    tmp = (ClusterPeerInfo *)ink_hash_table_entry_value(lmgmt->ccom->peers, entry);
-
-    if (ink_hash_table_lookup(nodeRecords, (InkHashTableKey)tmp->inet_address, (InkHashTableValue *)&current) == 0) {
-      this->addRecord(tmp);
-      newHostAdded = true;
-    } else {
-      current->updateStatus(currentTime, tmp);
-    }
-  }
-  ink_mutex_release(&lmgmt->ccom->mutex);
-
-  // If we added a new host we must resort sortRecords
-  if (newHostAdded) {
-    this->sortHosts();
-  }
-
-  ink_mutex_release(&accessLock);
-}
-
-
-// overrviewPage::sortHosts()
-//
-// resorts sortRecords, but always leaves the local node
-//   as the first record
-//
-// accessLock must be held by callee
-void
-overviewPage::sortHosts()
-{
-  void **array = sortRecords.getArray();
-
-  qsort(array + 1, numHosts - 1, sizeof(void *), hostSortFunc);
-}
-
-// overviewPage::addRecord(ClusterPerrInfo* cpi)
-//   Adds a new node record
-//   Assuems that this->accessLock is already held
-//
-void
-overviewPage::addRecord(ClusterPeerInfo *cpi)
-{
-  overviewRecord *newRec;
-
-  ink_assert(cpi != NULL);
-
-  newRec = new overviewRecord(cpi->inet_address, false, cpi);
-  newRec->updateStatus(time(NULL), cpi);
-
-  ink_hash_table_insert(nodeRecords, (InkHashTableKey)cpi->inet_address, (InkHashTableEntry *)newRec);
-
-  sortRecords.addEntry(newRec);
-  numHosts++;
-}
-
-// adds a record to nodeRecords for the local machine.
-//   gets IP addr from lmgmt->ccom so cluster communtication
-//   must be intialized before calling this function
-//
-//
-void
-overviewPage::addSelfRecord()
-{
-  overviewRecord *newRec;
-
-  ink_mutex_acquire(&accessLock);
-
-  // We should not have been called before
-  ink_assert(ourAddr == 0);
-
-  // Find out what our cluster addr is from
-  //   from cluster com
-  this->ourAddr = lmgmt->ccom->getIP();
-
-  newRec = new overviewRecord(ourAddr, true);
-  newRec->up = true;
-
-  ink_hash_table_insert(nodeRecords, (InkHashTableKey) this->ourAddr, (InkHashTableEntry *)newRec);
-
-  sortRecords.addEntry(newRec);
-  numHosts++;
-  ink_mutex_release(&accessLock);
-}
-
-// int overviewPage::getClusterHosts(Expanding Array* hosts)
-//
-//   The names of all the cluster members are inserted
-//     into parameter hosts.  The callee is responsible
-//     for freeing the strings
-//
-int
-overviewPage::getClusterHosts(ExpandingArray *hosts)
-{
-  int number = 0;
-
-  overviewRecord *current;
-
-  ink_mutex_acquire(&accessLock);
-  number = sortRecords.getNumEntries();
-
-  for (int i = 0; i < number; i++) {
-    current = (overviewRecord *)sortRecords[i];
-    hosts->addEntry(ats_strdup(current->hostname));
-  }
-
-  ink_mutex_release(&accessLock);
-  return number;
-}
-
-// overviewRecord* overviewPage::findNodeByName(const char* nodeName)
-//
-//   Returns a pointer to node name nodeName
-//     If node name is not found, returns NULL
-//
-//   CALLEE MUST BE HOLDING this->accessLock
-//
-overviewRecord *
-overviewPage::findNodeByName(const char *nodeName)
-{
-  overviewRecord *current = NULL;
-  bool nodeFound = false;
-
-  // Do a linear search of the nodes for this nodeName.
-  //   Yes, I know this is slow but the current word is ten
-  //   nodes would be a huge cluster so this should not
-  //   be a problem
-  //
-  for (int i = 0; i < numHosts; i++) {
-    current = (overviewRecord *)sortRecords[i];
-    if (strcmp(nodeName, current->hostname) == 0) {
-      nodeFound = true;
-      break;
-    }
-  }
-
-  if (nodeFound == true) {
-    return current;
-  } else {
-    return NULL;
-  }
-}
-
-// MgmtString overviewPage::readString(const char* nodeName, char* *name, bool *found = NULL)
-//
-//   Looks up a node record for a specific by nodeName
-//    CALLEE deallocates the string with free()
-//
-MgmtString
-overviewPage::readString(const char *nodeName, const char *name, bool *found)
-{
-  MgmtString r = NULL;
-  //  bool nodeFound = false;
-  bool valueFound = false;
-  overviewRecord *node;
-
-  ink_mutex_acquire(&accessLock);
-
-  node = this->findNodeByName(nodeName);
-
-  if (node != NULL) {
-    r = node->readString(name, &valueFound);
-  }
-  ink_mutex_release(&accessLock);
-
-  if (found != NULL) {
-    *found = valueFound;
-  }
-
-  return r;
-}
-
-// MgmtInt overviewPage::readInteger(const char* nodeName, char* *name, bool *found = NULL)
-//
-//   Looks up a node record for a specific by nodeName
-//
-MgmtInt
-overviewPage::readInteger(const char *nodeName, const char *name, bool *found)
-{
-  MgmtInt r = -1;
-  //  bool nodeFound = false;
-  bool valueFound = false;
-  overviewRecord *node;
-
-  ink_mutex_acquire(&accessLock);
-
-  node = this->findNodeByName(nodeName);
-
-  if (node != NULL) {
-    r = node->readInteger(name, &valueFound);
-  }
-  ink_mutex_release(&accessLock);
-
-  if (found != NULL) {
-    *found = valueFound;
-  }
-
-  return r;
-}
-
-// MgmtFloat overviewPage::readFloat(const char* nodeName, char* *name, bool *found = NULL)
-//
-//   Looks up a node record for a specific by nodeName
-//
-RecFloat
-overviewPage::readFloat(const char *nodeName, const char *name, bool *found)
-{
-  RecFloat r = -1.0;
-  //  bool nodeFound = false;
-  bool valueFound = false;
-  overviewRecord *node;
-
-  ink_mutex_acquire(&accessLock);
-
-  node = this->findNodeByName(nodeName);
-
-  if (node != NULL) {
-    r = node->readFloat(name, &valueFound);
-  }
-  ink_mutex_release(&accessLock);
-
-  if (found != NULL) {
-    *found = valueFound;
-  }
-
-  return r;
-}
-
-// int overviewPage::clusterSumData(RecDataT varType, const char* nodeVar,
-//                                  RecData* sum)
-//
-//   Sums nodeVar for every up node in the cluster and stores the
-//     sum in *sum.  Returns the number of nodes summed over
-//
-//   CALLEE MUST HOLD this->accessLock
-//
-int
-overviewPage::clusterSumData(RecDataT varType, const char *nodeVar, RecData *sum)
-{
-  int numUsed = 0;
-  int numHosts_local = sortRecords.getNumEntries();
-  overviewRecord *current;
-  bool found;
-  RecData recTmp;
-
-  ink_assert(sum != NULL);
-  RecDataClear(varType, sum);
-
-  for (int i = 0; i < numHosts_local; i++) {
-    current = (overviewRecord *)sortRecords[i];
-    if (current->up == true) {
-      numUsed++;
-      recTmp = current->readData(varType, nodeVar, &found);
-      *sum = RecDataAdd(varType, *sum, recTmp);
-      if (found == false) {
-      }
-    }
-  }
-  return numUsed;
-}
-
-int
-overviewPage::varClusterDataFromName(RecDataT varType, char *nodeVar, RecData *sum)
-{
-  int status = 0;
-
-  ink_mutex_acquire(&accessLock);
-
-  status = clusterSumData(varType, nodeVar, sum);
-
-  ink_mutex_release(&accessLock);
-
-  return (status);
-}
-
-// Moved from the now removed StatAggregation.cc
-void
-AgFloat_generic_scale_to_int(const char *processVar, const char *nodeVar, double factor)
-{
-  MgmtFloat tmp;
-
-  if (varFloatFromName(processVar, &tmp)) {
-    tmp = tmp * factor;
-    tmp = tmp + 0.5; // round up.
-    varSetInt(nodeVar, (int)tmp);
-  } else {
-    varSetInt(nodeVar, -20);
-  }
-}
-
-// char* overviewPage::resolvePeerHostname(char* peerIP)
-//
-//   A locking interface to overviewPage::resolvePeerHostname_ml
-//
-char *
-overviewPage::resolvePeerHostname(const char *peerIP)
-{
-  char *r;
-
-  ink_mutex_acquire(&accessLock);
-  r = this->resolvePeerHostname_ml(peerIP);
-  ink_mutex_release(&accessLock);
-
-  return r;
-}
-
-// char* overviewPage::resolvePeerHostname_ml(char* peerIP)
-//
-// Resolves the peer the hostname from its IP address
-//   The hostname is resolved by finding the overviewRecord
-//   Associated with the IP address and copying its hostname
-//
-// CALLEE frees storage
-// CALLEE is responsible for locking
-//
-char *
-overviewPage::resolvePeerHostname_ml(const char *peerIP)
-{
-  unsigned long int ipAddr;
-  InkHashTableValue lookup;
-  overviewRecord *peerRecord;
-  char *returnName = NULL;
-
-  ipAddr = inet_addr(peerIP);
-
-  // Check to see if our address is malformed
-  if ((long int)ipAddr == -1) {
-    return NULL;
-  }
-
-  if (ink_hash_table_lookup(nodeRecords, (InkHashTableKey)ipAddr, &lookup)) {
-    peerRecord = (overviewRecord *)lookup;
-    returnName = ats_strdup(peerRecord->hostname);
-  }
-
-  return returnName;
-}
-
-// int hostSortFunc(const void* arg1, const void* arg2)
-//
-//   A compare function that we can to qsort that sorts
-//    overviewRecord*
-//
-int
-hostSortFunc(const void *arg1, const void *arg2)
-{
-  overviewRecord *rec1 = (overviewRecord *)*(void **)arg1;
-  overviewRecord *rec2 = (overviewRecord *)*(void **)arg2;
-
-  return strcmp(rec1->hostname, rec2->hostname);
-}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/mgmt/web2/WebOverview.h
----------------------------------------------------------------------
diff --git a/mgmt/web2/WebOverview.h b/mgmt/web2/WebOverview.h
deleted file mode 100644
index 928a446..0000000
--- a/mgmt/web2/WebOverview.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-#ifndef _WEB_OVERVIEW_H_
-#define _WEB_OVERVIEW_H_
-
-#include "ink_hash_table.h"
-#include "ink_mutex.h"
-#include "WebGlobals.h"
-#include "TextBuffer.h"
-#include "List.h"
-
-#include "WebHttpContext.h"
-#include "WebHttpMessage.h"
-#include "ExpandingArray.h"
-#include "ClusterCom.h"
-
-#include "P_RecCore.h"
-
-/****************************************************************************
- *
- *  WebOverview.h - code to overview page
- *
- *
- ****************************************************************************/
-
-//
-//  There is one instance of the class overviewPage in the LocalManger
-//    process.  The overviewPage instance stores a record of type
-//    overviewRecord for each node that has been seen in the cluster.
-//    The node records contain a list of active alarms on that node.
-//
-//  overviewPage is responsible for the synchronization issues for both
-//    it self and all of its overviewRecords.  Whenever updates are made
-//    to instances of either class, overviewPage's accessLock must be held.
-//
-//  Pointers to overviewRecords are stored in overviewPage::nodeRecords
-//    hash table which is indexed on the nodes ip address (as an
-//    unsigned long).  A second mapping is also maintained in sortRecords.
-//
-//
-//  Additional Notes
-//
-//  These classes have expanded over time.  overviewPage and
-//    overviewRecord are now clearing houses of cluster information
-//    for the UI.
-//  To simplify the locking issues, pointer to overviewRecords should
-//    NOT be returned by overviewPage.  overviewRecords are internal
-//    to overviewPage and any data needed from an overviewRecord
-//    should be returned as a copy (or a const ptr)
-//    through an accessor function
-
-// information about a specific node in the cluster
-class overviewRecord
-{
-public:
-  overviewRecord(unsigned long inet_addr, bool local, ClusterPeerInfo *cpi = NULL);
-
-  ~overviewRecord();
-
-  void updateStatus(time_t currentTime, ClusterPeerInfo *cpi);
-
-  bool up;
-  bool localNode;
-  char *hostname;         // FQ hostname of the node
-  unsigned long inetAddr; // IP address of the node
-  RecInt readInteger(const char *name, bool *found);
-  RecFloat readFloat(const char *name, bool *found);
-  RecString readString(const char *name, bool *found);
-  RecData readData(RecDataT varType, const char *name, bool *found);
-  bool varFloatFromName(const char *varName, RecFloat *value);
-
-private:
-  RecRecords node_rec_data; // a copy from ClusterPeerInfo
-  int recordArraySize;      // the size of node_data.recs
-  int node_rec_first_ix;    // Kludge, but store the first order ix for later use
-  overviewRecord(const overviewRecord &);
-};
-
-// information about the entire cluster
-class overviewPage
-{
-public:
-  overviewPage();
-  ~overviewPage();
-
-  void checkForUpdates();
-  char *resolvePeerHostname(const char *peerIP);
-  char *resolvePeerHostname_ml(const char *peerIP);
-  int getClusterHosts(ExpandingArray *hosts);
-  MgmtInt readInteger(const char *nodeName, const char *name, bool *found = NULL);
-  MgmtFloat readFloat(const char *nodeName, const char *name, bool *found = NULL);
-  MgmtString readString(const char *nodeName, const char *name, bool *found = NULL);
-  void addSelfRecord();
-
-  int varClusterDataFromName(RecDataT varType, char *nodeVar, RecData *sum);
-
-private:
-  ink_mutex accessLock;
-
-  // Private fcns
-  overviewPage(const overviewPage &);
-  void addRecord(ClusterPeerInfo *cpi);
-  overviewRecord *findNodeByName(const char *nodeName);
-  void addReading(MgmtInt reading, textBuffer *output, int nDigits, const char **gifs, const char **alts);
-  void addLoadBar(textBuffer *output, MgmtInt load);
-  void sortHosts();
-  bool moreInfoButton(const char *submission, textBuffer *output);
-  void addHostPanel(WebHttpContext *whc, overviewRecord *host);
-
-  // Private variables
-  InkHashTable *nodeRecords;  // container for overviewRecords
-  unsigned long ourAddr;      // the IP address of this node
-  ExpandingArray sortRecords; // A second, sorted container for nodeRecords
-  int numHosts;               // number of peers we know about including ourself
-
-  int clusterSumData(RecDataT varType, const char *nodeVar, RecData *sum);
-};
-
-extern overviewPage *overviewGenerator; // global handle to overiewPage?
-                                        // defn found in WebOverview.cc
-
-int hostSortFunc(const void *arg1, const void *arg2);
-
-#endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/mgmt/web2/WebUtils.cc
----------------------------------------------------------------------
diff --git a/mgmt/web2/WebUtils.cc b/mgmt/web2/WebUtils.cc
deleted file mode 100644
index 32664aa..0000000
--- a/mgmt/web2/WebUtils.cc
+++ /dev/null
@@ -1,114 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-#include "ink_config.h"
-
-#include "ink_assert.h"
-#include "ink_sock.h"
-#include "WebUtils.h"
-#include "WebGlobals.h"
-#include "MgmtUtils.h"
-
-/****************************************************************************
- *
- *  WebUtils.cc - Misc Utility Functions for the web server internface
- *
- *
- *
- ****************************************************************************/
-
-#include <openssl/ssl.h>
-
-ssize_t
-socket_write(SocketInfo socketD, const char *buf, size_t nbyte)
-{
-  if (socketD.SSLcon != NULL) {
-    return SSL_write((SSL *)socketD.SSLcon, (char *)buf, nbyte);
-  } else {
-    return write_socket(socketD.fd, buf, nbyte);
-  }
-  return -1;
-}
-
-ssize_t
-socket_read(SocketInfo socketD, char *buf, size_t nbyte)
-{
-  if (socketD.SSLcon != NULL) {
-    return SSL_read((SSL *)socketD.SSLcon, (char *)buf, nbyte);
-  } else {
-    return read_socket(socketD.fd, buf, nbyte);
-  }
-  return -1;
-}
-
-
-// int sigfdreadln(int fd, char *s, int len)
-//
-//  An inefficient way to read a line from a socket
-//     within the constrants of the Web Administration
-//     interface
-//  reads from the passed in file descriptor to a
-//    new line or until all space in the buffer is exhausted
-//  returns the number of characters read
-//
-//  Intentially, stops if the read is interrupted by a signal
-//    The reaper will interupt us with a signal if we
-//     are stuck
-//
-//  Returns -1 if the read fails
-//
-int
-sigfdrdln(SocketInfo socketD, char *s, int len)
-{
-  char c;
-  int result;
-  char *bufStart = s;
-
-  do {
-    do {
-      result = socket_read(socketD, &c, 1);
-    } while (result < 0 && errno == EAGAIN);
-
-    // If we are out of bytes or there is an
-    //   error, we are done
-    if (result < 0 || result == 0) {
-      c = '\n';
-    }
-
-    *s++ = c;
-    len--;
-  } while (c != '\n' && len > 1);
-
-  if (c == '\n') {
-    s--;
-    *s = '\0';
-  } else {
-    *s = '\0';
-  }
-
-  if (result < 0) {
-    return -1;
-  } else {
-    return (s - bufStart);
-  }
-}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/mgmt/web2/WebUtils.h
----------------------------------------------------------------------
diff --git a/mgmt/web2/WebUtils.h b/mgmt/web2/WebUtils.h
deleted file mode 100644
index 9a94f54..0000000
--- a/mgmt/web2/WebUtils.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-#ifndef _WEB_UTILS_H_
-#define _WEB_UTILS_H_
-
-/****************************************************************************
- *
- *  WebUtils.h - Misc Utility Functions for the web server internface
- *
- ****************************************************************************/
-
-#include "ink_platform.h"
-#include "MgmtDefs.h"
-
-struct WebContext;
-
-/* Ugly Hack - declare
- *  SSLcon as void* instead of SSL since this prevents  us from
- *  including ssl.h right here which creates a whole bunch of
- *  nasty problem to MD5 conflicts with ink_code.h.
- */
-struct SocketInfo {
-  int fd;
-  void *SSLcon; /* Currently unused */
-};
-
-ssize_t socket_write(SocketInfo socketD, const char *buf, size_t nbyte);
-ssize_t socket_read(SocketInfo socketD, char *buf, size_t nbyte);
-int sigfdrdln(SocketInfo socketD, char *s, int len);
-
-#endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/proxy/http/HttpConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
index e3c5e17..8aeb13a 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -1159,7 +1159,6 @@ HttpConfig::startup()
 
   // Local Manager
   HttpEstablishStaticConfigLongLong(c.autoconf_port, "proxy.config.admin.autoconf_port");
-  HttpEstablishStaticConfigByte(c.autoconf_localhost_only, "proxy.config.admin.autoconf.localhost_only");
 
   // Cluster time delta gets it own callback since it needs
   //  to use ink_atomic_swap
@@ -1417,7 +1416,6 @@ HttpConfig::reconfigure()
 
   // Local Manager
   params->autoconf_port = m_master.autoconf_port;
-  params->autoconf_localhost_only = m_master.autoconf_localhost_only;
 
   m_id = configProcessor.set(m_id, params);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/proxy/http/HttpConfig.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index 3bbba9f..81b4dcb 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -752,7 +752,6 @@ public:
   // Local Manager  //
   ////////////////////
   MgmtInt autoconf_port;
-  MgmtByte autoconf_localhost_only;
 
 private:
   /////////////////////////////////////
@@ -854,7 +853,7 @@ inline HttpConfigParams::HttpConfigParams()
     cluster_time_delta(0), redirection_enabled(0), redirection_host_no_port(0), number_of_redirections(1), post_copy_size(2048),
     ignore_accept_mismatch(0), ignore_accept_language_mismatch(0), ignore_accept_encoding_mismatch(0),
     ignore_accept_charset_mismatch(0), send_100_continue_response(0), disallow_post_100_continue(0), parser_allow_non_http(1),
-    cache_open_write_fail_action(0), max_post_size(0), autoconf_port(0), autoconf_localhost_only(0)
+    cache_open_write_fail_action(0), max_post_size(0), autoconf_port(0)
 {
 }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/proxy/http/HttpTransact.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 0a346cd..cad0468 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -709,11 +709,10 @@ HttpTransact::StartRemapRequest(State *s)
 
   const char syntxt[] = "synthetic.txt";
 
-  s->cop_test_page =
-    (ptr_len_cmp(host, host_len, local_host_ip_str, sizeof(local_host_ip_str) - 1) == 0) &&
-    (ptr_len_cmp(path, path_len, syntxt, sizeof(syntxt) - 1) == 0) && port == s->http_config_param->autoconf_port &&
-    s->method == HTTP_WKSIDX_GET && s->orig_scheme == URL_WKSIDX_HTTP &&
-    (!s->http_config_param->autoconf_localhost_only || ats_ip4_addr_cast(&s->client_info.addr.sa) == htonl(INADDR_LOOPBACK));
+  s->cop_test_page = (ptr_len_cmp(host, host_len, local_host_ip_str, sizeof(local_host_ip_str) - 1) == 0) &&
+                     (ptr_len_cmp(path, path_len, syntxt, sizeof(syntxt) - 1) == 0) &&
+                     port == s->http_config_param->autoconf_port && s->method == HTTP_WKSIDX_GET &&
+                     s->orig_scheme == URL_WKSIDX_HTTP && ats_ip4_addr_cast(&s->client_info.addr.sa) == htonl(INADDR_LOOPBACK);
 
   //////////////////////////////////////////////////////////////////
   // FIX: this logic seems awfully convoluted and hard to follow; //


[4/4] trafficserver git commit: Added TS-3170

Posted by zw...@apache.org.
Added TS-3170


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/78143684
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/78143684
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/78143684

Branch: refs/heads/master
Commit: 78143684bab977d97ce6986652e2500481a24415
Parents: 5abcec7
Author: Leif Hedstrom <zw...@apache.org>
Authored: Mon Jun 15 10:04:02 2015 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Mon Jun 15 13:43:12 2015 -0600

----------------------------------------------------------------------
 CHANGES | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/78143684/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index f577204..80ffb93 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 6.0.0
 
+  *) [TS-3170] Eliminate proxy pac / autoconf features, and backdoors. This
+   also eliminates almost everything in web2, leaving just a bit of cluster
+   code which I moved to the cmd/traffic_manager code area.
+
   *) [TS-2848] Check for null server in HttpSM::release_server_session
 
   *) [TS-3163] Apply socket configurations to outbound connections.


[3/4] trafficserver git commit: TS-3170 First stab at cleaning out the mgmt web server stuff TS-3170 Remove all of web2, implement very basic server

Posted by zw...@apache.org.
TS-3170 First stab at cleaning out the mgmt web server stuff
TS-3170 Remove all of web2, implement very basic server


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/f84df26f
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/f84df26f
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/f84df26f

Branch: refs/heads/master
Commit: f84df26f6aad26ac2e8e0679b511d23e7539086c
Parents: eff2e4a
Author: Leif Hedstrom <zw...@apache.org>
Authored: Tue Jun 9 22:12:49 2015 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Mon Jun 15 13:04:54 2015 -0600

----------------------------------------------------------------------
 CRUFT.txt                              |   5 -
 cmd/traffic_manager/Makefile.am        |   8 +-
 cmd/traffic_manager/MgmtHandlers.cc    | 276 ++++++++++++
 cmd/traffic_manager/MgmtHandlers.h     |  32 ++
 cmd/traffic_manager/StatType.cc        |   1 +
 cmd/traffic_manager/WebOverview.cc     | 638 ++++++++++++++++++++++++++
 cmd/traffic_manager/WebOverview.h      | 140 ++++++
 cmd/traffic_manager/traffic_manager.cc |  63 ++-
 configure.ac                           |   1 -
 lib/perl/lib/Apache/TS/AdminClient.pm  |   3 -
 mgmt/FileManager.cc                    |   1 -
 mgmt/LocalManager.cc                   |  11 -
 mgmt/LocalManager.h                    |   2 -
 mgmt/Makefile.am                       |   3 +-
 mgmt/RecordsConfig.cc                  |   6 -
 mgmt/Rollback.cc                       |   1 -
 mgmt/cluster/ClusterCom.cc             |   4 -
 mgmt/web2/Makefile.am                  |  49 --
 mgmt/web2/WebCompatibility.cc          | 188 --------
 mgmt/web2/WebCompatibility.h           |  80 ----
 mgmt/web2/WebGlobals.h                 | 133 ------
 mgmt/web2/WebHttp.cc                   | 625 --------------------------
 mgmt/web2/WebHttp.h                    |  45 --
 mgmt/web2/WebHttpContext.cc            | 106 -----
 mgmt/web2/WebHttpContext.h             |  68 ---
 mgmt/web2/WebHttpMessage.cc            | 513 ---------------------
 mgmt/web2/WebHttpMessage.h             | 307 -------------
 mgmt/web2/WebIntrMain.cc               | 533 ----------------------
 mgmt/web2/WebIntrMain.h                |  42 --
 mgmt/web2/WebOverview.cc               | 663 ----------------------------
 mgmt/web2/WebOverview.h                | 145 ------
 mgmt/web2/WebUtils.cc                  | 114 -----
 mgmt/web2/WebUtils.h                   |  52 ---
 proxy/http/HttpConfig.cc               |   2 -
 proxy/http/HttpConfig.h                |   3 +-
 proxy/http/HttpTransact.cc             |   9 +-
 36 files changed, 1140 insertions(+), 3732 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/CRUFT.txt
----------------------------------------------------------------------
diff --git a/CRUFT.txt b/CRUFT.txt
index c8e06f2..5d4a54a 100644
--- a/CRUFT.txt
+++ b/CRUFT.txt
@@ -20,11 +20,6 @@ Store.cc
 near identical code. Often you will read the same confused comment in three
 places, see for instance: http://issues.apache.org/jira/browse/TS-1707
 
-Web2
-====
-``mgmt/web2`` is very old, very broken, very deeply infested code that needs
-to be removed as it is no longer appropriate, or functional.
-Please see https://issues.apache.org/jira/browse/TS-641 for further refernece.
 
 Java
 ====

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/cmd/traffic_manager/Makefile.am
----------------------------------------------------------------------
diff --git a/cmd/traffic_manager/Makefile.am b/cmd/traffic_manager/Makefile.am
index 1e3c856..f29a337 100644
--- a/cmd/traffic_manager/Makefile.am
+++ b/cmd/traffic_manager/Makefile.am
@@ -29,7 +29,6 @@ AM_CPPFLAGS = \
   -I$(top_srcdir)/mgmt/api/include \
   -I$(top_srcdir)/mgmt/cluster \
   -I$(top_srcdir)/mgmt/utils \
-  -I$(top_srcdir)/mgmt/web2 \
   -I$(top_srcdir)/lib \
   -I$(top_builddir)/lib
 
@@ -47,10 +46,13 @@ traffic_manager_SOURCES = \
   StatType.cc \
   StatType.h \
   StatXML.cc \
-  StatXML.h
+  StatXML.h \
+  MgmtHandlers.cc \
+  MgmtHandlers.h \
+  WebOverview.cc \
+  WebOverview.h
 
 traffic_manager_LDADD = \
-  $(top_builddir)/mgmt/web2/libweb.a \
   $(top_builddir)/mgmt/api/libmgmtapilocal.la \
   $(top_builddir)/mgmt/libmgmt_lm.la \
   $(top_builddir)/proxy/hdrs/libhdrs.a \

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/cmd/traffic_manager/MgmtHandlers.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_manager/MgmtHandlers.cc b/cmd/traffic_manager/MgmtHandlers.cc
new file mode 100644
index 0000000..8cb42f2
--- /dev/null
+++ b/cmd/traffic_manager/MgmtHandlers.cc
@@ -0,0 +1,276 @@
+/** @file
+
+    A brief file description
+
+    @section license License
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+*/
+
+/****************************************************************************
+ *
+ *  WebIntrMain.cc - main loop for the Web Interface
+ *
+ ****************************************************************************/
+
+#include "libts.h"
+#include "I_Layout.h"
+#include "LocalManager.h"
+#include "Alarms.h"
+#include "MgmtUtils.h"
+#include "MgmtSocket.h"
+#include "NetworkUtilsRemote.h"
+#include "MIME.h"
+
+// INKqa09866
+#include "TSControlMain.h"
+#include "EventControlMain.h"
+
+int aconf_port_arg = -1;
+
+//  fd newTcpSocket(int port)
+//
+//  returns a file descriptor associated with a new socket
+//    on the specified port
+//
+//  If the socket could not be created, returns -1
+//
+//  Thread Safe: NO!  Call only from main Web interface thread
+//
+static int
+newTcpSocket(int port)
+{
+  struct sockaddr_in socketInfo;
+  int socketFD;
+  int one = 1;
+
+  memset(&socketInfo, 0, sizeof(sockaddr_in));
+
+  // Create the new TCP Socket
+  if ((socketFD = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {
+    mgmt_fatal(stderr, errno, "[newTcpSocket]: %s", "Unable to Create Socket\n");
+    return -1;
+  }
+  // Specify our port number is network order
+  memset(&socketInfo, 0, sizeof(socketInfo));
+  socketInfo.sin_family = AF_INET;
+  socketInfo.sin_port = htons(port);
+  socketInfo.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+
+  // Allow for immediate re-binding to port
+  if (setsockopt(socketFD, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof(int)) < 0) {
+    mgmt_fatal(stderr, errno, "[newTcpSocket] Unable to set socket options.\n");
+  }
+  // Bind the port to the socket
+  if (bind(socketFD, (sockaddr *)&socketInfo, sizeof(socketInfo)) < 0) {
+    mgmt_elog(stderr, 0, "[newTcpSocket] Unable to bind port %d to socket: %s\n", port, strerror(errno));
+    close_socket(socketFD);
+    return -1;
+  }
+  // Listen on the new socket
+  if (listen(socketFD, 5) < 0) {
+    mgmt_elog(stderr, errno, "[newTcpSocket] %s\n", "Unable to listen on the socket");
+    close_socket(socketFD);
+    return -1;
+  }
+  // Set the close on exec flag so our children do not
+  //  have this socket open
+  if (fcntl(socketFD, F_SETFD, 1) < 0) {
+    mgmt_elog(stderr, errno, "[newTcpSocket] Unable to set close on exec flag\n");
+  }
+
+  return socketFD;
+}
+
+bool
+api_socket_is_restricted()
+{
+  RecInt intval;
+
+  // If the socket is not administratively restricted, check whether we have platform
+  // support. Otherwise, default to making it restricted.
+  if (RecGetRecordInt("proxy.config.admin.api.restricted", &intval) == REC_ERR_OKAY) {
+    if (intval == 0) {
+      return !mgmt_has_peereid();
+    }
+  }
+
+  return true;
+}
+
+static const char SyntheticResponse[] = "HTTP/1.0 200 OK\r\n"
+                                        "Server: Traffic Manager\r\n"
+                                        "Date: %s\r\n"
+                                        "Cache-Control: no-store\r\n"
+                                        "Pragma: no-cache\r\n"
+                                        "Content-type: text/plain\r\n"
+                                        "Content-Length: %d\r\n\r\n%s%s%s";
+
+static const char SyntheticData[] = "abcdefghijklmnopqrstuvwxyz\r\n"
+                                    "abcdefghijklmnopqrstuvwxyz\r\n"
+                                    "abcdefghijklmnopqrstuvwxyz\r\n"
+                                    "abcdefghijklmnopqrstuvwxyz\r\n"
+                                    "abcdefghijklmnopqrstuvwxyz\r\n"
+                                    "abcdefghijklmnopqrstuvwxyz\r\n"
+                                    "abcdefghijklmnopqrstuvwxyz\r\n"
+                                    "abcdefghijklmnopqrstuvwxyz\r\n"
+                                    "abcdefghijklmnopqrstuvwxyz\r\n"
+                                    "abcdefghijklmnopqrstuvwxyz\r\n"
+                                    "abcdefghijklmnopqrstuvwxyz\r\n"
+                                    "abcdefghijklmnopqrstuvwxyz\r\n"
+                                    "abcdefghijklmnopqrstuvwxyz\r\n"
+                                    "abcdefghijklmnopqrstuvwxyz\r\n"
+                                    "abcdefghijklmnopqrstuvwxyz\r\n"
+                                    "abcdefghijklmnopqrstuvwxyz\r\n"
+                                    "abcdefghijklmnopqrstuvwxyz\r\n"
+                                    "abcdefghijklmnopqrstuvwxyz\r\n"
+                                    "abcdefghijklmnopqrstuvwxyz\r\n"
+                                    "abcdefghijklmnopqrstuvwxyz\r\n";
+
+static const char RequestStr[] = "GET /synthetic.txt HTTP/1"; // Minimum viable request that we support
+
+void *
+synthetic_thread(void *info)
+{
+  char buffer[4096];
+  char dateBuf[128];
+  char *bufp;
+  int clientFD = *(int *)info;
+  ssize_t bytes;
+  size_t len = 0;
+
+  // Read the request
+  bufp = buffer;
+  while (len < strlen(RequestStr)) {
+    bytes = read(clientFD, buffer, sizeof(buffer));
+    if (bytes < 0) {
+      if (errno == EINTR || errno == EAGAIN) {
+        continue;
+      } else {
+        mgmt_log(stderr, "[SyntheticHealthServer] Failed to read the request");
+        goto error;
+        break;
+      }
+    } else {
+      len += bytes;
+      bufp += bytes;
+    }
+  }
+
+  // Bare minimum check if the request looks reasonable (i.e. from traffic_cop)
+  if (len < strlen(RequestStr) || 0 != strncasecmp(buffer, RequestStr, strlen(RequestStr))) {
+    mgmt_log(stderr, "[SyntheticHealthServer] Unsupported request provided");
+    goto error;
+  }
+
+  // Format the response
+  mime_format_date(dateBuf, time(NULL));
+  len = snprintf(buffer, sizeof(buffer), SyntheticResponse, dateBuf, (int)strlen(SyntheticData) * 3, SyntheticData, SyntheticData,
+                 SyntheticData);
+
+  // Write it
+  bufp = buffer;
+  while (len) {
+    bytes = write(clientFD, buffer, len);
+    if (bytes < 0) {
+      if (errno == EINTR || errno == EAGAIN) {
+        continue;
+      } else {
+        mgmt_log(stderr, "[SyntheticHealthServer] Failed to write the response");
+        goto error;
+        break;
+      }
+    } else {
+      len -= bytes;
+      bufp += bytes;
+    }
+  }
+
+error:
+  close_socket(clientFD);
+  ink_thread_exit(NULL);
+
+  return NULL;
+}
+
+void *
+mgmt_synthetic_main(void *)
+{
+  int autoconfFD = -1;           // FD for incoming autoconf connections
+  int clientFD = -1;             // FD for accepted connections
+  int publicPort = -1;           // Port for incoming autoconf connections
+  struct sockaddr_in clientInfo; // Info about client connection
+  int addrLen;
+
+#if !defined(linux)
+  sigset_t allSigs; // Set of all signals
+#endif
+
+  RecInt tempInt;
+  bool found;
+
+#if !defined(linux)
+  // Start by blocking all signals
+  sigfillset(&allSigs);
+  ink_thread_sigsetmask(SIG_SETMASK, &allSigs, NULL);
+#endif
+
+  if (aconf_port_arg > 0) {
+    publicPort = aconf_port_arg;
+  } else {
+    found = (RecGetRecordInt("proxy.config.admin.autoconf_port", &tempInt) == REC_ERR_OKAY);
+    ink_release_assert(found);
+    publicPort = (int)tempInt;
+  }
+  Debug("ui", "[WebIntrMain] Starting Client AutoConfig Server on Port %d", publicPort);
+
+  if ((autoconfFD = newTcpSocket(publicPort)) < 0) {
+    mgmt_elog(stderr, errno, "[WebIntrMain] Unable to start client autoconf server\n");
+    lmgmt->alarm_keeper->signalAlarm(MGMT_ALARM_WEB_ERROR, "Healthcheck service failed to initialize");
+  }
+
+  while (1) {
+    if ((clientFD = mgmt_accept(autoconfFD, (sockaddr *)&clientInfo, &addrLen)) < 0) {
+      mgmt_log(stderr, "[SyntheticHealthServer] accept() on incoming port failed: %s\n", strerror(errno));
+    } else if (safe_setsockopt(clientFD, IPPROTO_TCP, TCP_NODELAY, SOCKOPT_ON, sizeof(int)) < 0) {
+      mgmt_log(stderr, "[SyntheticHealthServer] Failed to set sock options: %s\n", strerror(errno));
+      close_socket(clientFD);
+    } else if (clientInfo.sin_addr.s_addr != htonl(INADDR_LOOPBACK)) {
+      mgmt_log(stderr, "[SyntheticHealthServer] Connect by disallowed client %s, closing\n", inet_ntoa(clientInfo.sin_addr));
+      close_socket(clientFD);
+    } else {
+      ink_thread thrId = ink_thread_create(synthetic_thread, (void *)&clientFD);
+
+      if (thrId <= 0) {
+        mgmt_log(stderr, "[SyntheticHealthServer] Failed to create worker thread");
+      }
+    }
+  }
+
+  ink_release_assert(!"impossible"); // should never get here
+  return NULL;
+}
+
+/*
+  HTTP/1.0 200 OK
+  Server: Traffic Manager
+  Date: Wed, 10 Jun 2015 04:28:07 GMT
+  Cache-Control: no-store
+  Pragma: no-cache
+  Content-type: text/plain
+  Content-length: 1620
+*/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/cmd/traffic_manager/MgmtHandlers.h
----------------------------------------------------------------------
diff --git a/cmd/traffic_manager/MgmtHandlers.h b/cmd/traffic_manager/MgmtHandlers.h
new file mode 100644
index 0000000..7d9b833
--- /dev/null
+++ b/cmd/traffic_manager/MgmtHandlers.h
@@ -0,0 +1,32 @@
+/** @file
+
+    A brief file description
+
+    @section license License
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+*/
+
+#ifndef _MGMT_HANDLERS_H_
+#define _MGMT_HANDLERS_H_
+
+extern int aconf_port_arg;
+
+void *mgmt_synthetic_main(void *);
+bool api_socket_is_restricted();
+
+#endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/cmd/traffic_manager/StatType.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_manager/StatType.cc b/cmd/traffic_manager/StatType.cc
index 87e362e..11b1484 100644
--- a/cmd/traffic_manager/StatType.cc
+++ b/cmd/traffic_manager/StatType.cc
@@ -35,6 +35,7 @@
 #include "MgmtUtils.h"
 #include "ink_hrtime.h"
 #include "WebOverview.h"
+#include "Tokenizer.h"
 
 bool StatError = false; // global error flag
 bool StatDebug = false; // global debug flag

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/cmd/traffic_manager/WebOverview.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_manager/WebOverview.cc b/cmd/traffic_manager/WebOverview.cc
new file mode 100644
index 0000000..252820d
--- /dev/null
+++ b/cmd/traffic_manager/WebOverview.cc
@@ -0,0 +1,638 @@
+/** @file
+
+  A brief file description
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+/****************************************************************************
+ *
+ *  WebOverview.cc - code to overview page
+ *
+ *
+ ****************************************************************************/
+
+#include "libts.h"
+
+#include "MgmtDefs.h"
+#include "WebOverview.h"
+#include "WebMgmtUtils.h"
+
+#include "LocalManager.h"
+#include "ClusterCom.h"
+#include "MgmtUtils.h"
+#include "MgmtDefs.h"
+#include "Diags.h"
+
+// Make this pointer to avoid nasty destruction
+//   problems do to alarm
+//   fork, execl, exit squences
+overviewPage *overviewGenerator;
+
+overviewRecord::overviewRecord(unsigned long inet_addr, bool local, ClusterPeerInfo *cpi)
+{
+  char *name_l; // hostname looked up from node record
+  bool name_found;
+  struct in_addr nameFailed;
+
+  inetAddr = inet_addr;
+
+  this->up = false;
+  this->localNode = local;
+
+  // If this is the local node, there is no cluster peer info
+  //   record.  Remote nodes require a cluster peer info record
+  ink_assert((local == false && cpi != NULL) || (local == true && cpi == NULL));
+
+  // Set up the copy of the records array and initialize it
+  if (local == true) {
+    node_rec_data.num_recs = 0;
+    node_rec_data.recs = NULL;
+    recordArraySize = 0;
+    node_rec_first_ix = 0;
+  } else {
+    node_rec_data.num_recs = cpi->node_rec_data.num_recs;
+    recordArraySize = node_rec_data.num_recs * sizeof(RecRecord);
+    node_rec_data.recs = new RecRecord[recordArraySize];
+    memcpy(node_rec_data.recs, cpi->node_rec_data.recs, recordArraySize);
+
+    // Recaculate the old relative index
+    RecGetRecordOrderAndId(node_rec_data.recs[0].name, &node_rec_first_ix, NULL);
+  }
+
+
+  // Query for the name of the node.  If it is not there, some
+  //   their cluster ip address
+  name_l = this->readString("proxy.node.hostname_FQ", &name_found);
+  if (name_found == false || name_l == NULL) {
+    nameFailed.s_addr = inetAddr;
+    mgmt_log("[overviewRecord::overviewRecord] Unable to find hostname for %s\n", inet_ntoa(nameFailed));
+    ats_free(name_l); // about to overwrite name_l, so we need to free it first
+    name_l = ats_strdup(inet_ntoa(nameFailed));
+  }
+
+  const size_t hostNameLen = strlen(name_l) + 1;
+  this->hostname = new char[hostNameLen];
+  ink_strlcpy(this->hostname, name_l, hostNameLen);
+  ats_free(name_l);
+}
+
+overviewRecord::~overviewRecord()
+{
+  delete[] hostname;
+
+  if (localNode == false) {
+    delete[] node_rec_data.recs;
+  }
+}
+
+// void overviewRecord::updateStatus(time_t, ClusterPeerInfo*)
+// updates up/down status based on the cluster peer info record
+//
+//   currentTime is the value of localtime(time()) - sent in as
+//     a parameter so we do not have to make repetitive system calls.
+//     overviewPage::checkForUpdates can just make one call
+//
+//   cpi - is a pointer to a structure we got from ClusterCom that represnets
+//         information about this node
+//
+//   a machine is up if we have heard from it in the last 15 seconds
+//
+void
+overviewRecord::updateStatus(time_t currentTime, ClusterPeerInfo *cpi)
+{
+  // Update if the node is up or down
+  if (currentTime - cpi->idle_ticks > 15) {
+    up = false;
+  } else {
+    up = true;
+  }
+
+  // Update the node records by copying them from cpi
+  //  (remote nodes only)
+  if (localNode == false) {
+    memcpy(node_rec_data.recs, cpi->node_rec_data.recs, recordArraySize);
+    RecGetRecordOrderAndId(node_rec_data.recs[0].name, &node_rec_first_ix, NULL);
+  }
+}
+
+// overview::readInteger
+//
+//  Accessor functions for node records.  For remote node,
+//    we get the value in the node_data array we maintain
+//    in this object.  For the node, we do not maintain any data
+//    and rely on lmgmt->record_data for both the retrieval
+//    code and the records array
+//
+//  Locking should be done by overviewPage::accessLock.
+//  CALLEE is responsible for obtaining and releasing the lock
+//
+RecInt
+overviewRecord::readInteger(const char *name, bool *found)
+{
+  RecInt rec = 0;
+  int rec_status = REC_ERR_OKAY;
+  int order = -1;
+  if (localNode == false) {
+    rec_status = RecGetRecordOrderAndId(name, &order, NULL);
+    if (rec_status == REC_ERR_OKAY) {
+      order -= node_rec_first_ix; // Offset
+      ink_release_assert(order < node_rec_data.num_recs);
+      ink_assert(order < node_rec_data.num_recs);
+      rec = node_rec_data.recs[order].data.rec_int;
+    }
+  } else {
+    rec_status = RecGetRecordInt(name, &rec);
+  }
+
+  if (found) {
+    *found = (rec_status == REC_ERR_OKAY);
+  } else {
+    mgmt_log(stderr, "node variables '%s' not found!\n");
+  }
+  return rec;
+}
+
+RecFloat
+overviewRecord::readFloat(const char *name, bool *found)
+{
+  RecFloat rec = 0.0;
+  int rec_status = REC_ERR_OKAY;
+  int order = -1;
+  if (localNode == false) {
+    rec_status = RecGetRecordOrderAndId(name, &order, NULL);
+    if (rec_status == REC_ERR_OKAY) {
+      order -= node_rec_first_ix; // Offset
+      ink_release_assert(order < node_rec_data.num_recs);
+      ink_assert(order < node_rec_data.num_recs);
+      rec = node_rec_data.recs[order].data.rec_float;
+    }
+  } else {
+    rec_status = RecGetRecordFloat(name, &rec);
+  }
+
+  if (found) {
+    *found = (rec_status == REC_ERR_OKAY);
+  } else {
+    mgmt_log(stderr, "node variables '%s' not found!\n");
+  }
+  return rec;
+}
+
+RecString
+overviewRecord::readString(const char *name, bool *found)
+{
+  RecString rec = NULL;
+  int rec_status = REC_ERR_OKAY;
+  int order = -1;
+  if (localNode == false) {
+    rec_status = RecGetRecordOrderAndId(name, &order, NULL);
+    if (rec_status == REC_ERR_OKAY) {
+      order -= node_rec_first_ix; // Offset
+      ink_release_assert(order < node_rec_data.num_recs);
+      ink_assert(order < node_rec_data.num_recs);
+      rec = ats_strdup(node_rec_data.recs[order].data.rec_string);
+    }
+  } else {
+    rec_status = RecGetRecordString_Xmalloc(name, &rec);
+  }
+
+  if (found) {
+    *found = (rec_status == REC_ERR_OKAY);
+  } else {
+    mgmt_log(stderr, "node variables '%s' not found!\n");
+  }
+  return rec;
+}
+
+//  overview::readData, read RecData according varType
+//
+//  Accessor functions for node records.  For remote node,
+//    we get the value in the node_data array we maintain
+//    in this object.  For the node, we do not maintain any data
+//    and rely on lmgmt->record_data for both the retrieval
+//    code and the records array
+//
+//  Locking should be done by overviewPage::accessLock.
+//  CALLEE is responsible for obtaining and releasing the lock
+//
+RecData
+overviewRecord::readData(RecDataT varType, const char *name, bool *found)
+{
+  int rec_status = REC_ERR_OKAY;
+  int order = -1;
+  RecData rec;
+  RecDataClear(RECD_NULL, &rec);
+
+  if (localNode == false) {
+    rec_status = RecGetRecordOrderAndId(name, &order, NULL);
+    if (rec_status == REC_ERR_OKAY) {
+      order -= node_rec_first_ix; // Offset
+      ink_release_assert(order < node_rec_data.num_recs);
+      ink_assert(order < node_rec_data.num_recs);
+      RecDataSet(varType, &rec, &node_rec_data.recs[order].data);
+    } else {
+      Fatal("node variables '%s' not found!\n", name);
+    }
+  } else
+    rec_status = RecGetRecord_Xmalloc(name, varType, &rec, true);
+
+  if (found) {
+    *found = (rec_status == REC_ERR_OKAY);
+  } else {
+    mgmt_log(stderr, "node variables '%s' not found!\n");
+  }
+  return rec;
+}
+
+bool
+overviewRecord::varFloatFromName(const char *name, MgmtFloat *value)
+{
+  bool found = false;
+
+  if (value)
+    *value = readFloat((char *)name, &found);
+
+  return found;
+}
+
+overviewPage::overviewPage() : sortRecords(10, false)
+{
+  ink_mutex_init(&accessLock, "overviewRecord");
+  nodeRecords = ink_hash_table_create(InkHashTableKeyType_Word);
+  numHosts = 0;
+  ourAddr = 0; // We will update this when we add the record for
+  //  this machine
+}
+
+overviewPage::~overviewPage()
+{
+  // Since we only have one global object and we never destruct it
+  //  do not actually free memeory since it causes problems the
+  //  process is vforked, and the child execs something
+  // The below code is DELIBERTLY commented out
+  //
+  // ink_mutex_destroy(&accessLock);
+  // ink_hash_table_destroy(nodeRecords);
+}
+
+// overviewPage::checkForUpdates - updates node records as to whether peers
+//    are up or down
+void
+overviewPage::checkForUpdates()
+{
+  ClusterPeerInfo *tmp;
+  InkHashTableEntry *entry;
+  InkHashTableIteratorState iterator_state;
+  overviewRecord *current;
+  time_t currentTime;
+  bool newHostAdded = false;
+
+  // grok through the cluster communication stuff and update information
+  //  about hosts in the cluster
+  //
+  ink_mutex_acquire(&accessLock);
+  ink_mutex_acquire(&(lmgmt->ccom->mutex));
+  currentTime = time(NULL);
+  for (entry = ink_hash_table_iterator_first(lmgmt->ccom->peers, &iterator_state); entry != NULL;
+       entry = ink_hash_table_iterator_next(lmgmt->ccom->peers, &iterator_state)) {
+    tmp = (ClusterPeerInfo *)ink_hash_table_entry_value(lmgmt->ccom->peers, entry);
+
+    if (ink_hash_table_lookup(nodeRecords, (InkHashTableKey)tmp->inet_address, (InkHashTableValue *)&current) == 0) {
+      this->addRecord(tmp);
+      newHostAdded = true;
+    } else {
+      current->updateStatus(currentTime, tmp);
+    }
+  }
+  ink_mutex_release(&lmgmt->ccom->mutex);
+
+  // If we added a new host we must resort sortRecords
+  if (newHostAdded) {
+    this->sortHosts();
+  }
+
+  ink_mutex_release(&accessLock);
+}
+
+
+// overrviewPage::sortHosts()
+//
+// resorts sortRecords, but always leaves the local node
+//   as the first record
+//
+// accessLock must be held by callee
+void
+overviewPage::sortHosts()
+{
+  void **array = sortRecords.getArray();
+
+  qsort(array + 1, numHosts - 1, sizeof(void *), hostSortFunc);
+}
+
+// overviewPage::addRecord(ClusterPerrInfo* cpi)
+//   Adds a new node record
+//   Assuems that this->accessLock is already held
+//
+void
+overviewPage::addRecord(ClusterPeerInfo *cpi)
+{
+  overviewRecord *newRec;
+
+  ink_assert(cpi != NULL);
+
+  newRec = new overviewRecord(cpi->inet_address, false, cpi);
+  newRec->updateStatus(time(NULL), cpi);
+
+  ink_hash_table_insert(nodeRecords, (InkHashTableKey)cpi->inet_address, (InkHashTableEntry *)newRec);
+
+  sortRecords.addEntry(newRec);
+  numHosts++;
+}
+
+// adds a record to nodeRecords for the local machine.
+//   gets IP addr from lmgmt->ccom so cluster communtication
+//   must be intialized before calling this function
+//
+//
+void
+overviewPage::addSelfRecord()
+{
+  overviewRecord *newRec;
+
+  ink_mutex_acquire(&accessLock);
+
+  // We should not have been called before
+  ink_assert(ourAddr == 0);
+
+  // Find out what our cluster addr is from
+  //   from cluster com
+  this->ourAddr = lmgmt->ccom->getIP();
+
+  newRec = new overviewRecord(ourAddr, true);
+  newRec->up = true;
+
+  ink_hash_table_insert(nodeRecords, (InkHashTableKey) this->ourAddr, (InkHashTableEntry *)newRec);
+
+  sortRecords.addEntry(newRec);
+  numHosts++;
+  ink_mutex_release(&accessLock);
+}
+
+// overviewRecord* overviewPage::findNodeByName(const char* nodeName)
+//
+//   Returns a pointer to node name nodeName
+//     If node name is not found, returns NULL
+//
+//   CALLEE MUST BE HOLDING this->accessLock
+//
+overviewRecord *
+overviewPage::findNodeByName(const char *nodeName)
+{
+  overviewRecord *current = NULL;
+  bool nodeFound = false;
+
+  // Do a linear search of the nodes for this nodeName.
+  //   Yes, I know this is slow but the current word is ten
+  //   nodes would be a huge cluster so this should not
+  //   be a problem
+  //
+  for (int i = 0; i < numHosts; i++) {
+    current = (overviewRecord *)sortRecords[i];
+    if (strcmp(nodeName, current->hostname) == 0) {
+      nodeFound = true;
+      break;
+    }
+  }
+
+  if (nodeFound == true) {
+    return current;
+  } else {
+    return NULL;
+  }
+}
+
+// MgmtString overviewPage::readString(const char* nodeName, char* *name, bool *found = NULL)
+//
+//   Looks up a node record for a specific by nodeName
+//    CALLEE deallocates the string with free()
+//
+MgmtString
+overviewPage::readString(const char *nodeName, const char *name, bool *found)
+{
+  MgmtString r = NULL;
+  //  bool nodeFound = false;
+  bool valueFound = false;
+  overviewRecord *node;
+
+  ink_mutex_acquire(&accessLock);
+
+  node = this->findNodeByName(nodeName);
+
+  if (node != NULL) {
+    r = node->readString(name, &valueFound);
+  }
+  ink_mutex_release(&accessLock);
+
+  if (found != NULL) {
+    *found = valueFound;
+  }
+
+  return r;
+}
+
+// MgmtInt overviewPage::readInteger(const char* nodeName, char* *name, bool *found = NULL)
+//
+//   Looks up a node record for a specific by nodeName
+//
+MgmtInt
+overviewPage::readInteger(const char *nodeName, const char *name, bool *found)
+{
+  MgmtInt r = -1;
+  //  bool nodeFound = false;
+  bool valueFound = false;
+  overviewRecord *node;
+
+  ink_mutex_acquire(&accessLock);
+
+  node = this->findNodeByName(nodeName);
+
+  if (node != NULL) {
+    r = node->readInteger(name, &valueFound);
+  }
+  ink_mutex_release(&accessLock);
+
+  if (found != NULL) {
+    *found = valueFound;
+  }
+
+  return r;
+}
+
+// MgmtFloat overviewPage::readFloat(const char* nodeName, char* *name, bool *found = NULL)
+//
+//   Looks up a node record for a specific by nodeName
+//
+RecFloat
+overviewPage::readFloat(const char *nodeName, const char *name, bool *found)
+{
+  RecFloat r = -1.0;
+  //  bool nodeFound = false;
+  bool valueFound = false;
+  overviewRecord *node;
+
+  ink_mutex_acquire(&accessLock);
+
+  node = this->findNodeByName(nodeName);
+
+  if (node != NULL) {
+    r = node->readFloat(name, &valueFound);
+  }
+  ink_mutex_release(&accessLock);
+
+  if (found != NULL) {
+    *found = valueFound;
+  }
+
+  return r;
+}
+
+// int overviewPage::clusterSumData(RecDataT varType, const char* nodeVar,
+//                                  RecData* sum)
+//
+//   Sums nodeVar for every up node in the cluster and stores the
+//     sum in *sum.  Returns the number of nodes summed over
+//
+//   CALLEE MUST HOLD this->accessLock
+//
+int
+overviewPage::clusterSumData(RecDataT varType, const char *nodeVar, RecData *sum)
+{
+  int numUsed = 0;
+  int numHosts_local = sortRecords.getNumEntries();
+  overviewRecord *current;
+  bool found;
+  RecData recTmp;
+
+  ink_assert(sum != NULL);
+  RecDataClear(varType, sum);
+
+  for (int i = 0; i < numHosts_local; i++) {
+    current = (overviewRecord *)sortRecords[i];
+    if (current->up == true) {
+      numUsed++;
+      recTmp = current->readData(varType, nodeVar, &found);
+      *sum = RecDataAdd(varType, *sum, recTmp);
+      if (found == false) {
+      }
+    }
+  }
+  return numUsed;
+}
+
+int
+overviewPage::varClusterDataFromName(RecDataT varType, char *nodeVar, RecData *sum)
+{
+  int status = 0;
+
+  ink_mutex_acquire(&accessLock);
+
+  status = clusterSumData(varType, nodeVar, sum);
+
+  ink_mutex_release(&accessLock);
+
+  return (status);
+}
+
+// Moved from the now removed StatAggregation.cc
+void
+AgFloat_generic_scale_to_int(const char *processVar, const char *nodeVar, double factor)
+{
+  MgmtFloat tmp;
+
+  if (varFloatFromName(processVar, &tmp)) {
+    tmp = tmp * factor;
+    tmp = tmp + 0.5; // round up.
+    varSetInt(nodeVar, (int)tmp);
+  } else {
+    varSetInt(nodeVar, -20);
+  }
+}
+
+// char* overviewPage::resolvePeerHostname(char* peerIP)
+//
+//   A locking interface to overviewPage::resolvePeerHostname_ml
+//
+char *
+overviewPage::resolvePeerHostname(const char *peerIP)
+{
+  char *r;
+
+  ink_mutex_acquire(&accessLock);
+  r = this->resolvePeerHostname_ml(peerIP);
+  ink_mutex_release(&accessLock);
+
+  return r;
+}
+
+// char* overviewPage::resolvePeerHostname_ml(char* peerIP)
+//
+// Resolves the peer the hostname from its IP address
+//   The hostname is resolved by finding the overviewRecord
+//   Associated with the IP address and copying its hostname
+//
+// CALLEE frees storage
+// CALLEE is responsible for locking
+//
+char *
+overviewPage::resolvePeerHostname_ml(const char *peerIP)
+{
+  unsigned long int ipAddr;
+  InkHashTableValue lookup;
+  overviewRecord *peerRecord;
+  char *returnName = NULL;
+
+  ipAddr = inet_addr(peerIP);
+
+  // Check to see if our address is malformed
+  if ((long int)ipAddr == -1) {
+    return NULL;
+  }
+
+  if (ink_hash_table_lookup(nodeRecords, (InkHashTableKey)ipAddr, &lookup)) {
+    peerRecord = (overviewRecord *)lookup;
+    returnName = ats_strdup(peerRecord->hostname);
+  }
+
+  return returnName;
+}
+
+// int hostSortFunc(const void* arg1, const void* arg2)
+//
+//   A compare function that we can to qsort that sorts
+//    overviewRecord*
+//
+int
+hostSortFunc(const void *arg1, const void *arg2)
+{
+  overviewRecord *rec1 = (overviewRecord *)*(void **)arg1;
+  overviewRecord *rec2 = (overviewRecord *)*(void **)arg2;
+
+  return strcmp(rec1->hostname, rec2->hostname);
+}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/cmd/traffic_manager/WebOverview.h
----------------------------------------------------------------------
diff --git a/cmd/traffic_manager/WebOverview.h b/cmd/traffic_manager/WebOverview.h
new file mode 100644
index 0000000..447cfa5
--- /dev/null
+++ b/cmd/traffic_manager/WebOverview.h
@@ -0,0 +1,140 @@
+/** @file
+
+  A brief file description
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#ifndef _WEB_OVERVIEW_H_
+#define _WEB_OVERVIEW_H_
+
+#include "ink_hash_table.h"
+#include "ink_mutex.h"
+#include "TextBuffer.h"
+#include "List.h"
+
+#include "ExpandingArray.h"
+#include "ClusterCom.h"
+
+#include "P_RecCore.h"
+
+/****************************************************************************
+ *
+ *  WebOverview.h - code to overview page
+ *
+ *
+ ****************************************************************************/
+
+//
+//  There is one instance of the class overviewPage in the LocalManger
+//    process.  The overviewPage instance stores a record of type
+//    overviewRecord for each node that has been seen in the cluster.
+//    The node records contain a list of active alarms on that node.
+//
+//  overviewPage is responsible for the synchronization issues for both
+//    it self and all of its overviewRecords.  Whenever updates are made
+//    to instances of either class, overviewPage's accessLock must be held.
+//
+//  Pointers to overviewRecords are stored in overviewPage::nodeRecords
+//    hash table which is indexed on the nodes ip address (as an
+//    unsigned long).  A second mapping is also maintained in sortRecords.
+//
+//
+//  Additional Notes
+//
+//  These classes have expanded over time.  overviewPage and
+//    overviewRecord are now clearing houses of cluster information
+//    for the UI.
+//  To simplify the locking issues, pointer to overviewRecords should
+//    NOT be returned by overviewPage.  overviewRecords are internal
+//    to overviewPage and any data needed from an overviewRecord
+//    should be returned as a copy (or a const ptr)
+//    through an accessor function
+
+// information about a specific node in the cluster
+class overviewRecord
+{
+public:
+  overviewRecord(unsigned long inet_addr, bool local, ClusterPeerInfo *cpi = NULL);
+
+  ~overviewRecord();
+
+  void updateStatus(time_t currentTime, ClusterPeerInfo *cpi);
+
+  bool up;
+  bool localNode;
+  char *hostname;         // FQ hostname of the node
+  unsigned long inetAddr; // IP address of the node
+  RecInt readInteger(const char *name, bool *found);
+  RecFloat readFloat(const char *name, bool *found);
+  RecString readString(const char *name, bool *found);
+  RecData readData(RecDataT varType, const char *name, bool *found);
+  bool varFloatFromName(const char *varName, RecFloat *value);
+
+private:
+  RecRecords node_rec_data; // a copy from ClusterPeerInfo
+  int recordArraySize;      // the size of node_data.recs
+  int node_rec_first_ix;    // Kludge, but store the first order ix for later use
+  overviewRecord(const overviewRecord &);
+};
+
+// information about the entire cluster
+class overviewPage
+{
+public:
+  overviewPage();
+  ~overviewPage();
+
+  void checkForUpdates();
+  char *resolvePeerHostname(const char *peerIP);
+  char *resolvePeerHostname_ml(const char *peerIP);
+  MgmtInt readInteger(const char *nodeName, const char *name, bool *found = NULL);
+  MgmtFloat readFloat(const char *nodeName, const char *name, bool *found = NULL);
+  MgmtString readString(const char *nodeName, const char *name, bool *found = NULL);
+  void addSelfRecord();
+
+  int varClusterDataFromName(RecDataT varType, char *nodeVar, RecData *sum);
+
+private:
+  ink_mutex accessLock;
+
+  // Private fcns
+  overviewPage(const overviewPage &);
+  void addRecord(ClusterPeerInfo *cpi);
+  overviewRecord *findNodeByName(const char *nodeName);
+  void addReading(MgmtInt reading, textBuffer *output, int nDigits, const char **gifs, const char **alts);
+  void addLoadBar(textBuffer *output, MgmtInt load);
+  void sortHosts();
+  bool moreInfoButton(const char *submission, textBuffer *output);
+
+  // Private variables
+  InkHashTable *nodeRecords;  // container for overviewRecords
+  unsigned long ourAddr;      // the IP address of this node
+  ExpandingArray sortRecords; // A second, sorted container for nodeRecords
+  int numHosts;               // number of peers we know about including ourself
+
+  int clusterSumData(RecDataT varType, const char *nodeVar, RecData *sum);
+};
+
+extern overviewPage *overviewGenerator; // global handle to overiewPage?
+                                        // defn found in WebOverview.cc
+
+int hostSortFunc(const void *arg1, const void *arg2);
+
+#endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/cmd/traffic_manager/traffic_manager.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_manager/traffic_manager.cc b/cmd/traffic_manager/traffic_manager.cc
index 5516a42..8bf13ed 100644
--- a/cmd/traffic_manager/traffic_manager.cc
+++ b/cmd/traffic_manager/traffic_manager.cc
@@ -21,32 +21,31 @@
   limitations under the License.
  */
 
-#include "libts.h"
 #include "ink_sys_control.h"
 #include "ink_cap.h"
 
-#include "MgmtUtils.h"
 #include "WebMgmtUtils.h"
-#include "WebIntrMain.h"
-#include "WebOverview.h"
+#include "NetworkUtilsRemote.h"
 #include "ClusterCom.h"
 #include "VMap.h"
 #include "FileManager.h"
 #include "I_Layout.h"
 #include "I_Version.h"
-#include "Diags.h"
 #include "DiagsConfig.h"
-#include "URL.h"
-#include "MIME.h"
 #include "HTTP.h"
 #include "CoreAPI.h"
 
+#include "LocalManager.h"
+#include "TSControlMain.h"
+#include "EventControlMain.h"
+
+#include "MgmtHandlers.h"
+
 // Needs LibRecordsConfigInit()
 #include "RecordsConfig.h"
 
 #include "StatProcessor.h"
 #include "P_RecLocal.h"
-#include "P_RecCore.h"
 
 #if TS_USE_POSIX_CAP
 #include <sys/capability.h>
@@ -397,7 +396,7 @@ main(int argc, const char **argv)
   char userToRunAs[MAX_LOGIN + 1];
   RecInt fds_throttle = -1;
   time_t ticker;
-  ink_thread webThrId;
+  ink_thread synthThrId;
 
   ArgumentDescription argument_descriptions[] = {
     {"proxyOff", '-', "Disable proxy", "F", &proxy_off, NULL, NULL},
@@ -487,11 +486,6 @@ main(int argc, const char **argv)
 
   if (diags) {
     delete diagsConfig;
-    // diagsConfig->reconfigure_diags(); INKqa11968
-    /*
-       delete diags;
-       diags = new Diags(debug_tags,action_tags);
-     */
   }
   // INKqa11968: need to set up callbacks and diags data structures
   // using configuration in records.config
@@ -512,8 +506,6 @@ main(int argc, const char **argv)
   RecSetRecordString("proxy.node.version.manager.build_date", appVersionInfo.BldDateStr);
   RecSetRecordString("proxy.node.version.manager.build_machine", appVersionInfo.BldMachineStr);
   RecSetRecordString("proxy.node.version.manager.build_person", appVersionInfo.BldPersonStr);
-  //    RecSetRecordString("proxy.node.version.manager.build_compile_flags",
-  //                       appVersionInfo.BldCompileFlagsStr);
 
   if (!disable_syslog) {
     char sys_var[] = "proxy.config.syslog_facility";
@@ -609,17 +601,46 @@ main(int argc, const char **argv)
   // Now that we know our cluster ip address, add the
   //   UI record for this machine
   overviewGenerator->addSelfRecord();
-
   lmgmt->listenForProxy();
 
   //
   // As listenForProxy() may change/restore euid, we should put
-  // the creation of webIntr_main thread after it. So that we
+  // the creation of mgmt_synthetic_main thread after it. So that we
   // can keep a consistent euid when create mgmtapi/eventapi unix
-  // sockets in webIntr_main thread.
+  // sockets in mgmt_synthetic_main thread.
   //
-  webThrId = ink_thread_create(webIntr_main, NULL); /* Spin web agent thread */
-  Debug("lm", "Created Web Agent thread (%" PRId64 ")", (int64_t)webThrId);
+  synthThrId = ink_thread_create(mgmt_synthetic_main, NULL); /* Spin web agent thread */
+  Debug("lm", "Created Web Agent thread (%" PRId64 ")", (int64_t)synthThrId);
+
+  // Setup the API and event sockets
+  ats_scoped_str rundir(RecConfigReadRuntimeDir());
+  ats_scoped_str apisock(Layout::relative_to(rundir, MGMTAPI_MGMT_SOCKET_NAME));
+  ats_scoped_str eventsock(Layout::relative_to(rundir, MGMTAPI_EVENT_SOCKET_NAME));
+
+  mode_t oldmask = umask(0);
+  mode_t newmode = api_socket_is_restricted() ? 00700 : 00777;
+
+  int mgmtapiFD = -1;  // FD for the api interface to issue commands
+  int eventapiFD = -1; // FD for the api and clients to handle event callbacks
+  char mgmtapiFailMsg[] = "Traffic server management API service Interface Failed to Initialize.";
+
+  mgmtapiFD = bind_unix_domain_socket(apisock, newmode);
+  if (mgmtapiFD == -1) {
+    mgmt_log(stderr, "[WebIntrMain] Unable to set up socket for handling management API calls. API socket path = %s\n",
+             (const char *)apisock);
+    lmgmt->alarm_keeper->signalAlarm(MGMT_ALARM_WEB_ERROR, mgmtapiFailMsg);
+  }
+
+  eventapiFD = bind_unix_domain_socket(eventsock, newmode);
+  if (eventapiFD == -1) {
+    mgmt_log(stderr, "[WebIntrMain] Unable to set up so for handling management API event calls. Event Socket path: %s\n",
+             (const char *)eventsock);
+  }
+
+  umask(oldmask);
+  ink_thread_create(ts_ctrl_main, &mgmtapiFD);
+  ink_thread_create(event_callback_main, &eventapiFD);
+
 
   ticker = time(NULL);
   mgmt_log("[TrafficManager] Setup complete\n");

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index e3a91a0..440dcea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1867,7 +1867,6 @@ AC_CONFIG_FILES([
   mgmt/api/include/Makefile
   mgmt/cluster/Makefile
   mgmt/utils/Makefile
-  mgmt/web2/Makefile
   plugins/Makefile
   plugins/cacheurl/Makefile
   plugins/conf_remap/Makefile

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/lib/perl/lib/Apache/TS/AdminClient.pm
----------------------------------------------------------------------
diff --git a/lib/perl/lib/Apache/TS/AdminClient.pm b/lib/perl/lib/Apache/TS/AdminClient.pm
index cfa824f..6dd8a6f 100644
--- a/lib/perl/lib/Apache/TS/AdminClient.pm
+++ b/lib/perl/lib/Apache/TS/AdminClient.pm
@@ -310,10 +310,7 @@ The Apache Traffic Server Administration Manual will explain what these strings
  proxy.config.accept_threads
  proxy.config.task_threads
  proxy.config.admin.admin_user
- proxy.config.admin.autoconf.localhost_only
- proxy.config.admin.autoconf.pac_filename
  proxy.config.admin.autoconf_port
- proxy.config.admin.autoconf.doc_root
  proxy.config.admin.cli_path
  proxy.config.admin.number_config_bak
  proxy.config.admin.user_id

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/mgmt/FileManager.cc
----------------------------------------------------------------------
diff --git a/mgmt/FileManager.cc b/mgmt/FileManager.cc
index b4a6ca2..55e1dd8 100644
--- a/mgmt/FileManager.cc
+++ b/mgmt/FileManager.cc
@@ -28,7 +28,6 @@
 #include "Rollback.h"
 #include "WebMgmtUtils.h"
 #include "MgmtUtils.h"
-#include "WebGlobals.h"
 #include "ExpandingArray.h"
 #include "MgmtSocket.h"
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/mgmt/LocalManager.cc
----------------------------------------------------------------------
diff --git a/mgmt/LocalManager.cc b/mgmt/LocalManager.cc
index bd9d587..bf42a79 100644
--- a/mgmt/LocalManager.cc
+++ b/mgmt/LocalManager.cc
@@ -142,17 +142,6 @@ LocalManager::clearStats(const char *name)
   }
 }
 
-// void LocalManager::syslogThrInit()
-//
-//    On the DEC, syslog is per thread.  This function
-//      allows a thread to init syslog with the appropriate
-//      configuration
-//
-void
-LocalManager::syslogThrInit()
-{
-}
-
 // bool LocalManager::clusterOk()
 //
 //   Returns false if the proxy has been up for more than

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/mgmt/LocalManager.h
----------------------------------------------------------------------
diff --git a/mgmt/LocalManager.h b/mgmt/LocalManager.h
index 5418de7..45ea4cc 100644
--- a/mgmt/LocalManager.h
+++ b/mgmt/LocalManager.h
@@ -101,8 +101,6 @@ public:
     internal_ticker = 0;
   }
 
-  void syslogThrInit();
-
   volatile bool run_proxy;
   volatile time_t manager_started_at;
   volatile time_t proxy_started_at;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/mgmt/Makefile.am
----------------------------------------------------------------------
diff --git a/mgmt/Makefile.am b/mgmt/Makefile.am
index d1b93a1..da907b4 100644
--- a/mgmt/Makefile.am
+++ b/mgmt/Makefile.am
@@ -17,7 +17,7 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-SUBDIRS = cluster utils web2 api
+SUBDIRS = cluster utils api
 
 # Decoder ring:
 # 	libmgmt_c.la 	Configuration records (defaults).
@@ -30,7 +30,6 @@ AM_CPPFLAGS = \
   -I$(top_srcdir)/mgmt/api/include \
   -I$(top_srcdir)/mgmt/cluster \
   -I$(top_srcdir)/mgmt/utils \
-  -I$(top_srcdir)/mgmt/web2 \
   -I$(top_srcdir)/proxy/api/ts \
   -I$(top_srcdir)/proxy \
   -I$(top_srcdir)/proxy/hdrs \

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/mgmt/RecordsConfig.cc
----------------------------------------------------------------------
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index 1e5d8e6..7699d93 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -252,12 +252,6 @@ static const RecordElement RecordsConfig[] =
   ,
   {RECT_CONFIG, "proxy.config.admin.autoconf_port", RECD_INT, "8083", RECU_RESTART_TM, RR_REQUIRED, RECC_INT, "[0-65535]", RECA_NULL}
   ,
-  {RECT_CONFIG, "proxy.config.admin.autoconf.doc_root", RECD_STRING, TS_BUILD_SYSCONFDIR, RECU_NULL, RR_REQUIRED, RECC_NULL, NULL, RECA_NULL}
-  ,
-  {RECT_CONFIG, "proxy.config.admin.autoconf.localhost_only", RECD_INT, "1", RECU_RESTART_TM, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
-  ,
-  {RECT_CONFIG, "proxy.config.admin.autoconf.pac_filename", RECD_STRING, "proxy.pac", RECU_DYNAMIC, RR_NULL, RECC_NULL, NULL, RECA_NULL}
-  ,
   {RECT_CONFIG, "proxy.config.admin.admin_user", RECD_STRING, "admin", RECU_DYNAMIC, RR_REQUIRED, RECC_STR, ".+", RECA_NO_ACCESS}
   ,
   {RECT_CONFIG, "proxy.config.admin.number_config_bak", RECD_INT, "3", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/mgmt/Rollback.cc
----------------------------------------------------------------------
diff --git a/mgmt/Rollback.cc b/mgmt/Rollback.cc
index 083f257..a218a7d 100644
--- a/mgmt/Rollback.cc
+++ b/mgmt/Rollback.cc
@@ -25,7 +25,6 @@
 #include "LocalManager.h"
 #include "Rollback.h"
 #include "WebMgmtUtils.h"
-#include "WebGlobals.h"
 #include "MgmtUtils.h"
 #include "ExpandingArray.h"
 #include "MgmtSocket.h"

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/mgmt/cluster/ClusterCom.cc
----------------------------------------------------------------------
diff --git a/mgmt/cluster/ClusterCom.cc b/mgmt/cluster/ClusterCom.cc
index 1766c85..58366c0 100644
--- a/mgmt/cluster/ClusterCom.cc
+++ b/mgmt/cluster/ClusterCom.cc
@@ -65,8 +65,6 @@ drainIncomingChannel_broadcast(void *arg)
     mgmt_sleep_sec(1);
   }
 
-  lmgmt->syslogThrInit();
-
   for (;;) { /* Loop draining mgmt network channels */
     int nevents = 0;
 
@@ -156,8 +154,6 @@ drainIncomingChannel(void *arg)
     mgmt_sleep_sec(1);
   }
 
-  lmgmt->syslogThrInit();
-
   for (;;) { /* Loop draining mgmt network channels */
     ink_zero(message);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/mgmt/web2/Makefile.am
----------------------------------------------------------------------
diff --git a/mgmt/web2/Makefile.am b/mgmt/web2/Makefile.am
deleted file mode 100644
index 6703fe9..0000000
--- a/mgmt/web2/Makefile.am
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-# Makefile.am for the Enterprise Management module.
-#
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you under the Apache License, Version 2.0 (the
-#  "License"); you may not use this file except in compliance
-#  with the License.  You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
-
-AM_CPPFLAGS = \
-  -I$(top_srcdir)/iocore/utils \
-  -I$(top_srcdir)/lib/records \
-  -I$(top_srcdir)/lib/ts \
-  -I$(top_srcdir)/mgmt \
-  -I$(top_srcdir)/mgmt/api \
-  -I$(top_srcdir)/mgmt/api/include \
-  -I$(top_srcdir)/mgmt/cluster \
-  -I$(top_srcdir)/mgmt/utils \
-  -I$(top_srcdir)/proxy/hdrs \
-  -I$(top_srcdir)/lib \
-  -I$(top_builddir)/lib
-
-noinst_LIBRARIES = libweb.a
-libweb_a_SOURCES = \
-  WebCompatibility.cc \
-  WebCompatibility.h \
-  WebGlobals.h \
-  WebHttp.cc \
-  WebHttp.h \
-  WebHttpContext.cc \
-  WebHttpContext.h \
-  WebHttpMessage.cc \
-  WebHttpMessage.h \
-  WebIntrMain.cc \
-  WebIntrMain.h \
-  WebOverview.cc \
-  WebOverview.h \
-  WebUtils.cc \
-  WebUtils.h

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/mgmt/web2/WebCompatibility.cc
----------------------------------------------------------------------
diff --git a/mgmt/web2/WebCompatibility.cc b/mgmt/web2/WebCompatibility.cc
deleted file mode 100644
index 4f42c25..0000000
--- a/mgmt/web2/WebCompatibility.cc
+++ /dev/null
@@ -1,188 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-/****************************************************************************
- *
- *  WebCompatibility.cc - cross platform issues dealt with here
- *
- *
- ****************************************************************************/
-
-#include "WebCompatibility.h"
-#include "MgmtSocket.h"
-
-//-------------------------------------------------------------------------
-// WebGetHostname_Xmalloc
-//-------------------------------------------------------------------------
-
-char *
-WebGetHostname_Xmalloc(sockaddr_in *client_info)
-{
-  ink_gethostbyaddr_r_data data;
-  char *hostname_tmp;
-
-  struct hostent *r =
-    ink_gethostbyaddr_r((char *)&client_info->sin_addr.s_addr, sizeof(client_info->sin_addr.s_addr), AF_INET, &data);
-
-  hostname_tmp = r ? r->h_name : inet_ntoa(client_info->sin_addr);
-  return ats_strdup(hostname_tmp);
-}
-
-//-------------------------------------------------------------------------
-// WebFileOpenR
-//-------------------------------------------------------------------------
-
-WebHandle
-WebFileOpenR(const char *file)
-{
-  WebHandle h_file;
-  if ((h_file = mgmt_open(file, O_RDONLY)) < 0) {
-    return WEB_HANDLE_INVALID;
-  }
-  return h_file;
-}
-
-//-------------------------------------------------------------------------
-// WebFileOpenW
-//-------------------------------------------------------------------------
-
-WebHandle
-WebFileOpenW(const char *file)
-{
-  WebHandle h_file;
-
-  if ((h_file = mgmt_open_mode(file, O_WRONLY | O_APPEND | O_CREAT, 0644)) < 0) {
-    return WEB_HANDLE_INVALID;
-  }
-  fcntl(h_file, F_SETFD, 1);
-
-  return h_file;
-}
-
-//-------------------------------------------------------------------------
-// WebFileClose
-//-------------------------------------------------------------------------
-
-void
-WebFileClose(WebHandle h_file)
-{
-  close(h_file);
-}
-
-//-------------------------------------------------------------------------
-// WebFileRead
-//-------------------------------------------------------------------------
-
-int
-WebFileRead(WebHandle h_file, char *buf, int size, int *bytes_read)
-{
-  if ((*bytes_read = ::read(h_file, buf, size)) < 0) {
-    *bytes_read = 0;
-    return WEB_HTTP_ERR_FAIL;
-  }
-  return WEB_HTTP_ERR_OKAY;
-}
-
-//-------------------------------------------------------------------------
-// WebFileWrite
-//-------------------------------------------------------------------------
-
-int
-WebFileWrite(WebHandle h_file, char *buf, int size, int *bytes_written)
-{
-  if ((*bytes_written = ::write(h_file, buf, size)) < 0) {
-    *bytes_written = 0;
-    return WEB_HTTP_ERR_FAIL;
-  }
-  return WEB_HTTP_ERR_OKAY;
-}
-
-//-------------------------------------------------------------------------
-// WebFileImport_Xmalloc
-//-------------------------------------------------------------------------
-
-int
-WebFileImport_Xmalloc(const char *file, char **file_buf, int *file_size)
-{
-  int err = WEB_HTTP_ERR_OKAY;
-  WebHandle h_file = WEB_HANDLE_INVALID;
-  int bytes_read;
-
-  *file_buf = 0;
-  *file_size = 0;
-
-  if ((h_file = WebFileOpenR(file)) == WEB_HANDLE_INVALID)
-    goto Lerror;
-  *file_size = WebFileGetSize(h_file);
-  *file_buf = (char *)ats_malloc(*file_size + 1);
-  if (WebFileRead(h_file, *file_buf, *file_size, &bytes_read) == WEB_HTTP_ERR_FAIL)
-    goto Lerror;
-  if (bytes_read != *file_size)
-    goto Lerror;
-  (*file_buf)[*file_size] = '\0';
-
-  goto Ldone;
-
-Lerror:
-
-  ats_free(*file_buf);
-  *file_buf = 0;
-  *file_size = 0;
-  err = WEB_HTTP_ERR_FAIL;
-
-Ldone:
-  if (h_file != WEB_HANDLE_INVALID)
-    WebFileClose(h_file);
-
-  return err;
-}
-
-//-------------------------------------------------------------------------
-// WebFileGetSize
-//-------------------------------------------------------------------------
-
-int
-WebFileGetSize(WebHandle h_file)
-{
-  int size;
-
-  struct stat fileStats;
-  fstat(h_file, &fileStats);
-  size = fileStats.st_size;
-  return size;
-}
-
-//-------------------------------------------------------------------------
-// WebFileGetDateGmt
-//-------------------------------------------------------------------------
-
-time_t
-WebFileGetDateGmt(WebHandle h_file)
-{
-  time_t date;
-
-  struct stat fileStats;
-  fstat(h_file, &fileStats);
-  date = fileStats.st_mtime + ink_timezone();
-  return date;
-}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/mgmt/web2/WebCompatibility.h
----------------------------------------------------------------------
diff --git a/mgmt/web2/WebCompatibility.h b/mgmt/web2/WebCompatibility.h
deleted file mode 100644
index 4bf9760..0000000
--- a/mgmt/web2/WebCompatibility.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-/****************************************************************************
- *
- *  WebCompatibility.h - cross platform issues dealt with here
- *
- *
- ****************************************************************************/
-
-#ifndef _WEB_COMPATIBILITY_H_
-#define _WEB_COMPATIBILITY_H_
-
-#include "ink_platform.h"
-#include "ink_defs.h"
-#include "ink_inet.h"
-#include "ink_string.h"
-#include "ink_time.h"
-
-#include "WebGlobals.h"
-
-//-------------------------------------------------------------------------
-// types/defines
-//-------------------------------------------------------------------------
-
-#define WEB_HANDLE_INVALID -1
-typedef int WebHandle;
-
-//-------------------------------------------------------------------------
-// WebGetHostname
-//-------------------------------------------------------------------------
-
-#if defined(freebsd)
-// extern "C" struct hostent *gethostbyaddr_r(const char *addr, int length, int type,
-//                                  struct hostent *result, char *buffer, int buflen, int *h_errnop);
-#endif
-
-#if defined(solaris)
-extern "C" {
-struct hostent *gethostbyaddr_r(const char *addr, int length, int type, struct hostent *result, char *buffer, int buflen,
-                                int *h_errnop);
-}
-#endif
-
-char *WebGetHostname_Xmalloc(sockaddr_in *client_info);
-
-//-------------------------------------------------------------------------
-// WebFile
-//-------------------------------------------------------------------------
-
-WebHandle WebFileOpenR(const char *file);
-WebHandle WebFileOpenW(const char *file);
-void WebFileClose(WebHandle h_file);
-int WebFileRead(WebHandle h_file, char *buf, int size, int *bytes_read);
-int WebFileWrite(WebHandle h_file, char *buf, int size, int *bytes_written);
-int WebFileImport_Xmalloc(const char *file, char **file_buf, int *file_size);
-int WebFileGetSize(WebHandle h_file);
-time_t WebFileGetDateGmt(WebHandle h_file);
-
-#endif // _WEB_COMPATIBILITY_H_

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/mgmt/web2/WebGlobals.h
----------------------------------------------------------------------
diff --git a/mgmt/web2/WebGlobals.h b/mgmt/web2/WebGlobals.h
deleted file mode 100644
index c48402b..0000000
--- a/mgmt/web2/WebGlobals.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-#ifndef _WEB_GLOBALS_H_
-#define _WEB_GLOBALS_H_
-
-#include <sys/types.h>
-#include <time.h>
-#include <stdio.h>
-#include "ink_thread.h"
-
-#ifdef MGMT_WEB_TUNE
-#include "ink_hrtime.h"
-#include "WebTune.h"
-#endif
-
-/****************************************************************************
- *
- *  WebGlobals.h - Global Variables and types for the Web Interface
- *
- *
- *
- ****************************************************************************/
-
-#include "ink_mutex.h"
-#include "MgmtHashTable.h"
-
-extern "C" {
-struct sockaddr_in;
-}
-
-// DG: Added NO_THR state for init in compile warning
-enum UIthr_t {
-  NO_THR = 0,
-  AUTOCONF_THR,
-};
-
-struct serviceThr_t {
-  ink_thread threadId;
-  int fd; // Client file descriptor the thread is working
-  // with
-  time_t startTime;
-
-  UIthr_t type;
-  bool waitingForJoin;
-  bool alreadyShutdown;
-  struct sockaddr_in *clientInfo;
-#ifdef MGMT_WEB_TUNE
-  WebTune *timing;
-  int xactNumber;
-#endif
-};
-
-// Each port that we server documents on
-//   has context associated with it which
-//   contains information for that interface
-//
-// Within the secure adminstration context, security
-//  parameters can change at run time.  The struct
-//  is copied for each connection.  Therefore, all
-//  fields that need to change CAN NOT BE POINTERS
-//  since prior transactions in the system will STILL
-//  BE USING the memory pointed to.
-//
-struct WebContext {
-  const char *defaultFile;
-  char *docRoot;
-  int docRootLen;
-};
-
-struct WebInterFaceGlobals {
-  ink_mutex serviceThrLock;
-  ink_mutex submitLock;
-  ink_semaphore serviceThrCount;
-  serviceThr_t *serviceThrArray;
-};
-
-extern WebInterFaceGlobals wGlobals;
-extern WebContext autoconfContext;
-
-#define MAX_SERVICE_THREADS 100
-
-//-------------------------------------------------------------------------
-// web2 items
-//-------------------------------------------------------------------------
-
-#define WEB_HTTP_ERR_OKAY 0
-#define WEB_HTTP_ERR_FAIL -1
-#define WEB_HTTP_ERR_REQUEST_ERROR -2
-#define WEB_HTTP_ERR_REQUEST_FATAL -3
-#define WEB_HTTP_ERR_SESSION_EXPIRED -4
-#define WEB_HTTP_ERR_INVALID_CFG_RULE -5
-
-#define WEB_HTTP_SERVER_STATE_WIN32 0x01
-#define WEB_HTTP_SERVER_STATE_UNIX 0x02
-#define WEB_HTTP_SERVER_STATE_AUTH_ENABLED 0x08
-#define WEB_HTTP_SERVER_STATE_AUTOCONF 0x20
-
-#define WEB_HTTP_STATE_CONFIGURE 0x01   // MONITOR if bit is 0
-#define WEB_HTTP_STATE_MORE_DETAIL 0x02 // LESS_DETAIL if bit is 0
-#define WEB_HTTP_STATE_SUBMIT_WARN 0x04 // set if submission warning
-#define WEB_HTTP_STATE_SUBMIT_NOTE 0x08 // set if submission note
-
-#define WEB_MAX_PAGE_QUERY_LEN (32 + 1)
-#define WEB_MAX_EDIT_FILE_SIZE (32 * 1024) // Some browsers limit you to this
-
-struct WebHttpConInfo {
-  int fd;
-  WebContext *context;
-  sockaddr_in *clientInfo;
-};
-
-#endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/mgmt/web2/WebHttp.cc
----------------------------------------------------------------------
diff --git a/mgmt/web2/WebHttp.cc b/mgmt/web2/WebHttp.cc
deleted file mode 100644
index 8bd9d04..0000000
--- a/mgmt/web2/WebHttp.cc
+++ /dev/null
@@ -1,625 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-/***************************************/
-/****************************************************************************
- *
- *  WebHttp.cc - code to process requests, and create responses
- *
- *
- ****************************************************************************/
-
-#include "libts.h"
-#include "ink_platform.h"
-
-#include "SimpleTokenizer.h"
-
-#include "WebCompatibility.h"
-#include "WebHttp.h"
-#include "WebHttpContext.h"
-#include "WebHttpMessage.h"
-#include "WebOverview.h"
-
-#include "mgmtapi.h"
-#include "WebMgmtUtils.h"
-#include "MgmtUtils.h"
-#include "CfgContextUtils.h"
-
-//-------------------------------------------------------------------------
-// defines
-//-------------------------------------------------------------------------
-
-#define DIR_MODE S_IRWXU
-#define FILE_MODE S_IRWXU
-
-#define MAX_ARGS 10
-#define MAX_TMP_BUF_LEN 1024
-
-//-------------------------------------------------------------------------
-// types
-//-------------------------------------------------------------------------
-
-typedef int (*WebHttpHandler)(WebHttpContext *whc, const char *file);
-
-//-------------------------------------------------------------------------
-// globals
-//-------------------------------------------------------------------------
-
-// only allow access to specific files on the autoconf port
-static InkHashTable *g_autoconf_allow_ht = 0;
-
-static InkHashTable *g_file_bindings_ht = 0;
-
-//-------------------------------------------------------------------------
-// handle_record_info
-//
-// Warning!!! This is really hacky since we should not be directly
-// accessing the librecords data structures.  Just do this here
-// tempoarily until we can have something better.
-//-------------------------------------------------------------------------
-
-#include "P_RecCore.h"
-
-#define LINE_SIZE 512
-#define BUF_SIZE 128
-#define NULL_STR "NULL"
-
-#undef LINE_SIZE
-#undef BUF_SIZE
-#undef NULL_STR
-
-//-------------------------------------------------------------------------
-// handle_synthetic
-//-------------------------------------------------------------------------
-
-static int
-handle_synthetic(WebHttpContext *whc, const char * /* file ATS_UNUSED */)
-{
-  char buffer[28];
-  char cur = 'a';
-  whc->response_hdr->setContentType(TEXT_PLAIN);
-  whc->response_hdr->setStatus(STATUS_OK);
-  buffer[26] = '\n';
-  buffer[27] = '\0';
-  for (int i = 0; i < 26; i++) {
-    *(buffer + i) = cur;
-    cur++;
-  }
-  for (int j = 0; j < 60; j++) {
-    whc->response_bdy->copyFrom(buffer, 27);
-  }
-  return WEB_HTTP_ERR_OKAY;
-}
-
-//-------------------------------------------------------------------------
-// handle_default
-//-------------------------------------------------------------------------
-
-static int
-handle_default(WebHttpContext *whc, const char *file)
-{
-  char *doc_root_file;
-  int file_size;
-  time_t file_date_gmt;
-  WebHandle h_file;
-
-  httpMessage *request = whc->request;
-  httpResponse *response_hdr = whc->response_hdr;
-  textBuffer *response_bdy = whc->response_bdy;
-
-  const char *request_file = file;
-  time_t request_file_ims;
-  int request_file_len;
-
-  // requests are supposed to begin with a "/"
-  if (*request_file != '/') {
-    response_hdr->setStatus(STATUS_NOT_FOUND);
-    WebHttpSetErrorResponse(whc, STATUS_NOT_FOUND);
-    return WEB_HTTP_ERR_REQUEST_ERROR;
-  }
-  // first, make sure there are no ..'s in path or root directory
-  // access in name for security reasons
-  if (strstr(request_file, "..") != NULL || strncmp(request_file, "//", 2) == 0) {
-    response_hdr->setStatus(STATUS_FORBIDDEN);
-    WebHttpSetErrorResponse(whc, STATUS_FORBIDDEN);
-    return WEB_HTTP_ERR_REQUEST_ERROR;
-  }
-
-  if (strcmp("/", request_file) == 0) {
-    request_file = whc->default_file;
-  }
-  // check file type and set document type if appropiate
-  request_file_len = strlen(request_file);
-  if (strcmp(request_file + (request_file_len - 4), ".htm") == 0) {
-    response_hdr->setContentType(TEXT_HTML);
-  } else if (strcmp(request_file + (request_file_len - 5), ".html") == 0) {
-    response_hdr->setContentType(TEXT_HTML);
-  } else if (strcmp(request_file + (request_file_len - 4), ".css") == 0) {
-    response_hdr->setContentType(TEXT_CSS);
-  } else if (strcmp(request_file + (request_file_len - 4), ".gif") == 0) {
-    response_hdr->setContentType(IMAGE_GIF);
-  } else if (strcmp(request_file + (request_file_len - 4), ".jpg") == 0) {
-    response_hdr->setContentType(IMAGE_JPEG);
-  } else if (strcmp(request_file + (request_file_len - 5), ".jpeg") == 0) {
-    response_hdr->setContentType(IMAGE_JPEG);
-  } else if (strcmp(request_file + (request_file_len - 4), ".png") == 0) {
-    response_hdr->setContentType(IMAGE_PNG);
-  } else if (strcmp(request_file + (request_file_len - 4), ".jar") == 0) {
-    response_hdr->setContentType(APP_JAVA);
-  } else if (strcmp(request_file + (request_file_len - 3), ".js") == 0) {
-    response_hdr->setContentType(APP_JAVASCRIPT);
-  } else if (strcmp(request_file + (request_file_len - 4), ".der") == 0) {
-    response_hdr->setContentType(APP_X509);
-  } else if (strcmp(request_file + (request_file_len - 4), ".dat") == 0) {
-    response_hdr->setContentType(APP_AUTOCONFIG);
-    response_hdr->setCachable(0);
-  } else if (strcmp(request_file + (request_file_len - 4), ".pac") == 0) {
-    response_hdr->setContentType(APP_AUTOCONFIG);
-    // Fixed INKqa04312 - 02/21/1999 elam
-    // We don't want anyone to cache .pac files.
-    response_hdr->setCachable(0);
-  } else if (strcmp(request_file + (request_file_len - 4), ".zip") == 0) {
-    response_hdr->setContentType(APP_ZIP);
-  } else {
-    // don't serve file types that we don't know about; helps to lock
-    // down the webserver.  for example, when serving files out the
-    // etc/trafficserver/plugins directory, we don't want to allow the users to
-    // access the .so plugin files.
-    response_hdr->setStatus(STATUS_NOT_FOUND);
-    WebHttpSetErrorResponse(whc, STATUS_NOT_FOUND);
-    return WEB_HTTP_ERR_REQUEST_ERROR;
-  }
-
-  // append the appropriate doc_root on to the file
-  doc_root_file = WebHttpAddDocRoot_Xmalloc(whc, request_file, request_file_len);
-
-  // open the requested file
-  if ((h_file = WebFileOpenR(doc_root_file)) == WEB_HANDLE_INVALID) {
-    // could not find file
-    ats_free(doc_root_file);
-    response_hdr->setStatus(STATUS_NOT_FOUND);
-    WebHttpSetErrorResponse(whc, STATUS_NOT_FOUND);
-    return WEB_HTTP_ERR_REQUEST_ERROR;
-  }
-  // get the file
-  file_size = WebFileGetSize(h_file);
-  file_date_gmt = WebFileGetDateGmt(h_file);
-  request_file_ims = request->getModTime();
-
-  // special logic for the autoconf port
-  if ((whc->server_state & WEB_HTTP_SERVER_STATE_AUTOCONF) && (file_size == 0)) {
-    response_hdr->setStatus(STATUS_NOT_FOUND);
-    WebHttpSetErrorResponse(whc, STATUS_NOT_FOUND);
-    WebFileClose(h_file);
-    ats_free(doc_root_file);
-    return WEB_HTTP_ERR_REQUEST_ERROR;
-  }
-  // Check to see if the clients copy is up to date.  Ignore the
-  // stupid content length that Netscape Navigator sends on the
-  // If-Modified-Since line since it not in the HTTP 1.0 standard
-
-  // Since the client sends If-Modified-Since in GMT, make sure that
-  // we transform mtime to GMT
-  if (request_file_ims != -1 && request_file_ims >= file_date_gmt) {
-    response_hdr->setStatus(STATUS_NOT_MODIFIED);
-  } else {
-    // fetch the file from disk to memory
-    response_hdr->setStatus(STATUS_OK);
-    response_hdr->setLength(file_size);
-    while (response_bdy->rawReadFromFile(h_file) > 0)
-      ;
-  }
-  // set the document last-modified header
-  response_hdr->setLastMod(file_date_gmt);
-
-  WebFileClose(h_file);
-  ats_free(doc_root_file);
-
-  return WEB_HTTP_ERR_OKAY;
-}
-
-
-//-------------------------------------------------------------------------
-// read_request
-//-------------------------------------------------------------------------
-int
-read_request(WebHttpContext *whc)
-{
-  const int buffer_size = 2048;
-  char *buffer = (char *)alloca(buffer_size);
-
-  httpMessage *request = whc->request;
-  httpResponse *response_hdr = whc->response_hdr;
-
-  // first get the request line
-  if (sigfdrdln(whc->si, buffer, buffer_size) < 0) {
-    // if we can not get the request line, update the status code so
-    // it can get logged correctly but do not bother trying to send a
-    // response
-    response_hdr->setStatus(STATUS_BAD_REQUEST);
-    return WEB_HTTP_ERR_REQUEST_FATAL;
-  }
-
-
-  if (request->addRequestLine(buffer) != 0) {
-    response_hdr->setStatus(STATUS_BAD_REQUEST);
-    WebHttpSetErrorResponse(whc, STATUS_BAD_REQUEST);
-    return WEB_HTTP_ERR_REQUEST_ERROR;
-  }
-
-  // Check for a scheme we do not understand
-  //
-  //  If we undertand the scheme, it has
-  //   to be HTTP
-  if (request->getScheme() == SCHEME_UNKNOWN) {
-    response_hdr->setStatus(STATUS_NOT_IMPLEMENTED);
-    WebHttpSetErrorResponse(whc, STATUS_NOT_IMPLEMENTED);
-    return WEB_HTTP_ERR_REQUEST_ERROR;
-  }
-
-  if (request->getMethod() != METHOD_GET && request->getMethod() != METHOD_POST && request->getMethod() != METHOD_HEAD) {
-    response_hdr->setStatus(STATUS_NOT_IMPLEMENTED);
-    WebHttpSetErrorResponse(whc, STATUS_NOT_IMPLEMENTED);
-    return WEB_HTTP_ERR_REQUEST_ERROR;
-  }
-  // Read the headers of http request line by line until
-  //   we get a line that is solely composed of "\r" (or
-  //   just "" since not everyone follows the HTTP standard
-  //
-  do {
-    if (sigfdrdln(whc->si, buffer, buffer_size) < 0) {
-      response_hdr->setStatus(STATUS_BAD_REQUEST);
-      return WEB_HTTP_ERR_REQUEST_FATAL;
-    }
-    request->addHeader(buffer);
-  } while (strcmp(buffer, "\r") != 0 && *buffer != '\0');
-
-  // If there is a content body, read it in
-  if (request->addRequestBody(whc->si) < 0) {
-    // There was error on reading the response body
-    response_hdr->setStatus(STATUS_BAD_REQUEST);
-    WebHttpSetErrorResponse(whc, STATUS_NOT_IMPLEMENTED);
-    return WEB_HTTP_ERR_REQUEST_ERROR;
-  }
-
-// Drain read channel: In the case of Linux, OS sends reset to the
-// socket if we close it when there is data left on it ot be read
-// (in compliance with TCP). This causes problems with the "POST"
-// method. (for example with update.html). With IE, we found ending
-// "\r\n" were not read.  The following work around is to read all
-// that is left in the socket before closing it.
-#define MAX_DRAIN_BYTES 32
-  // INKqa11524: If the user is malicious and keeps sending us data,
-  // we'll go into an infinite spin here.  Fix is to only drain up
-  // to 32 bytes to allow for funny browser behavior but to also
-  // prevent reading forever.
-  int drain_bytes = 0;
-  if (fcntl(whc->si.fd, F_SETFL, O_NONBLOCK) >= 0) {
-    char ch;
-    while ((read(whc->si.fd, &ch, 1) > 0) && (drain_bytes < MAX_DRAIN_BYTES)) {
-      drain_bytes++;
-    }
-  }
-
-  return WEB_HTTP_ERR_OKAY;
-}
-
-//-------------------------------------------------------------------------
-// write_response
-//-------------------------------------------------------------------------
-
-int
-write_response(WebHttpContext *whc)
-{
-  char *buf_p;
-  int bytes_to_write;
-  int bytes_written;
-
-  // Make sure that we have a content length
-  if (whc->response_hdr->getLength() < 0) {
-    whc->response_hdr->setLength(whc->response_bdy->spaceUsed());
-  }
-  whc->response_hdr->writeHdr(whc->si);
-  if (whc->request->getMethod() != METHOD_HEAD) {
-    buf_p = whc->response_bdy->bufPtr();
-    bytes_to_write = whc->response_bdy->spaceUsed();
-    while (bytes_to_write) {
-      bytes_written = socket_write(whc->si, buf_p, bytes_to_write);
-      if (bytes_written < 0) {
-        if (errno == EINTR || errno == EAGAIN)
-          continue;
-        else
-          return WEB_HTTP_ERR_FAIL;
-      } else {
-        bytes_to_write -= bytes_written;
-        buf_p += bytes_written;
-      }
-    }
-  }
-  return WEB_HTTP_ERR_OKAY;
-}
-
-//-------------------------------------------------------------------------
-// process_query
-//-------------------------------------------------------------------------
-
-int
-process_query(WebHttpContext *whc)
-{
-  int err;
-  InkHashTable *ht;
-  char *value;
-  // processFormSubmission will substituteUnsafeChars()
-  if ((ht = processFormSubmission((char *)(whc->request->getQuery()))) != NULL) {
-    whc->query_data_ht = ht;
-    // extract some basic info for easier access later
-    if (ink_hash_table_lookup(ht, "mode", (void **)&value)) {
-      if (strcmp(value, "1") == 0)
-        whc->request_state |= WEB_HTTP_STATE_CONFIGURE;
-    }
-    if (ink_hash_table_lookup(ht, "detail", (void **)&value)) {
-      if (strcmp(value, "more") == 0)
-        whc->request_state |= WEB_HTTP_STATE_MORE_DETAIL;
-    }
-    err = WEB_HTTP_ERR_OKAY;
-  } else {
-    err = WEB_HTTP_ERR_FAIL;
-  }
-  return err;
-}
-
-//-------------------------------------------------------------------------
-// process_post
-//-------------------------------------------------------------------------
-int
-process_post(WebHttpContext *whc)
-{
-  int err;
-  InkHashTable *ht;
-  // processFormSubmission will substituteUnsafeChars()
-  if ((ht = processFormSubmission(whc->request->getBody())) != NULL) {
-    whc->post_data_ht = ht;
-    err = WEB_HTTP_ERR_OKAY;
-  } else {
-    err = WEB_HTTP_ERR_FAIL;
-  }
-  return err;
-}
-
-//-------------------------------------------------------------------------
-// signal_handler_init
-//-------------------------------------------------------------------------
-
-void
-signal_handler_do_nothing(int /* x ATS_UNUSED */)
-{
-  //  A small function thats whole purpose is to give the signal
-  //  handler for breaking out of a network read, somethng to call
-}
-
-int
-signal_handler_init()
-{
-  // Setup signal handling.  We want to able to unstick stuck socket
-  // connections.  This is accomplished by a watcher thread doing a
-  // half close on the incoming socket after a timeout.  To break, out
-  // the current read which is likely stuck we have a signal handler
-  // on SIGUSR1 which does nothing except by side effect of break the
-  // read.  All future reads from the socket should fail since
-  // incoming traffic is shutdown on the connection and thread should
-  // exit normally
-  sigset_t sigsToBlock;
-// FreeBSD and Linux use SIGUSR1 internally in the threads library
-#if !defined(linux) && !defined(freebsd) && !defined(darwin)
-  // Set up the handler for SIGUSR1
-  struct sigaction sigHandler;
-  sigHandler.sa_handler = signal_handler_do_nothing;
-  sigemptyset(&sigHandler.sa_mask);
-  sigHandler.sa_flags = 0;
-  sigaction(SIGUSR1, &sigHandler, NULL);
-#endif
-  // Block all other signals
-  sigfillset(&sigsToBlock);
-  sigdelset(&sigsToBlock, SIGUSR1);
-  ink_thread_sigsetmask(SIG_SETMASK, &sigsToBlock, NULL);
-  return WEB_HTTP_ERR_OKAY;
-}
-
-//-------------------------------------------------------------------------
-// WebHttpInit
-//-------------------------------------------------------------------------
-
-void
-WebHttpInit()
-{
-  static int initialized = 0;
-
-  if (initialized != 0) {
-    mgmt_log(stderr, "[WebHttpInit] error, initialized twice (%d)", initialized);
-  }
-  initialized++;
-
-  // initialize allow files
-  g_autoconf_allow_ht = ink_hash_table_create(InkHashTableKeyType_String);
-  ink_hash_table_insert(g_autoconf_allow_ht, "/proxy.pac", NULL);
-  ink_hash_table_insert(g_autoconf_allow_ht, "/public_key.der", NULL);
-  ink_hash_table_insert(g_autoconf_allow_ht, "/synthetic.txt", NULL);
-
-  // initialize file bindings
-  g_file_bindings_ht = ink_hash_table_create(InkHashTableKeyType_String);
-  ink_hash_table_insert(g_file_bindings_ht, "/synthetic.txt", (void *)handle_synthetic);
-}
-
-//-------------------------------------------------------------------------
-// WebHttpHandleConnection
-//
-// Handles http requests across the web management port
-//-------------------------------------------------------------------------
-void
-WebHttpHandleConnection(WebHttpConInfo *whci)
-{
-  int err = WEB_HTTP_ERR_OKAY;
-  WebHttpContext *whc;
-  WebHttpHandler handler;
-  char *file;
-  char *extn;
-  int drain_bytes;
-  char ch;
-
-  // initialization
-  if ((whc = WebHttpContextCreate(whci)) == NULL)
-    goto Ltransaction_close;
-  if (signal_handler_init() != WEB_HTTP_ERR_OKAY)
-    goto Ltransaction_close;
-
-  // read request
-  if ((err = read_request(whc)) != WEB_HTTP_ERR_OKAY)
-    goto Lerror_switch;
-
-  // get our file information
-  file = (char *)(whc->request->getFile());
-  if (strcmp("/", file) == 0) {
-    file = (char *)(whc->default_file);
-  }
-
-  Debug("web2", "[WebHttpHandleConnection] request file: %s", file);
-
-  if (whc->server_state & WEB_HTTP_SERVER_STATE_AUTOCONF) {
-    // security concern: special treatment if we're handling a request
-    // on the autoconf port.  can't have users downloading arbitrary
-    // files under the config directory!
-    if (!ink_hash_table_isbound(g_autoconf_allow_ht, file)) {
-      mgmt_elog(stderr, 0, "[WebHttpHandleConnection] %s not valid autoconf file", file);
-      whc->response_hdr->setStatus(STATUS_NOT_FOUND);
-      WebHttpSetErrorResponse(whc, STATUS_NOT_FOUND);
-      goto Ltransaction_send;
-    }
-  }
-
-  // process query
-  process_query(whc);
-
-  // Lookup file handler
-  if (!ink_hash_table_lookup(g_file_bindings_ht, file, (void **)&handler)) {
-    extn = file;
-    while (*extn != '\0')
-      extn++;
-    while ((extn > file) && (*extn != '.'))
-      extn--;
-    handler = handle_default;
-  }
-  err = handler(whc, file);
-
-Lerror_switch:
-
-  switch (err) {
-  case WEB_HTTP_ERR_OKAY:
-  case WEB_HTTP_ERR_REQUEST_ERROR:
-    goto Ltransaction_send;
-  case WEB_HTTP_ERR_FAIL:
-  case WEB_HTTP_ERR_REQUEST_FATAL:
-  default:
-    goto Ltransaction_close;
-  }
-
-Ltransaction_send:
-
-  // write response
-  if ((err = write_response(whc)) != WEB_HTTP_ERR_OKAY)
-    goto Ltransaction_close;
-
-  // close the connection before logging it to reduce latency
-  shutdown(whc->si.fd, 1);
-  drain_bytes = 0;
-  if (fcntl(whc->si.fd, F_SETFL, O_NONBLOCK) >= 0) {
-    while ((read(whc->si.fd, &ch, 1) > 0) && (drain_bytes < MAX_DRAIN_BYTES)) {
-      drain_bytes++;
-    }
-  }
-  close_socket(whc->si.fd);
-  whc->si.fd = -1;
-
-Ltransaction_close:
-
-  // if we didn't close already, close connection
-  if (whc->si.fd != -1) {
-    shutdown(whc->si.fd, 1);
-    drain_bytes = 0;
-    if (fcntl(whc->si.fd, F_SETFL, O_NONBLOCK) >= 0) {
-      while ((read(whc->si.fd, &ch, 1) > 0) && (drain_bytes < MAX_DRAIN_BYTES)) {
-        drain_bytes++;
-      }
-    }
-    close_socket(whc->si.fd);
-  }
-
-  // clean up memory
-  WebHttpContextDestroy(whc);
-}
-
-//-------------------------------------------------------------------------
-// WebHttpSetErrorResponse
-//
-// Formulates a page to return on an HttpStatus condition
-//-------------------------------------------------------------------------
-
-void
-WebHttpSetErrorResponse(WebHttpContext *whc, HttpStatus_t error)
-{
-  //-----------------------------------------------------------------------
-  // FIXME: HARD-CODED HTML HELL!!!
-  //-----------------------------------------------------------------------
-
-  static const char a[] = "<HTML>\n<Head>\n<TITLE>";
-  static const char b[] = "</TITLE>\n</HEAD>\n<BODY bgcolor=\"#FFFFFF\"><h1>\n";
-  static const char c[] = "</h1>\n</BODY>\n</HTML>\n";
-  int errorMsgLen = strlen(httpStatStr[error]);
-
-  // reset the buffer
-  whc->response_bdy->reUse();
-
-  // fill in the buffer
-  whc->response_bdy->copyFrom(a, strlen(a));
-  whc->response_bdy->copyFrom(httpStatStr[error], errorMsgLen);
-  whc->response_bdy->copyFrom(b, strlen(b));
-  whc->response_bdy->copyFrom(httpStatStr[error], errorMsgLen);
-  whc->response_bdy->copyFrom(c, strlen(c));
-}
-
-//-------------------------------------------------------------------------
-// WebHttpAddDocRoot_Xmalloc
-//-------------------------------------------------------------------------
-
-char *
-WebHttpAddDocRoot_Xmalloc(WebHttpContext *whc, const char *file, int file_len)
-{
-  char *doc_root_file = (char *)ats_malloc(file_len + whc->doc_root_len + 1);
-
-  memcpy(doc_root_file, whc->doc_root, whc->doc_root_len);
-  memcpy(doc_root_file + whc->doc_root_len, file, file_len);
-  *(doc_root_file + whc->doc_root_len + file_len) = '\0';
-
-  Debug("web2", "DocRoot request file: %s", doc_root_file);
-
-  return doc_root_file;
-}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f84df26f/mgmt/web2/WebHttp.h
----------------------------------------------------------------------
diff --git a/mgmt/web2/WebHttp.h b/mgmt/web2/WebHttp.h
deleted file mode 100644
index 7d3d250..0000000
--- a/mgmt/web2/WebHttp.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-/****************************************************************************
- *
- *  WebHttp.h - code to process requests, and create responses
- *
- *
- ****************************************************************************/
-
-#ifndef _WEB_HTTP_H_
-#define _WEB_HTTP_H_
-
-#include "WebGlobals.h"
-#include "WebHttpContext.h"
-#include "WebHttpMessage.h"
-
-#include "P_RecCore.h"
-
-void WebHttpInit();
-void WebHttpHandleConnection(WebHttpConInfo *whci);
-
-void WebHttpSetErrorResponse(WebHttpContext *whc, HttpStatus_t error);
-char *WebHttpAddDocRoot_Xmalloc(WebHttpContext *whc, const char *file, int file_len);
-#endif // _WEB_HTTP_H_