diff --git a/doc/admin-guide/files/records.yaml.en.rst b/doc/admin-guide/files/records.yaml.en.rst index a8742f45609..174ea0f8b9a 100644 --- a/doc/admin-guide/files/records.yaml.en.rst +++ b/doc/admin-guide/files/records.yaml.en.rst @@ -2684,50 +2684,6 @@ Customizable User Response Pages ``2`` Suppress response pages only for internal traffic. ===== ====================================================================== -.. ts:cv:: CONFIG proxy.config.http_ui_enabled INT 0 - - Specifies which http Inspector UI endpoints to allow within :file:`remap.config`: - - ===== ====================================================================== - Value Description - ===== ====================================================================== - ``0`` Disable all http UI endpoints. - ``1`` Enable only Cache Inspector endpoints. - ``2`` Enable only stats endpoints. - ``3`` Enable all http UI endpoints. - ===== ====================================================================== - - To enable any endpoint there needs to be an entry in :file:`remap.config` which - specifically enables it. Such a line would look like: :: - - map / http://{cache} - - The following are the cache endpoints: - - ================ =========================================================== - Name Description - ================ =========================================================== - ``cache`` UI to interact with the cache. - ================ =========================================================== - - The following are the stats endpoints: - - ================== ========================================================= - Name Description - ================== ========================================================= - ``cache-internal`` Statistics about cache evacuation and volumes. - ``hostdb`` Lookups against the hostdb. - ``http`` HTTPSM details, this endpoint is also gated by - :ts:cv:`proxy.config.http.enable_http_info`. - ``net`` Lookup and listing of open connections. - ================== ========================================================= - -.. ts:cv:: CONFIG proxy.config.http.enable_http_info INT 0 - - Enables (``1``) or disables (``0``) access to an endpoint within - :ts:cv:`proxy.config.http_ui_enabled` which shows details about inflight - transactions (HttpSM). - DNS === diff --git a/doc/admin-guide/storage/index.en.rst b/doc/admin-guide/storage/index.en.rst index afcec263194..fe874def154 100644 --- a/doc/admin-guide/storage/index.en.rst +++ b/doc/admin-guide/storage/index.en.rst @@ -341,37 +341,6 @@ Then, to push the object, post the object using the PUSH method: :: .. _inspecting-the-cache: -Inspecting the Cache -==================== - -Traffic Server provides a Cache Inspector utility that enables you to -view, delete, and invalidate URLs in the cache (HTTP only). The Cache -Inspector utility is a powerful tool that's capable of deleting all -the objects in your cache. Therefore, make sure that only authorized -administrators are allowed to access this utility through proper use -of the ``@src_ip`` option in :file:`remap.config` and the instructions -detailed in :ref:`admin-controlling-access`. - -Accessing the Cache Inspector Utility -------------------------------------- - -To access the Cache Inspector utility: - -#. Set :ts:cv:`proxy.config.http_ui_enabled` to ``1``. -#. To access the cache inspector in reverse proxy mode, you must add a - remap rule to :file:`remap.config` to expose the URL. This should be - restricted to a limited set of hosts using the ``@src_ip`` option. - To restrict access to the network 172.28.56.0/24, use :: - - map http://yourhost.com/myCI/ http://{cache} @action=allow @src_ip=172.28.56.1-172.28.56.254 - -#. Reload the Traffic Server configuration by running :option:`traffic_ctl config reload`. -#. Open your web browser and go to the following URL:: - - http://yourhost/myCI/ - - You will now be presented with the Cache Inspector interface. - Using the Cache Inspector Utility --------------------------------- diff --git a/doc/locale/ja/LC_MESSAGES/admin-guide/files/records.config.en.po b/doc/locale/ja/LC_MESSAGES/admin-guide/files/records.config.en.po index 810c4887acc..9903458d9c7 100644 --- a/doc/locale/ja/LC_MESSAGES/admin-guide/files/records.config.en.po +++ b/doc/locale/ja/LC_MESSAGES/admin-guide/files/records.config.en.po @@ -3457,12 +3457,6 @@ msgstr "" msgid "``http``" msgstr "" -#: ../../../admin-guide/files/records.yaml.en.rst:2228 -msgid "" -"HTTPSM details, this endpoint is also gated by :ts:cv:`proxy.config.http." -"enable_http_info`." -msgstr "" - #: ../../../admin-guide/files/records.yaml.en.rst:2230 msgid "``net``" msgstr "" @@ -3471,13 +3465,6 @@ msgstr "" msgid "Lookup and listing of open connections." msgstr "" -#: ../../../admin-guide/files/records.yaml.en.rst:2235 -msgid "" -"Enables (``1``) or disables (``0``) access to an endpoint within :ts:cv:" -"`proxy.config.http_ui_enabled` which shows details about inflight " -"transactions (HttpSM)." -msgstr "" - #: ../../../admin-guide/files/records.yaml.en.rst:2240 msgid "DNS" msgstr "" diff --git a/doc/locale/ja/LC_MESSAGES/admin-guide/storage/index.en.po b/doc/locale/ja/LC_MESSAGES/admin-guide/storage/index.en.po index ffb3dac8c79..fabcf0bed4f 100644 --- a/doc/locale/ja/LC_MESSAGES/admin-guide/storage/index.en.po +++ b/doc/locale/ja/LC_MESSAGES/admin-guide/storage/index.en.po @@ -730,10 +730,6 @@ msgstr "キャッシュ検査ユーティリティにアクセスする" msgid "To access the Cache Inspector utility:" msgstr "キャッシュ検査ユーティリティにアクセスするには :" -#: ../../../admin-guide/storage/index.en.rst:375 -msgid "Set :ts:cv:`proxy.config.http_ui_enabled` to ``1``." -msgstr ":ts:cv:`proxy.config.http_ui_enabled` を ``1`` に設定。" - #: ../../../admin-guide/storage/index.en.rst:376 msgid "" "To access the cache inspector in reverse proxy mode, you must add a remap " diff --git a/include/iocore/cache/CacheEvacuateDocVC.h b/include/iocore/cache/CacheEvacuateDocVC.h index 03ce9d5d1b1..6b738b890f8 100644 --- a/include/iocore/cache/CacheEvacuateDocVC.h +++ b/include/iocore/cache/CacheEvacuateDocVC.h @@ -63,10 +63,7 @@ new_CacheEvacuateDocVC(Continuation *cont) ink_assert(c->trigger == nullptr); static DbgCtl dbg_ctl{"cache_new"}; Dbg(dbg_ctl, "new %p", c); -#ifdef CACHE_STAT_PAGES - ink_assert(!c->stat_link.next); - ink_assert(!c->stat_link.prev); -#endif dir_clear(&c->dir); + return c; } diff --git a/include/iocore/cache/CacheVC.h b/include/iocore/cache/CacheVC.h index 72c6c5a27af..92881e30ea7 100644 --- a/include/iocore/cache/CacheVC.h +++ b/include/iocore/cache/CacheVC.h @@ -246,9 +246,6 @@ struct CacheVC : public CacheVConnection { AIOCallbackInternal io; int alternate_index = CACHE_ALT_INDEX_DEFAULT; // preferred position in vector LINK(CacheVC, opendir_link); -#ifdef CACHE_STAT_PAGES - LINK(CacheVC, stat_link); -#endif // end Region B // Start Region C diff --git a/include/iocore/hostdb/HostDBProcessor.h b/include/iocore/hostdb/HostDBProcessor.h index bb06a3f85fe..3629e72744a 100644 --- a/include/iocore/hostdb/HostDBProcessor.h +++ b/include/iocore/hostdb/HostDBProcessor.h @@ -293,7 +293,6 @@ HostDBInfo::invalidate() class HostDBRecord : public RefCountObj { friend struct HostDBContinuation; - friend struct ShowHostDB; using self_type = HostDBRecord; /// Size of the IO buffer block owned by @a this. diff --git a/include/proxy/Show.h b/include/proxy/Show.h deleted file mode 100644 index 85e2357aa3b..00000000000 --- a/include/proxy/Show.h +++ /dev/null @@ -1,164 +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. - */ - -/**************************************************************************** - - Show.h - - - ****************************************************************************/ - -#pragma once - -#include "proxy/StatPages.h" - -#define STREQ_PREFIX(_x, _s) (!strncasecmp(_x, _s, sizeof(_s) - 1)) - -struct ShowCont; -using ShowContEventHandler = int (ShowCont::*)(int, Event *); -struct ShowCont : public Continuation { -private: - char *buf, *start, *ebuf; - -public: - Action action; - char *sarg; - - int - show(const char *s, ...) - { - va_list aap, va_scratch; - ptrdiff_t avail = ebuf - buf; - ptrdiff_t needed; - - va_start(aap, s); - va_copy(va_scratch, aap); - needed = vsnprintf(buf, avail, s, va_scratch); - va_end(va_scratch); - - if (needed >= avail) { - ptrdiff_t bufsz = ebuf - start; - ptrdiff_t used = buf - start; - - Debug("cache_inspector", "needed %d bytes, reallocating to %d bytes", (int)needed, (int)bufsz + (int)needed); - - bufsz += ROUNDUP(needed, ats_pagesize()); - start = (char *)ats_realloc(start, bufsz); - ebuf = start + bufsz; - buf = start + used; - avail = ebuf - buf; - - needed = vsnprintf(buf, avail, s, aap); - va_end(aap); - - if (needed >= avail) { - Debug("cache_inspector", "needed %d bytes, but had only %d", (int)needed, (int)avail + (int)needed); - return EVENT_DONE; - } - } - - buf += needed; - return EVENT_CONT; - } - -#define CHECK_SHOW(_x) \ - if (_x == EVENT_DONE) \ - return complete_error(event, e); - - int - finishConn(int event, Event *e) - { - if (!action.cancelled) { - StatPageData data(start, buf - start); - action.continuation->handleEvent(STAT_PAGE_SUCCESS, &data); - start = nullptr; - } else { - ats_free(start); - start = nullptr; - } - return done(VIO::CLOSE, event, e); - } - - int - complete(int event, Event *e) - { - CHECK_SHOW(show("\n\n")); - return finishConn(event, e); - } - - int - completeJson(int event, Event *e) - { - return finishConn(event, e); - } - - int - complete_error(int event, Event *e) - { - ats_free(start); - start = nullptr; - if (!action.cancelled) { - action.continuation->handleEvent(STAT_PAGE_FAILURE, nullptr); - } - return done(VIO::ABORT, event, e); - } - - int - begin(const char *name) - { - return show("\n%s\n" - "\n" - "

%s

