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:15 UTC

[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

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_