\n", - name, name); - } - - int - showError(int event, Event *e) - { - return complete_error(event, e); - } - - virtual int - done(int /* e ATS_UNUSED */, int /* event ATS_UNUSED */, void * /* data ATS_UNUSED */) - { - delete this; - return EVENT_DONE; - } - - ShowCont(Continuation *c, HTTPHdr * /* h ATS_UNUSED */) : Continuation(nullptr), sarg(nullptr) - { - size_t sz = ats_pagesize(); - - mutex = c->mutex; - action = c; - buf = (char *)ats_malloc(sz); - start = buf; - ebuf = buf + sz; - } - - ~ShowCont() override - { - ats_free(sarg); - ats_free(start); - } -}; diff --git a/include/proxy/StatPages.h b/include/proxy/StatPages.h deleted file mode 100644 index d5e446e4789..00000000000 --- a/include/proxy/StatPages.h +++ /dev/null @@ -1,121 +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. - */ - -/**************************************************************************** - - StatPages.h - - - ****************************************************************************/ - -#pragma once -#include "iocore/eventsystem/EventSystem.h" - -#include "proxy/hdrs/HTTP.h" - -// SPECIAL URLs -// -// -// 1. Access from Browsers -// -// By special URLS: -// -// http://{module}/component/sub-component/request-type?arguments -// -// Note how the hostname is the module to be queried with "{}" surrounding. -// -// Running Example: -// -// http://{http}/groups/dump?comp.compilers -// -// 2. What sort of things should be available? -// -// A. The type of data should default to HTML or match the -// extension type e.g.: -// -// http://{http}/groups/use_graph.gif?august -// -// B. Each protocol/subsystem should have their own information. -// For example - -#define STAT_PAGE_SUCCESS STAT_PAGES_EVENTS_START + 0 -#define STAT_PAGE_FAILURE STAT_PAGES_EVENTS_START + 1 - -using StatPagesFunc = Action *(*)(Continuation *, HTTPHdr *); - -struct StatPageData { - char *data = nullptr; - char *type = nullptr; - int length = 0; - - StatPageData() {} - StatPageData(char *adata) : data(adata) { length = strlen(adata); } - StatPageData(char *adata, int alength) : data(adata), length(alength) {} -}; - -struct StatPagesManager { - void init(); - - void register_http(const char *hostname, StatPagesFunc func); - - // Private - Action *handle_http(Continuation *cont, HTTPHdr *header); - bool is_stat_page(URL *url); - bool is_cache_inspector_page(URL *url); - int m_enabled; - ink_mutex stat_pages_mutex; -}; - -extern StatPagesManager statPagesManager; - -// Stole Pete's code for formatting the page and slapped it here -// for easy reuse -class BaseStatPagesHandler : public Continuation -{ -public: - BaseStatPagesHandler(ProxyMutex *amutex) : Continuation(amutex), response(nullptr), response_size(0), response_length(0){}; - ~BaseStatPagesHandler() override { resp_clear(); }; - -protected: - void resp_clear(); - void resp_add(const char *fmt, ...); - void resp_add_sep(); - void resp_begin(const char *title); - void resp_end(); - void resp_begin_numbered(); - void resp_end_numbered(); - void resp_begin_unnumbered(); - void resp_end_unnumbered(); - void resp_begin_item(); - void resp_end_item(); - void resp_begin_table(int border, int columns, int percent); - void resp_end_table(); - void resp_begin_row(); - void resp_end_row(); - void resp_begin_column(int percent = -1, const char *align = nullptr); - void resp_end_column(); - - char *response; - int response_size; - int response_length; -}; diff --git a/include/proxy/http/HttpConfig.h b/include/proxy/http/HttpConfig.h index 3532d166895..d0c03437a3f 100644 --- a/include/proxy/http/HttpConfig.h +++ b/include/proxy/http/HttpConfig.h @@ -761,9 +761,7 @@ struct HttpConfigParams : public ConfigInfo { MgmtByte reverse_proxy_enabled = 0; MgmtByte url_remap_required = 1; - MgmtByte errors_log_error_pages = 1; - MgmtByte enable_http_info = 0; - + MgmtByte errors_log_error_pages = 1; MgmtByte redirection_host_no_port = 1; MgmtByte send_100_continue_response = 0; diff --git a/include/proxy/http/HttpPages.h b/include/proxy/http/HttpPages.h deleted file mode 100644 index 65d052a3648..00000000000 --- a/include/proxy/http/HttpPages.h +++ /dev/null @@ -1,86 +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. - */ - -/**************************************************************************** - - HttpPages.h - - Description: - Data structures and stat page generators for http info - - - ****************************************************************************/ - -#pragma once - -#include "tscore/ink_platform.h" -#include "iocore/eventsystem/EventSystem.h" -#include "proxy/hdrs/HTTP.h" -#include "proxy/StatPages.h" -#include "proxy/http/HttpSM.h" - -class HttpSM; - -const int HTTP_LIST_BUCKETS = 63; -const int HTTP_LIST_RETRY = HRTIME_MSECONDS(10); - -struct HttpSMListBucket { - Ptr mutex; - DList(HttpSM, debug_link) sm_list; -}; - -extern HttpSMListBucket HttpSMList[]; - -class HttpPagesHandler : public BaseStatPagesHandler -{ -public: - HttpPagesHandler(Continuation *cont, HTTPHdr *header); - ~HttpPagesHandler() override; - - int handle_smlist(int event, void *edata); - int handle_smdetails(int event, void *edata); - int handle_callback(int event, void *edata); - Action action; - -private: - int64_t extract_id(const char *query); - void dump_hdr(HTTPHdr *hdr, const char *desc); - void dump_tunnel_info(HttpSM *sm); - void dump_history(HttpSM *sm); - int dump_sm(HttpSM *sm); - - Arena arena; - char *request; - int list_bucket; - - enum HP_State_t { - HP_INIT, - HP_RUN, - }; - HP_State_t state; - - // Info for SM details - int64_t sm_id; -}; - -void http_pages_init(); diff --git a/include/proxy/http/HttpSM.h b/include/proxy/http/HttpSM.h index 237048c2a5a..ae14d4d11df 100644 --- a/include/proxy/http/HttpSM.h +++ b/include/proxy/http/HttpSM.h @@ -172,7 +172,6 @@ class PostDataBuffers class HttpSM : public Continuation, public PluginUserArgs { - friend class HttpPagesHandler; friend class HttpTransact; public: @@ -249,9 +248,6 @@ class HttpSM : public Continuation, public PluginUserArgs int state_api_callback(int event, void *data); int state_api_callout(int event, void *data); - // Used for Http Stat Pages - HttpTunnel *get_tunnel(); - // Debugging routines to dump the SM history, hdrs void dump_state_on_assert(); void dump_state_hdr(HTTPHdr *h, const char *s); @@ -354,7 +350,6 @@ class HttpSM : public Continuation, public PluginUserArgs int state_hostdb_lookup(int event, void *data); int state_hostdb_reverse_lookup(int event, void *data); int state_mark_os_down(int event, void *data); - int state_handle_stat_page(int event, void *data); int state_auth_callback(int event, void *data); int state_add_to_list(int event, void *data); int state_remove_from_list(int event, void *data); @@ -661,12 +656,6 @@ HttpSM::is_post_transform_request() return t_state.method == HTTP_WKSIDX_POST && post_transform_info.vc; } -inline HttpTunnel * -HttpSM::get_tunnel() -{ - return &tunnel; -} - inline bool HttpSM::is_dying() const { diff --git a/include/proxy/http/HttpTransact.h b/include/proxy/http/HttpTransact.h index a22c1e554ca..e8df7340788 100644 --- a/include/proxy/http/HttpTransact.h +++ b/include/proxy/http/HttpTransact.h @@ -392,7 +392,6 @@ class HttpTransact SM_ACTION_INTERNAL_CACHE_UPDATE_HEADERS, SM_ACTION_INTERNAL_CACHE_WRITE, SM_ACTION_INTERNAL_100_RESPONSE, - SM_ACTION_INTERNAL_REQUEST, SM_ACTION_SEND_ERROR_CACHE_NOOP, SM_ACTION_WAIT_FOR_FULL_BODY, @@ -1001,7 +1000,6 @@ class HttpTransact static void HandleResponse(State *s); static void HandleUpdateCachedObject(State *s); static void HandleUpdateCachedObjectContinue(State *s); - static void HandleStatPage(State *s); static void handle_100_continue_response(State *s); static void handle_transform_ready(State *s); static void handle_transform_cache_write(State *s); @@ -1050,7 +1048,6 @@ class HttpTransact char *via_string); static bool does_client_request_permit_dns_caching(CacheControlResult *c, HTTPHdr *h); static bool does_client_request_permit_storing(CacheControlResult *c, HTTPHdr *h); - static bool handle_internal_request(State *s, HTTPHdr *incoming_hdr); static bool handle_trace_and_options_requests(State *s, HTTPHdr *incoming_hdr); static void bootstrap_state_variables_from_request(State *s, HTTPHdr *incoming_request); diff --git a/include/proxy/http/HttpTunnel.h b/include/proxy/http/HttpTunnel.h index dbd732ad0ca..4a0cfe59bf4 100644 --- a/include/proxy/http/HttpTunnel.h +++ b/include/proxy/http/HttpTunnel.h @@ -58,7 +58,6 @@ struct HttpTunnelProducer; class HttpSM; -class HttpPagesHandler; using HttpSMHandler = int (HttpSM::*)(int, void *); struct HttpTunnelConsumer; @@ -248,8 +247,6 @@ struct HttpTunnelProducer { class HttpTunnel : public Continuation { - friend class HttpPagesHandler; - /** Data for implementing flow control across a tunnel. The goal is to bound the amount of data buffered for a diff --git a/include/proxy/http/remap/RemapHitCount.h b/include/proxy/http/remap/RemapHitCount.h deleted file mode 100644 index 24948868c8c..00000000000 --- a/include/proxy/http/remap/RemapHitCount.h +++ /dev/null @@ -1,30 +0,0 @@ -/** @file - - Show endpoint for remap rule hits - - @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. - */ - -#pragma once - -#include "proxy/hdrs/HTTP.h" -#include "iocore/eventsystem/EventSystem.h" -#include "proxy/Show.h" - -Action *register_ShowRemapHitCount(Continuation *, HTTPHdr *); diff --git a/include/proxy/http/remap/UrlMapping.h b/include/proxy/http/remap/UrlMapping.h index d51e909843b..1d7f58d342d 100644 --- a/include/proxy/http/remap/UrlMapping.h +++ b/include/proxy/http/remap/UrlMapping.h @@ -37,7 +37,6 @@ #include "tscore/ink_config.h" #include "proxy/http/remap/AclFiltering.h" #include "proxy/hdrs/URL.h" -#include "proxy/http/remap/RemapHitCount.h" #include "proxy/http/remap/RemapPluginInfo.h" #include "proxy/http/remap/PluginFactory.h" #include "tscpp/util/Regex.h" diff --git a/src/iocore/cache/CMakeLists.txt b/src/iocore/cache/CMakeLists.txt index f3748723b22..4d9dfc073cd 100644 --- a/src/iocore/cache/CMakeLists.txt +++ b/src/iocore/cache/CMakeLists.txt @@ -23,8 +23,6 @@ add_library( CacheEvacuateDocVC.cc CacheHosting.cc CacheHttp.cc - CachePages.cc - CachePagesInternal.cc CacheRead.cc CacheVC.cc CacheVol.cc diff --git a/src/iocore/cache/Cache.cc b/src/iocore/cache/Cache.cc index fd29b76ef46..b699332f401 100644 --- a/src/iocore/cache/Cache.cc +++ b/src/iocore/cache/Cache.cc @@ -25,7 +25,6 @@ // Cache Inspector and State Pages #include "P_CacheTest.h" -#include "proxy/StatPages.h" #include "tscore/Filenames.h" @@ -1100,8 +1099,6 @@ Cache::open_done() { Action *register_ShowCache(Continuation * c, HTTPHdr * h); Action *register_ShowCacheInternal(Continuation * c, HTTPHdr * h); - statPagesManager.register_http("cache", register_ShowCache); - statPagesManager.register_http("cache-internal", register_ShowCacheInternal); if (total_good_nvol == 0) { ready = CACHE_INIT_FAILED; diff --git a/src/iocore/cache/CachePages.cc b/src/iocore/cache/CachePages.cc deleted file mode 100644 index 7c21f500725..00000000000 --- a/src/iocore/cache/CachePages.cc +++ /dev/null @@ -1,703 +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 "P_Cache.h" - -#include "proxy/Show.h" -#include "iocore/eventsystem/Tasks.h" -#include "proxy/CacheControl.h" - -#if __has_include("pcre/pcre.h") -#include -#elif __has_include("pcre.h") -#include -#else -#error "Unable to locate PCRE heeader" -#endif - -namespace -{ - -DbgCtl dbg_ctl_cache_inspector{"cache_inspector"}; - -} // end anonymous namespace - -struct ShowCache : public ShowCont { - enum scan_type { - scan_type_lookup, - scan_type_delete, - scan_type_invalidate, - }; - - int vol_index; - int seg_index; - scan_type scan_flag; - int urlstrs_index; - int linecount; - char (*show_cache_urlstrs)[500]; - URL url; - CacheKey show_cache_key; - CacheVC *cache_vc; - MIOBuffer *buffer; - IOBufferReader *buffer_reader; - int64_t content_length; - VIO *cvio; - int showMain(int event, Event *e); - int lookup_url_form(int event, Event *e); - int delete_url_form(int event, Event *e); - int lookup_regex_form(int event, Event *e); - int delete_regex_form(int event, Event *e); - int invalidate_regex_form(int event, Event *e); - - int lookup_url(int event, Event *e); - int delete_url(int event, Event *e); - int lookup_regex(int event, Event *e); - int delete_regex(int event, Event *e); - int invalidate_regex(int event, Event *e); - - int handleCacheEvent(int event, Event *e); - int handleCacheDeleteComplete(int event, Event *e); - int handleCacheScanCallback(int event, Event *e); - - ShowCache(Continuation *c, HTTPHdr *h) - : ShowCont(c, h), - vol_index(0), - seg_index(0), - scan_flag(scan_type_lookup), - cache_vc(nullptr), - buffer(nullptr), - buffer_reader(nullptr), - content_length(0), - cvio(nullptr) - { - urlstrs_index = 0; - linecount = 0; - int query_len; - char query[4096]; - char unescapedQuery[sizeof(query)]; - show_cache_urlstrs = nullptr; - URL *u = h->url_get(); - - // process the query string - if (u->query_get(&query_len) && query_len < static_cast(sizeof(query))) { - strncpy(query, u->query_get(&query_len), query_len); - strncpy(unescapedQuery, u->query_get(&query_len), query_len); - - query[query_len] = unescapedQuery[query_len] = '\0'; - - query_len = unescapifyStr(query); - - Dbg(dbg_ctl_cache_inspector, "query params: '%s' len %d [unescaped]", unescapedQuery, query_len); - Dbg(dbg_ctl_cache_inspector, "query params: '%s' len %d [escaped]", query, query_len); - - // remove 'C-m' s - unsigned l, m; - for (l = 0, m = 0; l < static_cast(query_len); l++) { - if (query[l] != '\015') { - query[m++] = query[l]; - } - } - query[m] = '\0'; - - unsigned nstrings = 1; - char *p = strstr(query, "url="); - // count the no of urls - if (p) { - while ((p = strstr(p, "\n"))) { - nstrings++; - if (static_cast(p - query) >= strlen(query) - 1) { - break; - } else { - p++; - } - } - } - // initialize url array - show_cache_urlstrs = new char[nstrings + 1][500]; - memset(show_cache_urlstrs, '\0', (nstrings + 1) * 500 * sizeof(char)); - - char *q, *t; - p = strstr(unescapedQuery, "url="); - if (p) { - p += 4; // 4 ==> strlen("url=") - t = strchr(p, '&'); - if (!t) { - t = (char *)unescapedQuery + strlen(unescapedQuery); - } - for (int s = 0; p < t; s++) { - show_cache_urlstrs[s][0] = '\0'; - q = strstr(p, "%0D%0A" /* \r\n */); // we used this in the JS to separate urls - if (!q) { - q = t; - } - ink_strlcpy(show_cache_urlstrs[s], p, q - p + 1); - p = q + 6; // +6 ==> strlen(%0D%0A) - } - } - - Dbg(dbg_ctl_cache_inspector, "there were %d url(s) passed in", nstrings == 1 ? 1 : nstrings - 1); - - for (unsigned i = 0; i < nstrings; i++) { - if (show_cache_urlstrs[i][0] == '\0') { - continue; - } - Dbg(dbg_ctl_cache_inspector, "URL %d: '%s'", i + 1, show_cache_urlstrs[i]); - unescapifyStr(show_cache_urlstrs[i]); - Dbg(dbg_ctl_cache_inspector, "URL %d: '%s'", i + 1, show_cache_urlstrs[i]); - } - } - - SET_HANDLER(&ShowCache::showMain); - } - - ~ShowCache() override - { - if (show_cache_urlstrs) { - delete[] show_cache_urlstrs; - } - url.destroy(); - } -}; - -#define STREQ_PREFIX(_x, _s) (!strncasecmp(_x, _s, sizeof(_s) - 1)) -#define STREQ_LEN_PREFIX(_x, _l, _s) (path_len < sizeof(_s) && !strncasecmp(_x, _s, sizeof(_s) - 1)) - -Action * -register_ShowCache(Continuation *c, HTTPHdr *h) -{ - ShowCache *theshowcache = new ShowCache(c, h); - URL *u = h->url_get(); - int path_len; - const char *path = u->path_get(&path_len); - - if (!path) { - } else if (STREQ_PREFIX(path, "lookup_url_form")) { - SET_CONTINUATION_HANDLER(theshowcache, &ShowCache::lookup_url_form); - } else if (STREQ_PREFIX(path, "delete_url_form")) { - SET_CONTINUATION_HANDLER(theshowcache, &ShowCache::delete_url_form); - } else if (STREQ_PREFIX(path, "lookup_regex_form")) { - SET_CONTINUATION_HANDLER(theshowcache, &ShowCache::lookup_regex_form); - } else if (STREQ_PREFIX(path, "delete_regex_form")) { - SET_CONTINUATION_HANDLER(theshowcache, &ShowCache::delete_regex_form); - } else if (STREQ_PREFIX(path, "invalidate_regex_form")) { - SET_CONTINUATION_HANDLER(theshowcache, &ShowCache::invalidate_regex_form); - } - - else if (STREQ_PREFIX(path, "lookup_url")) { - SET_CONTINUATION_HANDLER(theshowcache, &ShowCache::lookup_url); - } else if (STREQ_PREFIX(path, "delete_url")) { - SET_CONTINUATION_HANDLER(theshowcache, &ShowCache::delete_url); - } else if (STREQ_PREFIX(path, "lookup_regex")) { - SET_CONTINUATION_HANDLER(theshowcache, &ShowCache::lookup_regex); - } else if (STREQ_PREFIX(path, "delete_regex")) { - SET_CONTINUATION_HANDLER(theshowcache, &ShowCache::delete_regex); - } else if (STREQ_PREFIX(path, "invalidate_regex")) { - SET_CONTINUATION_HANDLER(theshowcache, &ShowCache::invalidate_regex); - } - - if (theshowcache->mutex->thread_holding) { - CONT_SCHED_LOCK_RETRY(theshowcache); - } else { - eventProcessor.schedule_imm(theshowcache, ET_TASK); - } - - return &theshowcache->action; -} - -int -ShowCache::showMain(int event, Event *e) -{ - CHECK_SHOW(begin("Cache")); - CHECK_SHOW(show("

Lookup url

\n" - "

Delete url

\n" - "

Regex lookup

\n" - "

Regex delete

\n" - "

Regex invalidate

\n\n")); - return complete(event, e); -} - -int -ShowCache::lookup_url_form(int event, Event *e) -{ - CHECK_SHOW(begin("Cache Lookup")); - CHECK_SHOW(show("
\n" - "

Lookup

\n" - "\n" - "\n" - "
\n\n")); - return complete(event, e); -} - -int -ShowCache::delete_url_form(int event, Event *e) -{ - CHECK_SHOW(begin("Cache Delete")); - CHECK_SHOW(show("
\n" - "

Type the list urls that you want to delete\n" - "in the box below. The urls MUST be separated by\n" - "new lines

\n\n" - "\n" - "\n" - "
\n\n")); - return complete(event, e); -} - -int -ShowCache::lookup_regex_form(int event, Event *e) -{ - CHECK_SHOW(begin("Cache Regex Lookup")); - CHECK_SHOW(show("
\n" - "

Type the list of regular expressions that you want to lookup\n" - "in the box below. The regular expressions MUST be separated by\n" - "new lines

\n\n" - "\n" - "\n" - "
\n\n")); - return complete(event, e); -} - -int -ShowCache::delete_regex_form(int event, Event *e) -{ - CHECK_SHOW(begin("Cache Regex delete")); - CHECK_SHOW(show("
\n" - "

Type the list of regular expressions that you want to delete\n" - "in the box below. The regular expressions MUST be separated by\n" - "new lines

\n\n" - "\n" - "\n" - "
\n\n")); - return complete(event, e); -} - -int -ShowCache::invalidate_regex_form(int event, Event *e) -{ - CHECK_SHOW(begin("Cache Regex Invalidate")); - CHECK_SHOW(show("
\n" - "

Type the list of regular expressions that you want to invalidate\n" - "in the box below. The regular expressions MUST be separated by\n" - "new lines

\n\n" - "\n" - "\n" - "
\n")); - return complete(event, e); -} - -int -ShowCache::handleCacheEvent(int event, Event *e) -{ - // we use VC_EVENT_xxx to finish the cluster read in cluster mode - switch (event) { - case VC_EVENT_EOS: - case VC_EVENT_READ_COMPLETE: { - // cluster read done, we just print hit in cluster - CHECK_SHOW(show("

")); - CHECK_SHOW(show("\n")); - CHECK_SHOW(show("\n", content_length)); - - // delete button - CHECK_SHOW(show("\n" - "\n", - show_cache_urlstrs[0])); - CHECK_SHOW(show("
Doc Hit from Cluster
Size%" PRId64 "
Action
\n" - "\n" - "\n" - "

")); - - if (buffer_reader) { - buffer->dealloc_reader(buffer_reader); - buffer_reader = nullptr; - } - if (buffer) { - free_MIOBuffer(buffer); - buffer = nullptr; - } - cvio = nullptr; - cache_vc->do_io_close(-1); - cache_vc = nullptr; - return complete(event, e); - } - case CACHE_EVENT_OPEN_READ: { - // get the vector - cache_vc = reinterpret_cast(e); - CacheHTTPInfoVector *vec = &(cache_vc->vector); - int alt_count = vec->count(); - if (alt_count) { - // check cache_vc->first_buf is NULL, response cache lookup busy. - if (cache_vc->first_buf == nullptr) { - cache_vc->do_io_close(-1); - CHECK_SHOW(show("

Cache Lookup Busy, please try again

\n")); - return complete(event, e); - } - - Doc *d = reinterpret_cast(cache_vc->first_buf->data()); - time_t t; - char tmpstr[4096]; - - // print the Doc - CHECK_SHOW(show("

")); - CHECK_SHOW(show("\n")); - CHECK_SHOW( - show("\n", cache_vc->vol->cache_vol->vol_number, cache_vc->vol->path)); - CHECK_SHOW(show("\n", d->first_key.toHexStr(tmpstr))); - CHECK_SHOW(show("\n", d->key.toHexStr(tmpstr))); - CHECK_SHOW(show("\n", d->sync_serial)); - CHECK_SHOW(show("\n", d->write_serial)); - CHECK_SHOW(show("\n", d->hlen)); - CHECK_SHOW(show("\n", d->doc_type)); - CHECK_SHOW(show("\n", alt_count)); - - CHECK_SHOW(show("\n" - "\n", - show_cache_urlstrs[0])); - CHECK_SHOW(show("
Doc
Volume #%d - store='%s'
first key %s
key %s
sync_serial%lu
write_serial%lu
header length%lu
fragment type%lu
No of Alternates%d
Action
\n" - "\n" - "\n" - "

")); - - for (int i = 0; i < alt_count; i++) { - // unmarshal the alternate?? - CHECK_SHOW(show("

\n")); - CHECK_SHOW(show("\n", i + 1)); - CacheHTTPInfo *obj = vec->get(i); - CacheKey obj_key = obj->object_key_get(); - HTTPHdr *cached_request = obj->request_get(); - HTTPHdr *cached_response = obj->response_get(); - int64_t obj_size = obj->object_size_get(); - int offset, tmp, used, done; - char b[4096]; - - // print request header - CHECK_SHOW(show("\n")); - - // print response header - CHECK_SHOW(show("\n")); - CHECK_SHOW(show("\n", obj_size)); - CHECK_SHOW(show("\n", obj_key.toHexStr(tmpstr))); - t = obj->request_sent_time_get(); - ink_ctime_r(&t, tmpstr); - CHECK_SHOW(show("\n", tmpstr)); - t = obj->response_received_time_get(); - ink_ctime_r(&t, tmpstr); - - CHECK_SHOW(show("\n", tmpstr)); - CHECK_SHOW(show("
Alternate %d
Request Header
"));
-        offset = 0;
-        do {
-          used     = 0;
-          tmp      = offset;
-          done     = cached_request->print(b, 4095, &used, &tmp);
-          offset  += used;
-          b[used]  = '\0';
-          CHECK_SHOW(show("%s", b));
-        } while (!done);
-        CHECK_SHOW(show("
Response Header
"));
-        offset = 0;
-        do {
-          used     = 0;
-          tmp      = offset;
-          done     = cached_response->print(b, 4095, &used, &tmp);
-          offset  += used;
-          b[used]  = '\0';
-          CHECK_SHOW(show("%s", b));
-        } while (!done);
-        CHECK_SHOW(show("
Size%" PRId64 "
Key%s
Request sent time%s
Response received time%s

")); - } - - cache_vc->do_io_close(-1); - return complete(event, e); - } - // open success but no vector, that is the Cluster open read, pass through - } - // fallthrough - - case VC_EVENT_READ_READY: - if (!cvio) { - buffer = new_empty_MIOBuffer(BUFFER_SIZE_INDEX_32K); - buffer_reader = buffer->alloc_reader(); - content_length = cache_vc->get_object_size(); - cvio = cache_vc->do_io_read(this, content_length, buffer); - } else { - buffer_reader->consume(buffer_reader->read_avail()); - } - return EVENT_DONE; - case CACHE_EVENT_OPEN_READ_FAILED: - // something strange happen, or cache miss in cluster mode. - CHECK_SHOW(show("

Cache Lookup Failed, or missing in cluster

\n")); - return complete(event, e); - default: - CHECK_SHOW(show("

Cache Miss

\n")); - return complete(event, e); - } -} - -int -ShowCache::lookup_url(int event, Event *e) -{ - char header_str[300]; - HttpCacheKey key; - cache_generation_t generation = -1; - - snprintf(header_str, sizeof(header_str), "%s", show_cache_urlstrs[0]); - CHECK_SHOW(begin(header_str)); - url.create(nullptr); - const char *s; - s = show_cache_urlstrs[0]; - url.parse(&s, s + strlen(s)); - - RecGetRecordInt("proxy.config.http.cache.generation", &generation); - Cache::generate_key(&key, &url, generation); - - SET_HANDLER(&ShowCache::handleCacheEvent); - Action *lookup_result = cacheProcessor.open_read(this, &key.hash, CACHE_FRAG_TYPE_HTTP, key.hostname, key.hostlen); - if (!lookup_result) { - lookup_result = ACTION_IO_ERROR; - } - if (lookup_result == ACTION_RESULT_DONE) { - return EVENT_DONE; // callback complete - } else if (lookup_result == ACTION_IO_ERROR) { - handleEvent(CACHE_EVENT_OPEN_READ_FAILED, nullptr); - return EVENT_DONE; // callback complete - } else { - return EVENT_CONT; // callback pending, will be a cluster read. - } -} - -int -ShowCache::delete_url(int event, Event *e) -{ - if (urlstrs_index == 0) { - // print the header the first time delete_url is called - CHECK_SHOW(begin("Delete URL")); - CHECK_SHOW(show("\n")); - } - - if (strcmp(show_cache_urlstrs[urlstrs_index], "") == 0) { - // close the page when you reach the end of the - // url list - CHECK_SHOW(show("
\n")); - return complete(event, e); - } - url.create(nullptr); - const char *s; - s = show_cache_urlstrs[urlstrs_index]; - CHECK_SHOW(show("%s", s)); - url.parse(&s, s + strlen(s)); - SET_HANDLER(&ShowCache::handleCacheDeleteComplete); - // increment the index so that the next time - // delete_url is called you delete the next url - urlstrs_index++; - - HttpCacheKey key; - Cache::generate_key(&key, &url); // XXX choose a cache generation number ... - - cacheProcessor.remove(this, &key, CACHE_FRAG_TYPE_HTTP); - return EVENT_DONE; -} - -int -ShowCache::handleCacheDeleteComplete(int event, Event *e) -{ - if (event == CACHE_EVENT_REMOVE) { - CHECK_SHOW(show("Delete succeeded\n")); - } else { - CHECK_SHOW(show("Delete failed\n")); - } - return delete_url(event, e); -} - -int -ShowCache::lookup_regex(int event, Event *e) -{ - CHECK_SHOW(begin("Regex Lookup")); - CHECK_SHOW(show("\n")); - - CHECK_SHOW(show("
\n" - "\n" - "\n")); - - scan_flag = scan_type_lookup; // lookup - SET_HANDLER(&ShowCache::handleCacheScanCallback); - cacheProcessor.scan(this); - return EVENT_DONE; -} - -int -ShowCache::delete_regex(int event, Event *e) -{ - CHECK_SHOW(begin("Regex Delete")); - CHECK_SHOW(show("
\n")); - scan_flag = scan_type_delete; // delete - SET_HANDLER(&ShowCache::handleCacheScanCallback); - cacheProcessor.scan(this); - return EVENT_DONE; -} - -int -ShowCache::invalidate_regex(int event, Event *e) -{ - CHECK_SHOW(begin("Regex Invalidate")); - CHECK_SHOW(show("
\n")); - scan_flag = scan_type_invalidate; // invalidate - SET_HANDLER(&ShowCache::handleCacheScanCallback); - cacheProcessor.scan(this); - return EVENT_DONE; -} - -int -ShowCache::handleCacheScanCallback(int event, Event *e) -{ - switch (event) { - case CACHE_EVENT_SCAN: { - cache_vc = reinterpret_cast(e); - return EVENT_CONT; - } - case CACHE_EVENT_SCAN_OBJECT: { - HTTPInfo *alt = reinterpret_cast(e); - char xx[501], m[501]; - int ib = 0, xd = 0, ml = 0; - - alt->request_get()->url_print(xx, 500, &ib, &xd); - xx[ib] = '\0'; - - const char *mm = alt->request_get()->method_get(&ml); - - memcpy(m, mm, ml); - m[ml] = 0; - - int res = CACHE_SCAN_RESULT_CONTINUE; - - for (unsigned s = 0; show_cache_urlstrs[s][0] != '\0'; s++) { - const char *error; - int erroffset; - pcre *preq = pcre_compile(show_cache_urlstrs[s], 0, &error, &erroffset, nullptr); - - Dbg(dbg_ctl_cache_inspector, "matching url '%s' '%s' with regex '%s'", m, xx, show_cache_urlstrs[s]); - - if (preq) { - int r = pcre_exec(preq, nullptr, xx, ib, 0, 0, nullptr, 0); - - pcre_free(preq); - if (r != -1) { - linecount++; - if ((linecount % 5) == 0) { - CHECK_SHOW(show("")); - } else { - CHECK_SHOW(show("")); - } - - switch (scan_flag) { - case scan_type_lookup: - /*Y! Bug: 2249781: using onClick() because i need encodeURIComponent() and YTS doesn't have something like that */ - CHECK_SHOW(show("" - "\n", - xx, xx, xx)); - break; - case scan_type_delete: - CHECK_SHOW(show("" - "\n", - xx)); - res = CACHE_SCAN_RESULT_DELETE; - break; - case scan_type_invalidate: - HTTPInfo new_info; - res = CACHE_SCAN_RESULT_UPDATE; - new_info.copy(alt); - new_info.response_get()->set_cooked_cc_need_revalidate_once(); - CHECK_SHOW(show("" - "" - "\n", - xx)); - cache_vc->set_http_info(&new_info); - } - - break; - } - } else { - // TODO: Regex didn't compile, show errors ? - Dbg(dbg_ctl_cache_inspector, "regex '%s' didn't compile", show_cache_urlstrs[s]); - } - } - return res; - } - case CACHE_EVENT_SCAN_DONE: - CHECK_SHOW(show("
" - "%s
%sdeleted
%sInvalidate
\n")); - if (scan_flag == 0) { - if (linecount) { - CHECK_SHOW(show("

" - "\n")); - } - } - CHECK_SHOW(show("

Done

\n")); - Dbg(dbg_ctl_cache_inspector, "scan done"); - complete(event, e); - return EVENT_DONE; - case CACHE_EVENT_SCAN_FAILED: - default: - CHECK_SHOW(show("

Error while scanning disk

\n")); - return EVENT_DONE; - } -} diff --git a/src/iocore/cache/CachePagesInternal.cc b/src/iocore/cache/CachePagesInternal.cc deleted file mode 100644 index c375acc0de3..00000000000 --- a/src/iocore/cache/CachePagesInternal.cc +++ /dev/null @@ -1,342 +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 "P_Cache.h" - -#include "proxy/Show.h" -#include "iocore/eventsystem/Tasks.h" - -struct ShowCacheInternal : public ShowCont { - int vol_index = 0; - int seg_index = 0; - CacheKey show_cache_key; - CacheVC *cache_vc = nullptr; - - int showMain(int event, Event *e); - int showEvacuations(int event, Event *e); - int showVolEvacuations(int event, Event *e); - int showVolumes(int event, Event *e); - int showVolVolumes(int event, Event *e); - int showSegments(int event, Event *e); - int showSegSegment(int event, Event *e); -#ifdef CACHE_STAT_PAGES - int showConnections(int event, Event *e); - int showVolConnections(int event, Event *e); -#endif - - ShowCacheInternal(Continuation *c, HTTPHdr *h) : ShowCont(c, h) { SET_HANDLER(&ShowCacheInternal::showMain); } - - ~ShowCacheInternal() override {} -}; -extern ShowCacheInternal *theshowcacheInternal; -Action *register_ShowCacheInternal(Continuation *c, HTTPHdr *h); - -extern Stripe **gvol; - -// Stat Pages -ShowCacheInternal *theshowcacheInternal = nullptr; - -#define STREQ_PREFIX(_x, _s) (!strncasecmp(_x, _s, sizeof(_s) - 1)) -#define STREQ_LEN_PREFIX(_x, _l, _s) (path_len < sizeof(_s) && !strncasecmp(_x, _s, sizeof(_s) - 1)) - -Action * -register_ShowCacheInternal(Continuation *c, HTTPHdr *h) -{ - theshowcacheInternal = new ShowCacheInternal(c, h); - URL *u = h->url_get(); - - int path_len; - const char *path = u->path_get(&path_len); - - if (!path) { - } -#ifdef CACHE_STAT_PAGES - else if (STREQ_LEN_PREFIX(path, path_len, "connections")) { - SET_CONTINUATION_HANDLER(theshowcacheInternal, &ShowCacheInternal::showConnections); - } -#endif - else if (STREQ_PREFIX(path, "evacuations")) { - SET_CONTINUATION_HANDLER(theshowcacheInternal, &ShowCacheInternal::showEvacuations); - } else if (STREQ_PREFIX(path, "volumes")) { - SET_CONTINUATION_HANDLER(theshowcacheInternal, &ShowCacheInternal::showVolumes); - } - - if (theshowcacheInternal->mutex->thread_holding) { - CONT_SCHED_LOCK_RETRY(theshowcacheInternal); - } else { - eventProcessor.schedule_imm(theshowcacheInternal, ET_TASK); - } - return &theshowcacheInternal->action; -} - -int -ShowCacheInternal::showMain(int event, Event *e) -{ - CHECK_SHOW(begin("Cache")); -#ifdef CACHE_STAT_PAGES - CHECK_SHOW(show("

Show Connections

\n" - "

Show Evacuations

\n" - "

Show Volumes

\n")); -#else - CHECK_SHOW(show("

Show Evacuations

\n" - "

Show Volumes

\n")); -#endif - return complete(event, e); -} - -#ifdef CACHE_STAT_PAGES -int -ShowCacheInternal::showConnections(int event, Event *e) -{ - CHECK_SHOW(begin("Cache VConnections")); - CHECK_SHOW(show("

Cache Connections

\n" - "" - "" - "" - "" - "" - "" - "" - "\n")); - - SET_HANDLER(&ShowCacheInternal::showVolConnections); - CONT_SCHED_LOCK_RETRY_RET(this); -} - -int -ShowCacheInternal::showVolConnections(int event, Event *e) -{ - CACHE_TRY_LOCK(lock, gvol[vol_index]->mutex, mutex->thread_holding); - if (!lock) { - CONT_SCHED_LOCK_RETRY_RET(this); - } - for (CacheVC *vc = (CacheVC *)gvol[vol_index]->stat_cache_vcs.head; vc; vc = vc->stat_link.next) { - char nbytes[60], todo[60], url[81092]; - int ib = 0, xd = 0; - URL uu; - - SCOPED_MUTEX_LOCK(lock2, vc->mutex, mutex->thread_holding); - // if vc is closed ignore - Ramki 08/30/2000 - if (vc->closed == 1) - continue; - snprintf(nbytes, sizeof(nbytes), "%d", vc->vio.nbytes); - snprintf(todo, sizeof(todo), "%d", vc->vio.ntodo()); - - if (vc->f.frag_type == CACHE_FRAG_TYPE_HTTP && vc->request.valid()) { - URL *u = vc->request.url_get(&uu); - u->print(url, 8000, &ib, &xd); - url[ib] = 0; - } else if (vc->alternate.valid()) { - URL *u = vc->alternate.request_url_get(&uu); - u->print(url, 8000, &ib, &xd); - url[ib] = 0; - } else - vc->key.string(url); - CHECK_SHOW(show("" - "" // operation - "" // Stripe - "" // URL/Hash - "" - "" - "" - "\n", - ((vc->vio.op == VIO::READ) ? "Read" : "Write"), vc->vol->hash_id, url, vc->vio.ndone, - vc->vio.nbytes == INT64_MAX ? "all" : nbytes, vc->vio.nbytes == INT64_MAX ? "all" : todo)); - } - vol_index++; - if (vol_index < gnvol) - CONT_SCHED_LOCK_RETRY(this); - else { - CHECK_SHOW(show("
OperationVolumeURL/HashBytes DoneTotal BytesBytes Todo
%s%s%s%d%s%s
\n")); - return complete(event, e); - } - return EVENT_CONT; -} - -#endif - -int -ShowCacheInternal::showEvacuations(int event, Event *e) -{ - CHECK_SHOW(begin("Cache Pending Evacuations")); - CHECK_SHOW(show("

Cache Evacuations

\n" - "" - "" - "" - "" - "" - "\n")); - - SET_HANDLER(&ShowCacheInternal::showVolEvacuations); - CONT_SCHED_LOCK_RETRY_RET(this); -} - -int -ShowCacheInternal::showVolEvacuations(int event, Event *e) -{ - Stripe *p = gvol[vol_index]; - CACHE_TRY_LOCK(lock, p->mutex, mutex->thread_holding); - if (!lock.is_locked()) { - CONT_SCHED_LOCK_RETRY_RET(this); - } - - EvacuationBlock *b; - int last = (p->len - (p->start - p->skip)) / EVACUATION_BUCKET_SIZE; - for (int i = 0; i < last; i++) { - for (b = p->evacuate[i].head; b; b = b->link.next) { - char offset[60]; - snprintf(offset, sizeof(offset), "%" PRIu64 "", static_cast(p->vol_offset(&b->dir))); - CHECK_SHOW(show("" - "" // offset - "" // estimated size - "" // reader count - "" // done - "\n", - offset, (int)dir_approx_size(&b->dir), b->readers, b->f.done ? "yes" : "no")); - } - } - vol_index++; - if (vol_index < gnvol) { - CONT_SCHED_LOCK_RETRY(this); - } else { - CHECK_SHOW(show("
OffsetEstimated SizeReader CountDone
%s%d%d%s
\n")); - return complete(event, e); - } - return EVENT_CONT; -} - -int -ShowCacheInternal::showVolumes(int event, Event *e) -{ - CHECK_SHOW(begin("Cache Volumes")); - CHECK_SHOW(show("

Cache Volumes

\n" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "\n")); - - SET_HANDLER(&ShowCacheInternal::showVolVolumes); - CONT_SCHED_LOCK_RETRY_RET(this); -} - -int -ShowCacheInternal::showVolVolumes(int event, Event *e) -{ - Stripe *p = gvol[vol_index]; - CACHE_TRY_LOCK(lock, p->mutex, mutex->thread_holding); - if (!lock.is_locked()) { - CONT_SCHED_LOCK_RETRY_RET(this); - } - - char ctime[256]; - ink_ctime_r(&p->header->create_time, ctime); - ctime[strlen(ctime) - 1] = 0; - int agg_todo = 0; - int agg_done = p->agg_buf_pos; - CacheVC *c = nullptr; - for (c = p->agg.head; c; c = (CacheVC *)c->link.next) { - agg_todo++; - } - CHECK_SHOW(show("" - "" // ID - "" // blocks - "" // directory entries - "" // write position - "" // write agg to do - "" // write agg to do size - "" // write agg done - "" // phase - "" // create time - "" // sync serial - "" // write serial - "\n", - p->hash_text.get(), (uint64_t)((p->len - (p->start - p->skip)) / CACHE_BLOCK_SIZE), - (uint64_t)(p->buckets * DIR_DEPTH * p->segments), - (uint64_t)((p->header->write_pos - p->start) / CACHE_BLOCK_SIZE), agg_todo, p->agg_todo_size, agg_done, - p->header->phase, ctime, p->header->sync_serial, p->header->write_serial)); - CHECK_SHOW(show("
IDBlocksDirectory EntriesWrite PositionWrite Agg TodoWrite Agg Todo SizeWrite Agg DonePhaseCreate TimeSync SerialWrite Serial
%s%" PRId64 "%" PRId64 "%" PRId64 "%d%d%d%d%s%u%u
\n")); - SET_HANDLER(&ShowCacheInternal::showSegments); - return showSegments(event, e); -} - -int -ShowCacheInternal::showSegments(int event, Event *e) -{ - CHECK_SHOW(show("

Cache Volume Segments

\n" - "" - "" - "" - "" - "" - "" - "" - "\n")); - - SET_HANDLER(&ShowCacheInternal::showSegSegment); - seg_index = 0; - CONT_SCHED_LOCK_RETRY_RET(this); -} - -int -ShowCacheInternal::showSegSegment(int event, Event *e) -{ - Stripe *p = gvol[vol_index]; - CACHE_TRY_LOCK(lock, p->mutex, mutex->thread_holding); - if (!lock.is_locked()) { - CONT_SCHED_LOCK_RETRY_RET(this); - } - int free = 0, used = 0, empty = 0, valid = 0, agg_valid = 0, avg_size = 0; - dir_segment_accounted(seg_index, p, 0, &free, &used, &empty, &valid, &agg_valid, &avg_size); - CHECK_SHOW(show("" - "" - "" - "" - "" - "" - "" - "\n", - free, used, empty, valid, agg_valid, avg_size)); - seg_index++; - if (seg_index < p->segments) { - CONT_SCHED_LOCK_RETRY(this); - } else { - CHECK_SHOW(show("
FreeUsedEmptyValidAgg ValidAvg Size
%d%d%d%d%d%d
\n")); - seg_index = 0; - vol_index++; - if (vol_index < gnvol) { - CONT_SCHED_LOCK_RETRY(this); - } else { - return complete(event, e); - } - } - return EVENT_CONT; -} diff --git a/src/iocore/cache/Makefile.am b/src/iocore/cache/Makefile.am index 48e48fe6e7e..53f6b15da53 100644 --- a/src/iocore/cache/Makefile.am +++ b/src/iocore/cache/Makefile.am @@ -38,8 +38,6 @@ libinkcache_a_SOURCES = \ CacheEvacuateDocVC.h \ CacheHosting.cc \ CacheHttp.cc \ - CachePages.cc \ - CachePagesInternal.cc \ CacheRead.cc \ CacheVC.cc \ CacheVol.cc \ diff --git a/src/iocore/cache/P_CacheInternal.h b/src/iocore/cache/P_CacheInternal.h index 2b8452a7b17..0b919daf187 100644 --- a/src/iocore/cache/P_CacheInternal.h +++ b/src/iocore/cache/P_CacheInternal.h @@ -44,17 +44,10 @@ struct EvacuationBlock; #define ALTERNATES 1 // #define CACHE_LOCK_FAIL_RATE 0.001 // #define CACHE_AGG_FAIL_RATE 0.005 -// #define CACHE_INSPECTOR_PAGES #define MAX_CACHE_VCS_PER_THREAD 500 #define INTEGRAL_FRAGS 4 -#ifdef CACHE_INSPECTOR_PAGES -#ifdef DEBUG -#define CACHE_STAT_PAGES -#endif -#endif - #ifdef DEBUG #define DDbg(dbg_ctl, fmt, ...) Dbg(dbg_ctl, fmt, ##__VA_ARGS__) #else @@ -171,10 +164,6 @@ new_CacheVC(Continuation *cont) ink_assert(c->trigger == nullptr); static DbgCtl dbg_ctl{"cache_new"}; Dbg(dbg_ctl, "new %p", c); -#ifdef CACHE_STAT_PAGES - ink_assert(!c->stat_link.next); - ink_assert(!c->stat_link.prev); -#endif dir_clear(&c->dir); return c; } @@ -226,9 +215,6 @@ free_CacheVC(CacheVC *cont) ats_free(cont->scan_vol_map); memset((char *)&cont->vio, 0, cont->size_to_init); -#ifdef CACHE_STAT_PAGES - ink_assert(!cont->stat_link.next && !cont->stat_link.prev); -#endif #ifdef DEBUG SET_CONTINUATION_HANDLER(cont, &CacheVC::dead); #endif @@ -376,11 +362,6 @@ CacheVC::writer_done() inline int Stripe::close_write(CacheVC *cont) { -#ifdef CACHE_STAT_PAGES - ink_assert(stat_cache_vcs.head); - stat_cache_vcs.remove(cont, cont->stat_link); - ink_assert(!cont->stat_link.next && !cont->stat_link.prev); -#endif return open_dir.close_write(cont); } @@ -405,11 +386,6 @@ Stripe::open_write(CacheVC *cont, int allow_if_writers, int max_writers) } if (open_dir.open_write(cont, allow_if_writers, max_writers)) { -#ifdef CACHE_STAT_PAGES - ink_assert(cont->mutex->thread_holding == this_ethread()); - ink_assert(!cont->stat_link.next && !cont->stat_link.prev); - stat_cache_vcs.enqueue(cont, cont->stat_link); -#endif return 0; } return ECACHE_DOC_BUSY; @@ -450,13 +426,11 @@ Stripe::open_read_lock(CryptoHash *key, EThread *t) inline int Stripe::begin_read_lock(CacheVC *cont) { -// no need for evacuation as the entire document is already in memory -#ifndef CACHE_STAT_PAGES + // no need for evacuation as the entire document is already in memory if (cont->f.single_fragment) { return 0; } -#endif - // VC is enqueued in stat_cache_vcs in the begin_read call + EThread *t = cont->mutex->thread_holding; CACHE_TRY_LOCK(lock, mutex, t); if (!lock.is_locked()) { diff --git a/src/iocore/cache/P_CacheVol.h b/src/iocore/cache/P_CacheVol.h index 873ec462ad4..938f7e99b32 100644 --- a/src/iocore/cache/P_CacheVol.h +++ b/src/iocore/cache/P_CacheVol.h @@ -150,7 +150,6 @@ struct Stripe : public Continuation { AIOCallbackInternal io; Queue agg; - Queue stat_cache_vcs; Queue sync; char *agg_buffer = nullptr; int agg_todo_size = 0; diff --git a/src/iocore/cache/Stripe.cc b/src/iocore/cache/Stripe.cc index 3e5eca78961..818d1480f7e 100644 --- a/src/iocore/cache/Stripe.cc +++ b/src/iocore/cache/Stripe.cc @@ -75,10 +75,6 @@ Stripe::begin_read(CacheVC *cont) const { ink_assert(cont->mutex->thread_holding == this_ethread()); ink_assert(mutex->thread_holding == this_ethread()); -#ifdef CACHE_STAT_PAGES - ink_assert(!cont->stat_link.next && !cont->stat_link.prev); - stat_cache_vcs.enqueue(cont, cont->stat_link); -#endif // no need for evacuation as the entire document is already in memory if (cont->f.single_fragment) { return 0; @@ -129,10 +125,7 @@ Stripe::close_read(CacheVC *cont) const } b = next; } -#ifdef CACHE_STAT_PAGES - stat_cache_vcs.remove(cont, cont->stat_link); - ink_assert(!cont->stat_link.next && !cont->stat_link.prev); -#endif + return 1; } diff --git a/src/iocore/cache/unit_tests/main.cc b/src/iocore/cache/unit_tests/main.cc index 863f656ee2a..e522acd854e 100644 --- a/src/iocore/cache/unit_tests/main.cc +++ b/src/iocore/cache/unit_tests/main.cc @@ -24,7 +24,6 @@ #include "tscore/ink_config.h" #include #include "proxy/HttpAPIHooks.h" -#include "proxy/StatPages.h" #include "iocore/net/SSLAPIHooks.h" #define CATCH_CONFIG_MAIN @@ -144,7 +143,6 @@ struct EventProcessorListener : Catch::TestEventListenerBase { init_global_http_hooks(); init_global_ssl_hooks(); - statPagesManager.init(); // mutex needs to be initialized before calling netProcessor.init netProcessor.init(); eventProcessor.start(THREADS); diff --git a/src/iocore/hostdb/HostDB.cc b/src/iocore/hostdb/HostDB.cc index 52e93d2cbdd..4617e6cb491 100644 --- a/src/iocore/hostdb/HostDB.cc +++ b/src/iocore/hostdb/HostDB.cc @@ -26,7 +26,6 @@ #include "P_HostDB.h" #include "tscore/Layout.h" -#include "proxy/Show.h" #include "tscore/ink_apidefs.h" #include "tscore/MgmtDefs.h" // MgmtInt, MgmtFloat, etc #include "iocore/hostdb/HostFile.h" @@ -170,8 +169,6 @@ string_for(HostDBMark mark) // // Function Prototypes // -static Action *register_ShowHostDB(Continuation *c, HTTPHdr *h); - HostDBHash & HostDBHash::set_host(TextView name) { @@ -354,8 +351,6 @@ HostDBProcessor::start(int, size_t) int HostDBProcessor::init() { - statPagesManager.register_http("hostdb", register_ShowHostDB); - // // Register configuration callback, and establish configuration links // @@ -1453,270 +1448,6 @@ HostDBRecord::select_best_http(ts_time now, ts_seconds fail_window, sockaddr con return best_alive; } -struct ShowHostDB; -using ShowHostDBEventHandler = int (ShowHostDB::*)(int, Event *); -struct ShowHostDB : public ShowCont { - char *name; - uint16_t port; - IpEndpoint ip; - bool force; - bool output_json; - int records_seen; - - int - showMain(int event, Event *e) - { - CHECK_SHOW(begin("HostDB")); - CHECK_SHOW(show("Show all HostDB records
")); - CHECK_SHOW(show("
\n" - "Lookup by name (e.g. trafficserver.apache.org):
\n" - "\n" - "
\n" - "
\n" - "Lookup by IP (e.g. 127.0.0.1):
\n" - "\n" - "
\n" - "
\n" - "Force DNS by name (e.g. trafficserver.apache.org):
\n" - "\n" - "
\n")); - return complete(event, e); - } - - int - showLookup(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */) - { - SET_HANDLER(&ShowHostDB::showLookupDone); - if (name) { - HostDBProcessor::Options opts; - opts.port = port; - opts.flags = HostDBProcessor::HOSTDB_DO_NOT_FORCE_DNS; - hostDBProcessor.getbynameport_re(this, name, strlen(name), opts); - } else { - hostDBProcessor.getbyaddr_re(this, &ip.sa); - } - return EVENT_CONT; - } - - int - showAll(int event, Event *e) - { - if (!output_json) { - CHECK_SHOW(begin("HostDB All Records")); - CHECK_SHOW(show("
")); - } else { - CHECK_SHOW(show("[")); - } - SET_HANDLER(&ShowHostDB::showAllEvent); - hostDBProcessor.iterate(this); - return EVENT_CONT; - } - - int - showAllEvent(int event, Event *e) - { - if (event == EVENT_INTERVAL) { - auto *r = reinterpret_cast(e); - if (output_json && records_seen++ > 0) { - CHECK_SHOW(show(",")); // we need to separate records - } - auto rr_info{r->rr_info()}; - if (rr_info.count()) { - if (!output_json) { - CHECK_SHOW(show("\n")); - CHECK_SHOW(show("\n", "Total", r->rr_count)); - CHECK_SHOW(show("\n", "Current", r->_rr_idx.load())); - CHECK_SHOW(show("\n", "Stale", r->is_ip_configured_stale() ? "Yes" : "No")); - CHECK_SHOW(show("\n", "Timed-Out", r->is_ip_timeout() ? "Yes" : "No")); - CHECK_SHOW(show("
%s%d
%s%d
%s%s
%s%s
\n")); - } else { - CHECK_SHOW(show(",\"%s\":\"%d\",", "rr_total", r->rr_count)); - CHECK_SHOW(show("\"%s\":\"%d\",", "rr_current", r->_rr_idx.load())); - CHECK_SHOW(show("\"rr_records\":[")); - } - CHECK_SHOW(show("%s%d\n", "TTL", r->ip_time_remaining())); - - bool need_separator = false; - for (auto &item : rr_info) { - showOne(&item, r->record_type, event, e); - if (output_json) { - CHECK_SHOW(show("}")); // we need to separate records - if (need_separator) { - CHECK_SHOW(show(",")); - } - need_separator = true; - } - } - - if (!output_json) { - CHECK_SHOW(show("
\n
\n")); - } else { - CHECK_SHOW(show("]")); - } - } - - if (output_json) { - CHECK_SHOW(show("}")); - } - - } else if (event == EVENT_DONE) { - if (output_json) { - CHECK_SHOW(show("]")); - return completeJson(event, e); - } else { - return complete(event, e); - } - } else { - ink_assert(!"unexpected event"); - } - return EVENT_CONT; - } - - int - showOne(HostDBInfo *info, HostDBType record_type, int event, Event *e) - { - ip_text_buffer b; - if (!output_json) { - CHECK_SHOW(show("\n")); - CHECK_SHOW(show("\n", "Type", name_of(record_type))); - - if (HostDBType::SRV == record_type) { - CHECK_SHOW(show("\n", "Hostname", info->srvname())); - } - - // Let's display the hash. - CHECK_SHOW(show("\n", "LastFailure", info->last_failure.load().time_since_epoch().count())); - - if (HostDBType::SRV == record_type) { - CHECK_SHOW(show("\n", "Weight", info->data.srv.srv_weight)); - CHECK_SHOW(show("\n", "Priority", info->data.srv.srv_priority)); - CHECK_SHOW(show("\n", "Port", info->data.srv.srv_port)); - CHECK_SHOW(show("\n", "Key", info->data.srv.key)); - } else { - CHECK_SHOW(show("\n", "IP", info->data.ip.toString(b, sizeof b))); - } - - CHECK_SHOW(show("
%s%s
%s%s
%s%u
%s%d
%s%d
%s%d
%s%x
%s%s
\n")); - } else { - CHECK_SHOW(show("{")); - CHECK_SHOW(show("\"%s\":\"%s\",", "type", name_of(record_type))); - - if (HostDBType::SRV == record_type) { - CHECK_SHOW(show("\"%s\":\"%s\",", "hostname", info->srvname())); - } - - CHECK_SHOW(show("\"%s\":\"%u\",", "lastfailure", info->last_failure.load().time_since_epoch().count())); - - if (HostDBType::SRV == record_type) { - CHECK_SHOW(show("\"%s\":\"%d\",", "weight", info->data.srv.srv_weight)); - CHECK_SHOW(show("\"%s\":\"%d\",", "priority", info->data.srv.srv_priority)); - CHECK_SHOW(show("\"%s\":\"%d\",", "port", info->data.srv.srv_port)); - CHECK_SHOW(show("\"%s\":\"%x\",", "key", info->data.srv.key)); - } else { - CHECK_SHOW(show("\"%s\":\"%s\"", "ip", info->data.ip.toString(b, sizeof b))); - } - } - return EVENT_CONT; - } - - int - showLookupDone(int event, Event *e) - { - auto *r = reinterpret_cast(e); - - CHECK_SHOW(begin("HostDB Lookup")); - if (name) { - CHECK_SHOW(show("

%s

\n", name)); - } else { - CHECK_SHOW(show("

%u.%u.%u.%u

\n", PRINT_IP(ip))); - } - if (r) { - auto rr_data = r->rr_info(); - if (rr_data.count()) { - CHECK_SHOW(show("\n")); - CHECK_SHOW(show("\n", "Total", r->rr_count)); - CHECK_SHOW(show("\n", "Current", r->_rr_idx.load())); - CHECK_SHOW(show("
%s%d
%s%d
\n")); - - for (auto &item : rr_data) { - showOne(&item, r->record_type, event, e); - } - } - } else { - if (!name) { - ip_text_buffer b; - CHECK_SHOW(show("

%s Not Found

\n", ats_ip_ntop(&ip.sa, b, sizeof b))); - } else { - CHECK_SHOW(show("

%s Not Found

\n", name)); - } - } - return complete(event, e); - } - - ShowHostDB(Continuation *c, HTTPHdr *h) - : ShowCont(c, h), name(nullptr), port(0), force(false), output_json(false), records_seen(0) - { - ats_ip_invalidate(&ip); - SET_HANDLER(&ShowHostDB::showMain); - } -}; - -#define STR_LEN_EQ_PREFIX(_x, _l, _s) (!ptr_len_ncasecmp(_x, _l, _s, sizeof(_s) - 1)) - -static Action * -register_ShowHostDB(Continuation *c, HTTPHdr *h) -{ - ShowHostDB *s = new ShowHostDB(c, h); - int path_len; - const char *path = h->url_get()->path_get(&path_len); - - SET_CONTINUATION_HANDLER(s, &ShowHostDB::showMain); - if (STR_LEN_EQ_PREFIX(path, path_len, "ip")) { - s->force = !ptr_len_ncasecmp(path + 3, path_len - 3, "force", 5); - int query_len; - const char *query = h->url_get()->query_get(&query_len); - s->sarg = ats_strndup(query, query_len); - char *gn = nullptr; - if (s->sarg) { - gn = static_cast(memchr(s->sarg, '=', strlen(s->sarg))); - } - if (gn) { - ats_ip_pton(gn + 1, &s->ip); // hope that's null terminated. - } - SET_CONTINUATION_HANDLER(s, &ShowHostDB::showLookup); - } else if (STR_LEN_EQ_PREFIX(path, path_len, "name")) { - s->force = !ptr_len_ncasecmp(path + 5, path_len - 5, "force", 5); - int query_len; - const char *query = h->url_get()->query_get(&query_len); - s->sarg = ats_strndup(query, query_len); - char *gn = nullptr; - if (s->sarg) { - gn = static_cast(memchr(s->sarg, '=', strlen(s->sarg))); - } - if (gn) { - s->name = gn + 1; - char *pos = strstr(s->name, "%3A"); - if (pos != nullptr) { - s->port = atoi(pos + 3); - *pos = '\0'; // Null terminate name - } else { - s->port = 0; - } - } - SET_CONTINUATION_HANDLER(s, &ShowHostDB::showLookup); - } else if (STR_LEN_EQ_PREFIX(path, path_len, "showall")) { - int query_len = 0; - const char *query = h->url_get()->query_get(&query_len); - if (query && query_len && strstr(query, "json")) { - s->output_json = true; - } - Dbg(dbg_ctl_hostdb, "dumping all hostdb records"); - SET_CONTINUATION_HANDLER(s, &ShowHostDB::showAll); - } - this_ethread()->schedule_imm(s); - return &s->action; -} - static constexpr int HOSTDB_TEST_MAX_OUTSTANDING = 20; static constexpr int HOSTDB_TEST_LENGTH = 200; diff --git a/src/iocore/net/CMakeLists.txt b/src/iocore/net/CMakeLists.txt index e3d1698c0f2..ba3b47a00a0 100644 --- a/src/iocore/net/CMakeLists.txt +++ b/src/iocore/net/CMakeLists.txt @@ -66,7 +66,6 @@ add_library( UnixConnection.cc UnixNet.cc UnixNetAccept.cc - UnixNetPages.cc UnixNetProcessor.cc UnixNetVConnection.cc UnixUDPConnection.cc diff --git a/src/iocore/net/Makefile.am b/src/iocore/net/Makefile.am index 6318c46b384..16377759521 100644 --- a/src/iocore/net/Makefile.am +++ b/src/iocore/net/Makefile.am @@ -244,7 +244,6 @@ libinknet_a_SOURCES = \ UnixConnection.cc \ UnixNet.cc \ UnixNetAccept.cc \ - UnixNetPages.cc \ UnixNetProcessor.cc \ UnixNetVConnection.cc \ UnixUDPConnection.cc \ diff --git a/src/iocore/net/UnixNetPages.cc b/src/iocore/net/UnixNetPages.cc deleted file mode 100644 index 7c006e7fdae..00000000000 --- a/src/iocore/net/UnixNetPages.cc +++ /dev/null @@ -1,247 +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 "tscore/ink_platform.h" -#include "P_Net.h" -#include "proxy/Show.h" -#include "iocore/eventsystem/Tasks.h" - -struct ShowNet; -using ShowNetEventHandler = int (ShowNet::*)(int, Event *); -struct ShowNet : public ShowCont { - int ithread; - IpEndpoint addr; - - int - showMain(int event, Event *e) - { - CHECK_SHOW(begin("Net")); - CHECK_SHOW(show("

Show Connections

\n" - //"

Show Net Threads

\n" - "
\n" - "Show Connections to/from IP (e.g. 127.0.0.1):
\n" - "\n" - "
\n" - "
\n" - "Show Connections to/from Port (e.g. 80):
\n" - "\n" - "
\n")); - return complete(event, e); - } - - int - showConnectionsOnThread(int event, Event *e) - { - EThread *ethread = e->ethread; - NetHandler *nh = get_NetHandler(ethread); - MUTEX_TRY_LOCK(lock, nh->mutex, ethread); - if (!lock.is_locked()) { - ethread->schedule_in(this, HRTIME_MSECONDS(net_retry_delay)); - return EVENT_DONE; - } - - ink_hrtime now = ink_get_hrtime(); - forl_LL(NetEvent, ne, nh->open_list) - { - auto vc = dynamic_cast(ne); - // uint16_t port = ats_ip_port_host_order(&addr.sa); - if (vc == nullptr || (ats_is_ip(&addr) && !ats_ip_addr_port_eq(&addr.sa, vc->get_remote_addr()))) { - continue; - } - // if (port && port != ats_ip_port_host_order(&vc->server_addr.sa) && port != vc->accept_port) - // continue; - char ipbuf[INET6_ADDRSTRLEN]; - ats_ip_ntop(vc->get_remote_addr(), ipbuf, sizeof(ipbuf)); - char opt_ipbuf[INET6_ADDRSTRLEN]; - char interbuf[80]; - snprintf(interbuf, sizeof(interbuf), "[%s] %s:%d", vc->options.toString(vc->options.addr_binding), - vc->options.local_ip.toString(opt_ipbuf, sizeof(opt_ipbuf)), vc->options.local_port); - CHECK_SHOW(show("" - //"%d" - "%d" // ID - "%s" // ipbuf - "%d" // port - "%d" // fd - "%s" // interbuf - // "%d" // accept port - "%d secs ago" // start time - "%d" // thread id - "%d" // read enabled - "%" PRId64 "" // read NBytes - "%" PRId64 "" // read NDone - "%d" // write enabled - "%" PRId64 "" // write nbytes - "%" PRId64 "" // write ndone - "%d secs" // Inactivity timeout at - "%d secs" // Activity timeout at - "%d" // shutdown - "-%s" // comments - "\n", - vc->id, ipbuf, ats_ip_port_host_order(vc->get_remote_addr()), vc->con.fd, interbuf, - // vc->accept_port, - (int)((now - vc->submit_time) / HRTIME_SECOND), ethread->id, vc->read.enabled, vc->read.vio.nbytes, - vc->read.vio.ndone, vc->write.enabled, vc->write.vio.nbytes, vc->write.vio.ndone, - (int)(vc->inactivity_timeout_in / HRTIME_SECOND), (int)(vc->active_timeout_in / HRTIME_SECOND), - vc->f.shutdown, vc->closed ? "closed " : "")); - } - ithread++; - if (ithread < eventProcessor.thread_group[ET_NET]._count) { - eventProcessor.thread_group[ET_NET]._thread[ithread]->schedule_imm(this); - } else { - CHECK_SHOW(show("\n")); - return complete(event, e); - } - return EVENT_CONT; - } - - int - showConnections(int event, Event *e) - { - CHECK_SHOW(begin("Net Connections")); - CHECK_SHOW(show("

Connections

\n" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "\n")); - SET_HANDLER(&ShowNet::showConnectionsOnThread); - eventProcessor.thread_group[ET_NET]._thread[0]->schedule_imm(this); // This can not use ET_TASK. - return EVENT_CONT; - } - - int - showSingleThread(int event, Event *e) - { - EThread *ethread = e->ethread; - NetHandler *nh = get_NetHandler(ethread); - PollDescriptor *pollDescriptor = get_PollDescriptor(ethread); - MUTEX_TRY_LOCK(lock, nh->mutex, ethread); - if (!lock.is_locked()) { - ethread->schedule_in(this, HRTIME_MSECONDS(net_retry_delay)); - return EVENT_DONE; - } - - CHECK_SHOW(show("

Thread: %d

\n", ithread)); - CHECK_SHOW(show("
IDIPPortFDInterfaceAccept PortTime StartedThreadRead EnabledRead NBytesRead NDoneWrite EnabledWrite NBytesWrite NDoneInactive TimeoutActive TimeoutShutdownComments
\n")); - int connections = 0; - forl_LL(NetEvent, ne, nh->open_list) - { - if (dynamic_cast(ne) != nullptr) { - ++connections; - } - } - CHECK_SHOW(show("\n", "Connections", connections)); - // CHECK_SHOW(show("\n", "Last Poll Size", pollDescriptor->nfds)); - CHECK_SHOW(show("\n", "Last Poll Ready", pollDescriptor->result)); - CHECK_SHOW(show("
%s%d
%s%d
%s%d
\n")); - CHECK_SHOW(show("\n")); - CHECK_SHOW(show("\n")); - CHECK_SHOW(show("
#Read PriorityRead BucketWrite PriorityWrite Bucket
\n")); - ithread++; - if (ithread < eventProcessor.thread_group[ET_NET]._count) { - eventProcessor.thread_group[ET_NET]._thread[ithread]->schedule_imm(this); - } else { - return complete(event, e); - } - return EVENT_CONT; - } - - int - showThreads(int event, Event *e) - { - CHECK_SHOW(begin("Net Threads")); - SET_HANDLER(&ShowNet::showSingleThread); - eventProcessor.thread_group[ET_NET]._thread[0]->schedule_imm(this); // This can not use ET_TASK - return EVENT_CONT; - } - int - showHostnames(int event, Event *e) - { - CHECK_SHOW(begin("Net Connections to/from Host")); - return complete(event, e); - } - - ShowNet(Continuation *c, HTTPHdr *h) : ShowCont(c, h), ithread(0) - { - memset(&addr, 0, sizeof(addr)); - SET_HANDLER(&ShowNet::showMain); - } -}; - -#undef STREQ_PREFIX -#define STREQ_PREFIX(_x, _n, _s) (!ptr_len_ncasecmp(_x, _n, _s, sizeof(_s) - 1)) -Action * -register_ShowNet(Continuation *c, HTTPHdr *h) -{ - ShowNet *s = new ShowNet(c, h); - int path_len; - const char *path = h->url_get()->path_get(&path_len); - - SET_CONTINUATION_HANDLER(s, &ShowNet::showMain); - if (STREQ_PREFIX(path, path_len, "connections")) { - SET_CONTINUATION_HANDLER(s, &ShowNet::showConnections); - } else if (STREQ_PREFIX(path, path_len, "threads")) { - SET_CONTINUATION_HANDLER(s, &ShowNet::showThreads); - } else if (STREQ_PREFIX(path, path_len, "ips")) { - int query_len; - const char *query = h->url_get()->query_get(&query_len); - s->sarg = ats_strndup(query, query_len); - char *gn = nullptr; - if (s->sarg) { - gn = static_cast(memchr(s->sarg, '=', strlen(s->sarg))); - } - if (gn) { - ats_ip_pton(gn + 1, &s->addr); - } - SET_CONTINUATION_HANDLER(s, &ShowNet::showConnections); - } else if (STREQ_PREFIX(path, path_len, "ports")) { - int query_len; - const char *query = h->url_get()->query_get(&query_len); - s->sarg = ats_strndup(query, query_len); - char *gn = nullptr; - if (s->sarg) { - gn = static_cast(memchr(s->sarg, '=', strlen(s->sarg))); - } - if (gn) { - ats_ip_port_cast(&s->addr.sa) = htons(atoi(gn + 1)); - } - SET_CONTINUATION_HANDLER(s, &ShowNet::showConnections); - } - eventProcessor.schedule_imm(s, ET_TASK); - return &s->action; -} diff --git a/src/iocore/net/UnixNetProcessor.cc b/src/iocore/net/UnixNetProcessor.cc index f722f5ec6ea..e3d6c11de2e 100644 --- a/src/iocore/net/UnixNetProcessor.cc +++ b/src/iocore/net/UnixNetProcessor.cc @@ -28,7 +28,6 @@ #include "P_SSLNextProtocolAccept.h" // For Stat Pages -#include "proxy/StatPages.h" // naVecMutext protects access to naVec. Ptr naVecMutex; @@ -269,12 +268,6 @@ UnixNetProcessor::init() RecData d; d.rec_int = 0; change_net_connections_throttle(nullptr, RECD_INT, d, nullptr); - - /* - * Stat pages - */ - extern Action *register_ShowNet(Continuation * c, HTTPHdr * h); - statPagesManager.register_http("net", register_ShowNet); } void diff --git a/src/proxy/CMakeLists.txt b/src/proxy/CMakeLists.txt index c82bb866de5..8394581014b 100644 --- a/src/proxy/CMakeLists.txt +++ b/src/proxy/CMakeLists.txt @@ -34,7 +34,6 @@ add_library( ProxySession.cc ProxyTransaction.cc ReverseProxy.cc - StatPages.cc Transform.cc ) add_library(ts::proxy ALIAS proxy) diff --git a/src/proxy/Makefile.am b/src/proxy/Makefile.am index d7b919e4905..759d8da614a 100644 --- a/src/proxy/Makefile.am +++ b/src/proxy/Makefile.am @@ -42,9 +42,6 @@ AM_CPPFLAGS += \ @YAMLCPP_INCLUDES@ \ $(TS_INCLUDES) -noinst_HEADERS = \ - Show.h - libproxy_a_SOURCES = \ $(PRIVATE_SOURCES_) \ CacheControl.cc \ @@ -79,8 +76,6 @@ libproxy_a_SOURCES = \ ProxyTransaction.h \ ReverseProxy.cc \ ReverseProxy.h \ - StatPages.cc \ - StatPages.h \ Transform.cc \ Transform.h diff --git a/src/proxy/StatPages.cc b/src/proxy/StatPages.cc deleted file mode 100644 index 9889289fa92..00000000000 --- a/src/proxy/StatPages.cc +++ /dev/null @@ -1,287 +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. - */ - -/**************************************************************************** - - StatPages.cc - - - ****************************************************************************/ - -#include "tscore/ink_config.h" -#include "iocore/eventsystem/ConfigProcessor.h" -#include "proxy/StatPages.h" -#include "proxy/hdrs/HdrUtils.h" -#include "tscore/MatcherUtils.h" - -#define MAX_STAT_PAGES 32 - -// Globals -StatPagesManager statPagesManager; - -static struct { - char *module; - StatPagesFunc func; -} stat_pages[MAX_STAT_PAGES]; - -static int n_stat_pages; - -void -StatPagesManager::init() -{ - ink_mutex_init(&stat_pages_mutex); - REC_EstablishStaticConfigInt32(m_enabled, "proxy.config.http_ui_enabled"); -} - -void -StatPagesManager::register_http(const char *module, StatPagesFunc func) -{ - ink_mutex_acquire(&stat_pages_mutex); - ink_release_assert(n_stat_pages < MAX_STAT_PAGES); - - stat_pages[n_stat_pages].module = static_cast(ats_malloc(strlen(module) + 3)); - snprintf(stat_pages[n_stat_pages].module, strlen(module) + 3, "{%s}", module); - stat_pages[n_stat_pages++].func = func; - ink_mutex_release(&stat_pages_mutex); -} - -Action * -StatPagesManager::handle_http(Continuation *cont, HTTPHdr *header) -{ - URL *url = header->url_get(); - - if (((m_enabled == 1 || m_enabled == 3) && is_cache_inspector_page(url)) || - ((m_enabled == 2 || m_enabled == 3) && is_stat_page(url) && !is_cache_inspector_page(url))) { - int host_len; - char host[MAXDNAME + 1]; - const char *h; - int i; - - h = url->host_get(&host_len); - if (host_len > MAXDNAME) { - host_len = MAXDNAME; - } - memcpy(host, h, host_len); - host[host_len] = '\0'; - host_len = unescapifyStr(host); - - for (i = 0; i < n_stat_pages; i++) { - if (strlen(host) == strlen(stat_pages[i].module) && strncmp(host, stat_pages[i].module, host_len) == 0) { - return stat_pages[i].func(cont, header); - } - } - } - - cont->handleEvent(STAT_PAGE_FAILURE, nullptr); - return ACTION_RESULT_DONE; -} - -bool -StatPagesManager::is_stat_page(URL *url) -{ - // This gets called from the state machine, so we should optimize here and not in caller. - if (m_enabled <= 0) { - return false; - } - - int length; - const char *h = url->host_get(&length); - char host[MAXDNAME + 1]; - - if (h == nullptr || length < 2 || length > MAXDNAME) { - return false; - } - - memcpy(host, h, length); - host[length] = '\0'; - length = unescapifyStr(host); - - if ((host[0] == '{') && (host[length - 1] == '}')) { - return true; - } - - return false; -} - -bool -StatPagesManager::is_cache_inspector_page(URL *url) -{ - int length; - const char *h = url->host_get(&length); - char host[MAXDNAME + 1]; - - if (h == nullptr || length < 2 || length > MAXDNAME) { - return false; - } - - memcpy(host, h, length); - host[length] = '\0'; - length = unescapifyStr(host); - - if (strncmp(host, "{cache}", length) == 0) { - return true; - } else { - return false; - } -} - -void -BaseStatPagesHandler::resp_clear() -{ - ats_free(response); - response = nullptr; - response_size = 0; - response_length = 0; -} - -void -BaseStatPagesHandler::resp_add(const char *fmt, ...) -{ - va_list args; - char buf[16384]; - int length; - int size; - - va_start(args, fmt); - length = vsnprintf(buf, 16384, fmt, args); - va_end(args); - - size = response_size; - if (size == 0) { - size = 1024; - } - while ((response_length + length + 1) > size) { - size *= 2; - } - - if (size != response_size) { - if (!response) { - response = static_cast(ats_malloc(size)); - } else { - response = static_cast(ats_realloc(response, size)); - } - response_size = size; - } - - memcpy(&response[response_length], buf, length + 1); - response_length += length; -} - -void -BaseStatPagesHandler::resp_add_sep() -{ - resp_add("
\n"); -} - -void -BaseStatPagesHandler::resp_begin(const char *title) -{ - resp_clear(); - resp_add("\n" - "%s\n" - "\n", - title); -} - -void -BaseStatPagesHandler::resp_end() -{ - resp_add("\n" - "\n"); -} - -void -BaseStatPagesHandler::resp_begin_numbered() -{ - resp_add("
    \n"); -} - -void -BaseStatPagesHandler::resp_end_numbered() -{ - resp_add("
\n"); -} - -void -BaseStatPagesHandler::resp_begin_unnumbered() -{ - resp_add("
    \n"); -} - -void -BaseStatPagesHandler::resp_end_unnumbered() -{ - resp_add("
\n"); -} - -void -BaseStatPagesHandler::resp_begin_item() -{ - resp_add("
  • \n"); -} - -void -BaseStatPagesHandler::resp_end_item() -{ - resp_add("
  • \n"); -} - -void -BaseStatPagesHandler::resp_begin_table(int border, int columns, int percent) -{ - resp_add("\n", border, columns, percent); -} - -void -BaseStatPagesHandler::resp_end_table() -{ - resp_add("
    \n"); -} - -void -BaseStatPagesHandler::resp_begin_row() -{ - resp_add("\n"); -} - -void -BaseStatPagesHandler::resp_end_row() -{ - resp_add("\n"); -} - -void -BaseStatPagesHandler::resp_begin_column(int percent, const char *align) -{ - if (percent == -1) { - resp_add("\n", align ? "align=" : "", align ? align : ""); - } else { - resp_add("\n", percent, align ? "align=" : "", align ? align : ""); - } -} - -void -BaseStatPagesHandler::resp_end_column() -{ - resp_add("\n"); -} diff --git a/src/proxy/http/CMakeLists.txt b/src/proxy/http/CMakeLists.txt index e4a596bd9ef..cb63170c444 100644 --- a/src/proxy/http/CMakeLists.txt +++ b/src/proxy/http/CMakeLists.txt @@ -25,7 +25,6 @@ add_library( Http1ServerTransaction.cc HttpConfig.cc HttpDebugNames.cc - HttpPages.cc HttpProxyServerMain.cc HttpSM.cc Http1ServerSession.cc diff --git a/src/proxy/http/HttpConfig.cc b/src/proxy/http/HttpConfig.cc index 153a5ccf373..f3cd96fbda4 100644 --- a/src/proxy/http/HttpConfig.cc +++ b/src/proxy/http/HttpConfig.cc @@ -930,9 +930,6 @@ HttpConfig::startup() HttpEstablishStaticConfigLongLong(c.oride.plugin_vc_default_buffer_water_mark, "proxy.config.plugin.vc.default_buffer_water_mark"); - // Stat Page Info - HttpEstablishStaticConfigByte(c.enable_http_info, "proxy.config.http.enable_http_info"); - HttpEstablishStaticConfigLongLong(c.max_post_size, "proxy.config.http.max_post_size"); HttpEstablishStaticConfigLongLong(c.max_payload_iobuf_index, "proxy.config.payload.io.max_buffer_index"); HttpEstablishStaticConfigLongLong(c.max_msg_iobuf_index, "proxy.config.msg.io.max_buffer_index"); @@ -1208,7 +1205,6 @@ HttpConfig::reconfigure() params->oride.doc_in_cache_skip_dns = INT_TO_BOOL(m_master.oride.doc_in_cache_skip_dns); params->oride.default_buffer_size_index = m_master.oride.default_buffer_size_index; params->oride.default_buffer_water_mark = m_master.oride.default_buffer_water_mark; - params->enable_http_info = INT_TO_BOOL(m_master.enable_http_info); params->oride.body_factory_template_base = ats_strdup(m_master.oride.body_factory_template_base); params->oride.body_factory_template_base_len = params->oride.body_factory_template_base ? strlen(params->oride.body_factory_template_base) : 0; diff --git a/src/proxy/http/HttpDebugNames.cc b/src/proxy/http/HttpDebugNames.cc index ea349c000b9..db4413282cd 100644 --- a/src/proxy/http/HttpDebugNames.cc +++ b/src/proxy/http/HttpDebugNames.cc @@ -24,7 +24,6 @@ #include "iocore/dns/DNSProcessor.h" #include "proxy/http/HttpDebugNames.h" #include "../../iocore/eventsystem/P_EventSystem.h" -#include "proxy/StatPages.h" #include "proxy/http/HttpTunnel.h" #include "proxy/Transform.h" #include "proxy/http/HttpSM.h" @@ -201,12 +200,6 @@ HttpDebugNames::get_event_name(int event) return "CACHE_EVENT_UPDATE"; case CACHE_EVENT_UPDATE_FAILED: return "CACHE_EVENT_UPDATE_FAILED"; - - case STAT_PAGE_SUCCESS: - return "STAT_PAGE_SUCCESS"; - case STAT_PAGE_FAILURE: - return "STAT_PAGE_FAILURE"; - case TRANSFORM_READ_READY: static_assert(static_cast(TRANSFORM_READ_READY) == static_cast(TS_EVENT_SSL_SESSION_GET)); return "TRANSFORM_READ_READY/TS_EVENT_SSL_SESSION_GET"; @@ -430,9 +423,6 @@ HttpDebugNames::get_action_name(HttpTransact::StateMachineAction_t e) case HttpTransact::SM_ACTION_INTERNAL_CACHE_UPDATE_HEADERS: return ("SM_ACTION_INTERNAL_CACHE_UPDATE_HEADERS"); - case HttpTransact::SM_ACTION_INTERNAL_REQUEST: - return ("SM_ACTION_INTERNAL_REQUEST"); - case HttpTransact::SM_ACTION_SEND_ERROR_CACHE_NOOP: return ("SM_ACTION_SEND_ERROR_CACHE_NOOP"); diff --git a/src/proxy/http/HttpPages.cc b/src/proxy/http/HttpPages.cc deleted file mode 100644 index 3e343ec52c8..00000000000 --- a/src/proxy/http/HttpPages.cc +++ /dev/null @@ -1,459 +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. - */ - -/**************************************************************************** - - HttpPages.cc - - Description: - Data structures and stat page generators for http info - - - ****************************************************************************/ -#include "proxy/http/HttpPages.h" -#include "proxy/http/HttpSM.h" -#include "proxy/http/HttpDebugNames.h" - -HttpSMListBucket HttpSMList[HTTP_LIST_BUCKETS]; - -HttpPagesHandler::HttpPagesHandler(Continuation *cont, HTTPHdr *header) - : BaseStatPagesHandler(new_ProxyMutex()), request(nullptr), list_bucket(0), state(HP_INIT), sm_id(0) -{ - action = cont; - - URL *url; - int length; - - url = header->url_get(); - request = const_cast(url->path_get(&length)); - request = arena.str_store(request, length); - - if (strncmp(request, "sm_details", sizeof("sm_details")) == 0) { - arena.str_free(request); - request = const_cast(url->query_get(&length)); - request = arena.str_store(request, length); - SET_HANDLER(&HttpPagesHandler::handle_smdetails); - - } else { - SET_HANDLER(&HttpPagesHandler::handle_smlist); - } -} - -HttpPagesHandler::~HttpPagesHandler() {} - -int64_t -HttpPagesHandler::extract_id(const char *query) -{ - char *p; - int64_t id; - - p = const_cast(strstr(query, "id=")); - if (!p) { - return -1; - } - p += sizeof("id=") - 1; - - id = ink_atoi64(p); - - // Check to see if we found the id - if (id == 0) { - if (*p == '0' && *(p + 1) == '\0') { - return 0; - } else { - return -1; - } - } else { - return id; - } -} - -void -HttpPagesHandler::dump_hdr(HTTPHdr *hdr, const char *desc) -{ - if (hdr->valid()) { - resp_add("

    %s

    \n
    \n", desc);
    -    char b[4096];
    -    int used, tmp, offset;
    -    int done;
    -    offset = 0;
    -    do {
    -      used     = 0;
    -      tmp      = offset;
    -      done     = hdr->print(b, 4095, &used, &tmp);
    -      offset  += used;
    -      b[used]  = '\0';
    -      resp_add(b);
    -    } while (!done);
    -    resp_add("
    \n"); - } -} - -void -HttpPagesHandler::dump_tunnel_info(HttpSM *sm) -{ - HttpTunnel *t = sm->get_tunnel(); - - resp_add("

    Tunneling Info

    "); - - resp_add("

    Producers

    "); - resp_begin_table(1, 4, 60); - for (auto &producer : t->producers) { - if (producer.vc != nullptr) { - resp_begin_row(); - - // Col 1 - name - resp_begin_column(); - resp_add(producer.name); - resp_end_column(); - - // Col 2 - alive - resp_begin_column(); - resp_add("%d", producer.alive); - resp_end_column(); - - // Col 3 - ndone - resp_begin_column(); - if (producer.alive && producer.read_vio) { - resp_add("%" PRId64, producer.read_vio->ndone); - } else { - resp_add("%" PRId64, producer.bytes_read); - } - resp_end_column(); - - // Col 4 - nbytes - resp_begin_column(); - if (producer.alive && producer.read_vio) { - resp_add("%" PRId64, producer.read_vio->nbytes); - } else { - resp_add("-"); - } - resp_end_column(); - - resp_end_row(); - } - } - resp_end_table(); - - resp_add("

    Consumers

    "); - resp_begin_table(1, 5, 60); - for (auto &consumer : t->consumers) { - if (consumer.vc != nullptr) { - resp_begin_row(); - - // Col 1 - name - resp_begin_column(); - resp_add(consumer.name); - resp_end_column(); - - // Col 2 - alive - resp_begin_column(); - resp_add("%d", consumer.alive); - resp_end_column(); - - // Col 3 - ndone - resp_begin_column(); - if (consumer.alive && consumer.write_vio) { - resp_add("%" PRId64, consumer.write_vio->ndone); - } else { - resp_add("%" PRId64, consumer.bytes_written); - } - resp_end_column(); - - // Col 4 - nbytes - resp_begin_column(); - if (consumer.alive && consumer.write_vio) { - resp_add("%" PRId64, consumer.write_vio->nbytes); - } else { - resp_add("-"); - } - resp_end_column(); - - // Col 5 - read avail - resp_begin_column(); - if (consumer.alive && consumer.buffer_reader) { - resp_add("%" PRId64, consumer.buffer_reader->read_avail()); - } else { - resp_add("-"); - } - resp_end_column(); - - resp_end_row(); - } - } - resp_end_table(); -} - -void -HttpPagesHandler::dump_history(HttpSM *sm) -{ - resp_add("

    History

    "); - resp_begin_table(1, 3, 60); - - // Figure out how big the history is and look - // for wrap around - for (unsigned int i = 0; i < sm->history.size(); i++) { - char buf[256]; - resp_begin_row(); - - resp_begin_column(); - resp_add("%s", sm->history[i].location.str(buf, sizeof(buf))); - resp_end_column(); - - resp_begin_column(); - resp_add("%u", static_cast(sm->history[i].event)); - resp_end_column(); - - resp_begin_column(); - resp_add("%d", static_cast(sm->history[i].reentrancy)); - resp_end_column(); - - resp_end_row(); - } - - resp_end_table(); -} - -int -HttpPagesHandler::dump_sm(HttpSM *sm) -{ - // Dump the current state - const char *sm_state = HttpDebugNames::get_action_name(sm->t_state.next_action); - - resp_begin_item(); - resp_add("Current State: %s", sm_state); - resp_end_item(); - - dump_hdr(&sm->t_state.hdr_info.client_request, "Client Request"); - dump_hdr(&sm->t_state.hdr_info.server_request, "Server Request"); - dump_hdr(&sm->t_state.hdr_info.server_response, "Server Response"); - dump_hdr(&sm->t_state.hdr_info.client_response, "Client Response"); - - dump_tunnel_info(sm); - dump_history(sm); - - return EVENT_DONE; -} - -int -HttpPagesHandler::handle_smdetails(int event, void * /* data ATS_UNUSED */) -{ - EThread *ethread = this_ethread(); - HttpSM *sm = nullptr; - - switch (event) { - case EVENT_NONE: - case EVENT_INTERVAL: - case EVENT_IMMEDIATE: - break; - default: - ink_assert(0); - break; - } - - // Do initial setup if necessary - if (state == HP_INIT) { - state = HP_RUN; - - // Get our SM id - sm_id = extract_id(request); - - if (sm_id < 0) { - resp_begin("Http Pages Error"); - resp_add("Unable to extract id\n"); - resp_end(); - return handle_callback(EVENT_NONE, nullptr); - } - - resp_begin("Http:SM Details"); - resp_begin_item(); - resp_add("Details for SM id %" PRId64 "", sm_id); - resp_end_item(); - } - - for (; list_bucket < HTTP_LIST_BUCKETS; list_bucket++) { - MUTEX_TRY_LOCK(lock, HttpSMList[list_bucket].mutex, ethread); - - if (!lock.is_locked()) { - eventProcessor.schedule_in(this, HTTP_LIST_RETRY, ET_CALL); - return EVENT_DONE; - } - - sm = HttpSMList[list_bucket].sm_list.head; - - while (sm != nullptr) { - if (sm->sm_id == sm_id) { - // In this block we try to get the lock of the - // state machine - { - MUTEX_TRY_LOCK(sm_lock, sm->mutex, ethread); - if (sm_lock.is_locked()) { - dump_sm(sm); - resp_end(); - return handle_callback(EVENT_NONE, nullptr); - } else { - // We missed the lock so retry - eventProcessor.schedule_in(this, HTTP_LIST_RETRY, ET_CALL); - return EVENT_DONE; - } - } - } - - sm = sm->debug_link.next; - } - } - - // If we got here, we did not find our state machine - resp_add("

    Id %" PRId64 " not found

    ", sm_id); - resp_end(); - return handle_callback(EVENT_NONE, nullptr); -} - -int -HttpPagesHandler::handle_smlist(int event, void * /* data ATS_UNUSED */) -{ - EThread *ethread = this_ethread(); - HttpSM *sm; - - switch (event) { - case EVENT_NONE: - case EVENT_INTERVAL: - case EVENT_IMMEDIATE: - break; - default: - ink_assert(0); - break; - } - - if (state == HP_INIT) { - resp_begin("Http:SM List"); - state = HP_RUN; - } - - for (; list_bucket < HTTP_LIST_BUCKETS; list_bucket++) { - MUTEX_TRY_LOCK(lock, HttpSMList[list_bucket].mutex, ethread); - - if (!lock.is_locked()) { - eventProcessor.schedule_in(this, HTTP_LIST_RETRY, ET_CALL); - return EVENT_DONE; - } - - sm = HttpSMList[list_bucket].sm_list.head; - - while (sm != nullptr) { - char *url = nullptr; - const char *method = nullptr; - int method_len; - const char *sm_state = nullptr; - - // In this block we try to get the lock of the - // state machine - { - MUTEX_TRY_LOCK(sm_lock, sm->mutex, ethread); - if (sm_lock.is_locked()) { - if (sm->t_state.hdr_info.client_request.valid()) { - sm_state = HttpDebugNames::get_action_name(sm->t_state.next_action); - - method = sm->t_state.hdr_info.client_request.method_get(&method_len); - method = arena.str_store(method, method_len); - URL *u = sm->t_state.hdr_info.client_request.url_get(); - if (u->valid()) { - url = u->string_get(&arena); - } - } - - if (url == nullptr) { - url = arena.str_store("-", 1); - sm_state = "READ_REQUEST"; - } - } else { - url = arena.str_store("-", 1); - sm_state = "LOCKED"; - } - } - - resp_begin_item(); - resp_add("id: %" PRId64 " | %s %s | %s\n", sm->sm_id, sm->sm_id, - method ? method : "", url, sm_state ? sm_state : ""); - resp_end_item(); - arena.str_free(url); - - sm = sm->debug_link.next; - } - } - - resp_end(); - handle_callback(EVENT_NONE, nullptr); - - return EVENT_DONE; -} - -int -HttpPagesHandler::handle_callback(int /* event ATS_UNUSED */, void * /* edata ATS_UNUSED */) -{ - MUTEX_TRY_LOCK(trylock, action.mutex, this_ethread()); - if (!trylock.is_locked()) { - SET_HANDLER(&HttpPagesHandler::handle_callback); - eventProcessor.schedule_in(this, HTTP_LIST_RETRY, ET_CALL); - return EVENT_DONE; - } - - if (!action.cancelled) { - if (response) { - StatPageData data; - - data.data = response; - data.type = ats_strdup("text/html"); - data.length = response_length; - response = nullptr; - - action.continuation->handleEvent(STAT_PAGE_SUCCESS, &data); - } else { - action.continuation->handleEvent(STAT_PAGE_FAILURE, nullptr); - } - } - - delete this; - return EVENT_DONE; -} - -static Action * -http_pages_callback(Continuation *cont, HTTPHdr *header) -{ - HttpPagesHandler *handler; - - handler = new HttpPagesHandler(cont, header); - eventProcessor.schedule_imm(handler, ET_CALL); - - return &handler->action; -} - -void -http_pages_init() -{ - statPagesManager.register_http("http", http_pages_callback); - - // Create the mutexes for http list protection - for (auto &i : HttpSMList) { - i.mutex = new_ProxyMutex(); - } -} diff --git a/src/proxy/http/HttpProxyServerMain.cc b/src/proxy/http/HttpProxyServerMain.cc index 9994b71b108..542d5767dca 100644 --- a/src/proxy/http/HttpProxyServerMain.cc +++ b/src/proxy/http/HttpProxyServerMain.cc @@ -27,13 +27,10 @@ #include "proxy/http/HttpConfig.h" #include "proxy/http/HttpSessionAccept.h" #include "proxy/ReverseProxy.h" -#include "proxy/Show.h" #include "proxy/http/HttpSessionManager.h" -#include "proxy/http/remap/RemapHitCount.h" #ifdef USE_HTTP_DEBUG_LISTS #include "proxy/http/Http1ClientSession.h" #endif -#include "proxy/http/HttpPages.h" #include "proxy/http/HttpTunnel.h" #include "tscore/Tokenizer.h" #include "iocore/net/ConnectionTracker.h" @@ -67,24 +64,6 @@ std::mutex etUdpMutex; std::condition_variable etUdpCheck; bool et_udp_threads_ready = false; -struct ShowConnectionCount : public ShowCont { - ShowConnectionCount(Continuation *c, HTTPHdr *h) : ShowCont(c, h) { SET_HANDLER(&ShowConnectionCount::showHandler); } - int - showHandler(int event, Event *e) - { - CHECK_SHOW(show(ConnectionTracker::outbound_to_json_string().c_str())); - return completeJson(event, e); - } -}; - -Action * -register_ShowConnectionCount(Continuation *c, HTTPHdr *h) -{ - ShowConnectionCount *s = new ShowConnectionCount(c, h); - this_ethread()->schedule_imm(s); - return &s->action; -} - // File / process scope initializations static bool HTTP_SERVER_INITIALIZED __attribute__((unused)) = []() -> bool { swoc::bwf::Global_Names.assign("ts-thread", [](swoc::BufferWriter &w, swoc::bwf::Spec const &spec) -> swoc::BufferWriter & { @@ -285,7 +264,6 @@ init_accept_HttpProxyServer(int n_accept_threads) HttpProxyPort::Group &proxy_ports = HttpProxyPort::global(); init_reverse_proxy(); - http_pages_init(); #ifdef USE_HTTP_DEBUG_LISTS ink_mutex_init(&debug_sm_list_mutex); @@ -381,10 +359,6 @@ start_HttpProxyServer() // NULL. It would be useful to be able to detect errors and spew them here though. } - // Set up stat page for http connection count - statPagesManager.register_http("connection_count", register_ShowConnectionCount); - statPagesManager.register_http("remap_hits", register_ShowRemapHitCount); - // Alert plugins that connections will be accepted. APIHook *hook = g_lifecycle_hooks->get(TS_LIFECYCLE_PORTS_READY_HOOK); while (hook) { diff --git a/src/proxy/http/HttpSM.cc b/src/proxy/http/HttpSM.cc index 5b39ebf3f0c..f74c017e89d 100644 --- a/src/proxy/http/HttpSM.cc +++ b/src/proxy/http/HttpSM.cc @@ -38,7 +38,6 @@ #include "../../iocore/cache/P_Cache.h" #include "../../iocore/net/P_Net.h" #include "proxy/http/PreWarmConfig.h" -#include "proxy/StatPages.h" #include "proxy/logging/Log.h" #include "proxy/logging/LogAccess.h" #include "proxy/PluginVC.h" @@ -53,7 +52,6 @@ #include "iocore/net/TLSSNISupport.h" #include "iocore/net/TLSSessionResumptionSupport.h" #include "iocore/net/TLSTunnelSupport.h" -#include "proxy/http/HttpPages.h" #include "proxy/IPAllow.h" #include "iocore/net/ProxyProtocol.h" @@ -314,24 +312,6 @@ HttpSM::do_api_callout() int HttpSM::state_add_to_list(int event, void * /* data ATS_UNUSED */) { - // The list if for stat pages and general debugging - // The config variable exists mostly to allow us to - // measure an performance drop during benchmark runs - if (t_state.http_config_param->enable_http_info) { - STATE_ENTER(&HttpSM::state_add_to_list, event); - ink_assert(event == EVENT_NONE || event == EVENT_INTERVAL); - - int bucket = (static_cast(sm_id) % HTTP_LIST_BUCKETS); - - MUTEX_TRY_LOCK(lock, HttpSMList[bucket].mutex, mutex->thread_holding); - // the client_vc`s timeout events can be triggered, so we should not - // reschedule the http_sm when the lock is not acquired. - // FIXME: the sm_list may miss some http_sms when the lock contention - if (lock.is_locked()) { - HttpSMList[bucket].sm_list.push(this); - } - } - t_state.api_next_action = HttpTransact::SM_ACTION_API_SM_START; if (do_api_callout() < 0) { // Didn't get the hook continuation lock. Clear the read and wait for next event @@ -349,27 +329,6 @@ HttpSM::state_add_to_list(int event, void * /* data ATS_UNUSED */) int HttpSM::state_remove_from_list(int event, void * /* data ATS_UNUSED */) { - // The config parameters are guaranteed not change - // across the life of a transaction so it safe to - // check the config here and use it determine - // whether we need to strip ourselves off of the - // state page list - if (t_state.http_config_param->enable_http_info) { - STATE_ENTER(&HttpSM::state_remove_from_list, event); - ink_assert(event == EVENT_NONE || event == EVENT_INTERVAL); - - int bucket = (static_cast(sm_id) % HTTP_LIST_BUCKETS); - - MUTEX_TRY_LOCK(lock, HttpSMList[bucket].mutex, mutex->thread_holding); - if (!lock.is_locked()) { - HTTP_SM_SET_DEFAULT_HANDLER(&HttpSM::state_remove_from_list); - mutex->thread_holding->schedule_in(this, HTTP_LIST_RETRY); - return EVENT_DONE; - } - - HttpSMList[bucket].sm_list.remove(this); - } - // We're now ready to finish off the state machine terminate_sm = true; kill_this_async_done = true; @@ -2399,48 +2358,6 @@ HttpSM::state_mark_os_down(int event, void *data) return state_hostdb_lookup(event, data); } -////////////////////////////////////////////////////////////////////////// -// -// HttpSM::state_handle_stat_page() -// -////////////////////////////////////////////////////////////////////////// -int -HttpSM::state_handle_stat_page(int event, void *data) -{ - STATE_ENTER(&HttpSM::state_handle_stat_page, event); - switch (event) { - case STAT_PAGE_SUCCESS: - pending_action = nullptr; - - if (data) { - StatPageData *spd = static_cast(data); - - t_state.internal_msg_buffer = spd->data; - if (spd->type) { - t_state.internal_msg_buffer_type = spd->type; - } else { - t_state.internal_msg_buffer_type = nullptr; // Defaults to text/html - } - t_state.internal_msg_buffer_size = spd->length; - t_state.internal_msg_buffer_fast_allocator_size = -1; - } - - call_transact_and_set_next_state(HttpTransact::HandleStatPage); - break; - - case STAT_PAGE_FAILURE: - pending_action = nullptr; - call_transact_and_set_next_state(HttpTransact::HandleStatPage); - break; - - default: - ink_release_assert(0); - break; - } - - return 0; -} - ///////////////////////////////////////////////////////////////////////////////// // HttpSM::state_cache_open_write() // @@ -8118,11 +8035,6 @@ HttpSM::set_next_state() break; } - case HttpTransact::SM_ACTION_INTERNAL_REQUEST: - HTTP_SM_SET_DEFAULT_HANDLER(&HttpSM::state_handle_stat_page); - pending_action = statPagesManager.handle_http(this, &t_state.hdr_info.client_request); - break; - case HttpTransact::SM_ACTION_ORIGIN_SERVER_RR_MARK_DOWN: { HTTP_SM_SET_DEFAULT_HANDLER(&HttpSM::state_mark_os_down); diff --git a/src/proxy/http/HttpTransact.cc b/src/proxy/http/HttpTransact.cc index 2f8ea0c5066..af86bc8569d 100644 --- a/src/proxy/http/HttpTransact.cc +++ b/src/proxy/http/HttpTransact.cc @@ -46,7 +46,6 @@ #include "proxy/ControlMatcher.h" #include "proxy/ReverseProxy.h" #include "proxy/http/HttpBodyFactory.h" -#include "proxy/StatPages.h" #include "proxy/IPAllow.h" #include "iocore/utils/Machine.h" @@ -1578,12 +1577,6 @@ HttpTransact::HandleRequest(State *s) s->cache_info.action = CACHE_DO_LOOKUP; } - // If the hostname is "$internal$" then this is a request for - // internal proxy information. - if (handle_internal_request(s, &s->hdr_info.client_request)) { - TRANSACT_RETURN(SM_ACTION_INTERNAL_REQUEST, nullptr); - } - if (s->state_machine->plugin_tunnel_type == HTTP_PLUGIN_AS_INTERCEPT) { setup_plugin_request_intercept(s); return; @@ -3502,49 +3495,6 @@ HttpTransact::HandleUpdateCachedObjectContinue(State *s) s->next_action = s->saved_update_next_action; } -/////////////////////////////////////////////////////////////////////////////// -// Name : HandleStatPage -// Description: called from the state machine when a response is received -// -// Details : -// -// -// -// Possible Next States From Here: -// -/////////////////////////////////////////////////////////////////////////////// -void -HttpTransact::HandleStatPage(State *s) -{ - HTTPStatus status; - - if (s->internal_msg_buffer) { - status = HTTP_STATUS_OK; - } else { - status = HTTP_STATUS_NOT_FOUND; - } - - build_response(s, &s->hdr_info.client_response, s->client_info.http_version, status); - - /////////////////////////// - // insert content-length // - /////////////////////////// - s->hdr_info.client_response.set_content_length(s->internal_msg_buffer_size); - - if (s->internal_msg_buffer_type) { - int len = strlen(s->internal_msg_buffer_type); - - if (len > 0) { - s->hdr_info.client_response.value_set(MIME_FIELD_CONTENT_TYPE, MIME_LEN_CONTENT_TYPE, s->internal_msg_buffer_type, len); - } - } else { - s->hdr_info.client_response.value_set(MIME_FIELD_CONTENT_TYPE, MIME_LEN_CONTENT_TYPE, "text/plain", 10); - } - - s->cache_info.action = CACHE_DO_NO_ACTION; - s->next_action = SM_ACTION_INTERNAL_CACHE_NOOP; -} - /////////////////////////////////////////////////////////////////////////////// // Name : handle_response_from_parent // Description: response came from a parent proxy @@ -5528,31 +5478,6 @@ HttpTransact::check_response_validity(State *s, HTTPHdr *incoming_hdr) return NO_RESPONSE_HEADER_ERROR; } -bool -HttpTransact::handle_internal_request(State * /* s ATS_UNUSED */, HTTPHdr *incoming_hdr) -{ - URL *url; - - ink_assert(incoming_hdr->type_get() == HTTP_TYPE_REQUEST); - - if (incoming_hdr->method_get_wksidx() != HTTP_WKSIDX_GET) { - return false; - } - - url = incoming_hdr->url_get(); - - int scheme = url->scheme_get_wksidx(); - if (scheme != URL_WKSIDX_HTTP && scheme != URL_WKSIDX_HTTPS) { - return false; - } - - if (!statPagesManager.is_stat_page(url)) { - return false; - } - - return true; -} - bool HttpTransact::handle_trace_and_options_requests(State *s, HTTPHdr *incoming_hdr) { diff --git a/src/proxy/http/Makefile.am b/src/proxy/http/Makefile.am index 57278fb7ad1..7770c0617e2 100644 --- a/src/proxy/http/Makefile.am +++ b/src/proxy/http/Makefile.am @@ -58,8 +58,6 @@ libhttp_a_SOURCES = \ HttpConfig.h \ HttpDebugNames.cc \ HttpDebugNames.h \ - HttpPages.cc \ - HttpPages.h \ HttpProxyServerMain.cc \ HttpProxyServerMain.h \ HttpSM.cc \ diff --git a/src/proxy/http/remap/CMakeLists.txt b/src/proxy/http/remap/CMakeLists.txt index 54fd26d0d1b..ca2540683e6 100644 --- a/src/proxy/http/remap/CMakeLists.txt +++ b/src/proxy/http/remap/CMakeLists.txt @@ -24,7 +24,6 @@ add_library( NextHopRoundRobin.cc NextHopStrategyFactory.cc RemapConfig.cc - RemapHitCount.cc RemapPluginInfo.cc PluginDso.cc PluginFactory.cc diff --git a/src/proxy/http/remap/Makefile.am b/src/proxy/http/remap/Makefile.am index e6e7f1a0393..529baa70860 100644 --- a/src/proxy/http/remap/Makefile.am +++ b/src/proxy/http/remap/Makefile.am @@ -47,8 +47,6 @@ libhttp_remap_a_SOURCES = \ NextHopStrategyFactory.cc \ RemapConfig.cc \ RemapConfig.h \ - RemapHitCount.cc \ - RemapHitCount.h \ RemapPluginInfo.cc \ RemapPluginInfo.h \ PluginDso.cc \ diff --git a/src/proxy/http/remap/RemapHitCount.cc b/src/proxy/http/remap/RemapHitCount.cc deleted file mode 100644 index c85013847d1..00000000000 --- a/src/proxy/http/remap/RemapHitCount.cc +++ /dev/null @@ -1,47 +0,0 @@ -/** @file - - Stats to track remap rule matches - - @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 "proxy/http/remap/RemapHitCount.h" -#include "proxy/http/remap/UrlRewrite.h" - -extern UrlRewrite *rewrite_table; - -struct ShowRemapCount : public ShowCont { - ShowRemapCount(Continuation *c, HTTPHdr *h) : ShowCont(c, h) { SET_HANDLER(&ShowRemapCount::showHandler); } - int - showHandler(int event, Event *e) - { - auto table = rewrite_table->acquire(); - CHECK_SHOW(show(rewrite_table->PrintRemapHits().c_str())); - table->release(); - return completeJson(event, e); - } -}; - -Action * -register_ShowRemapHitCount(Continuation *c, HTTPHdr *h) -{ - ShowRemapCount *s = new ShowRemapCount(c, h); - this_ethread()->schedule_imm(s); - return &s->action; -} diff --git a/src/records/RecordsConfig.cc b/src/records/RecordsConfig.cc index 4370d1d7ce6..75ed50f58d6 100644 --- a/src/records/RecordsConfig.cc +++ b/src/records/RecordsConfig.cc @@ -72,9 +72,6 @@ static const RecordElement RecordsConfig[] = //# 0 == CLOCK_REALTIME, change carefully {RECT_CONFIG, "proxy.config.system_clock", RECD_INT, "0", RECU_RESTART_TS, RR_NULL, RECC_INT, "[0-9]+", RECA_NULL} , - //# 0 = disable - {RECT_CONFIG, "proxy.config.http_ui_enabled", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_NULL, "[0-3]", RECA_NULL} - , {RECT_CONFIG, "proxy.config.cache.max_disk_errors", RECD_INT, "5", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , {RECT_CONFIG, "proxy.config.output.logfile.name", RECD_STRING, "traffic.out", RECU_RESTART_TM, RR_REQUIRED, RECC_NULL, nullptr, @@ -358,8 +355,6 @@ static const RecordElement RecordsConfig[] = , {RECT_CONFIG, "proxy.config.plugin.vc.default_buffer_water_mark", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL} , - {RECT_CONFIG, "proxy.config.http.enable_http_info", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} - , {RECT_CONFIG, "proxy.config.http.server_max_connections", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL} , {RECT_CONFIG, "proxy.config.http.per_server.connection.max", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL} diff --git a/src/traffic_quic/traffic_quic.cc b/src/traffic_quic/traffic_quic.cc index 033ec417eaa..88521333cde 100644 --- a/src/traffic_quic/traffic_quic.cc +++ b/src/traffic_quic/traffic_quic.cc @@ -144,13 +144,6 @@ DNSConnection::trigger() ink_assert(false); } -#include "proxy/StatPages.h" -void -StatPagesManager::register_http(char const *, Action *(*)(Continuation *, HTTPHdr *)) -{ - // ink_assert(false); -} - #include "proxy/ParentSelection.h" void SocksServerConfig::startup() @@ -263,7 +256,6 @@ HttpRequestData::get_client_ip() SslAPIHooks *ssl_hooks = nullptr; LifecycleAPIHooks *lifecycle_hooks = nullptr; -StatPagesManager statPagesManager; #include "proxy/http/HttpDebugNames.h" const char * diff --git a/src/traffic_server/traffic_server.cc b/src/traffic_server/traffic_server.cc index 1a9b72c0caf..99c7fef3d85 100644 --- a/src/traffic_server/traffic_server.cc +++ b/src/traffic_server/traffic_server.cc @@ -92,7 +92,6 @@ extern "C" int plock(int); #include "proxy/IPAllow.h" #include "proxy/ParentSelection.h" #include "proxy/HostStatus.h" -#include "proxy/StatPages.h" #include "proxy/hdrs/HTTP.h" #include "proxy/hdrs/HuffmanCodec.h" #include "proxy/Plugin.h" @@ -2032,9 +2031,6 @@ main(int /* argc ATS_UNUSED */, const char **argv) SET_INTERVAL(RecProcess, "proxy.config.raw_stat_sync_interval_ms", raw_stat_sync_interval_ms); SET_INTERVAL(RecProcess, "proxy.config.remote_sync_interval_ms", remote_sync_interval_ms); - // Initialize the stat pages manager - statPagesManager.init(); - num_of_net_threads = adjust_num_of_net_threads(num_of_net_threads); size_t stacksize; diff --git a/tests/gold_tests/records/gold/full_records.yaml b/tests/gold_tests/records/gold/full_records.yaml index 1219a8b1a6f..8978d8d1313 100644 --- a/tests/gold_tests/records/gold/full_records.yaml +++ b/tests/gold_tests/records/gold/full_records.yaml @@ -188,7 +188,6 @@ ts: doc_in_cache_skip_dns: 1 down_server: cache_time: 60 - enable_http_info: 0 enable_http_stats: 1 enabled: 1 errors: @@ -326,7 +325,6 @@ ts: max_settings: 10 num_placeholders: 100 qpack_blocked_streams: 0 - http_ui_enabled: 0 incoming_ip_to_bind: null log: ascii_buffer_size: 36864 diff --git a/tests/gold_tests/records/legacy_config/full_records.config b/tests/gold_tests/records/legacy_config/full_records.config index 9c16841829a..2c90d65e252 100644 --- a/tests/gold_tests/records/legacy_config/full_records.config +++ b/tests/gold_tests/records/legacy_config/full_records.config @@ -5,7 +5,6 @@ CONFIG proxy.config.proxy_name STRING traffic_server CONFIG proxy.config.core_limit INT -1 CONFIG proxy.config.mlock_enabled INT 0 CONFIG proxy.config.dump_mem_info_frequency INT 0 -CONFIG proxy.config.http_ui_enabled INT 0 CONFIG proxy.config.cache.max_disk_errors INT 5 CONFIG proxy.config.output.logfile STRING traffic.out CONFIG proxy.config.output.logfile_perm STRING rw-r--r-- @@ -100,7 +99,6 @@ CONFIG proxy.config.http.default_buffer_size INT 8 CONFIG proxy.config.http.default_buffer_water_mark INT 32768 CONFIG proxy.config.plugin.vc.default_buffer_index INT 8 CONFIG proxy.config.plugin.vc.default_buffer_water_mark INT 0 -CONFIG proxy.config.http.enable_http_info INT 0 CONFIG proxy.config.http.server_max_connections INT 0 CONFIG proxy.config.http.per_server.connection.max INT 0 CONFIG proxy.config.http.per_server.connection.match STRING both