[trafficserver] branch master updated: Fixed build issues with hwloc 2.x API changes
This is an automated email from the ASF dual-hosted git repository. bcall pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new e655af7 Fixed build issues with hwloc 2.x API changes e655af7 is described below commit e655af7faeaaadd182ce17fd5bd617cafc95aff7 Author: Bryan Call AuthorDate: Fri Nov 8 11:37:23 2019 -0800 Fixed build issues with hwloc 2.x API changes --- iocore/aio/AIO.cc| 5 + iocore/eventsystem/UnixEventProcessor.cc | 9 + 2 files changed, 14 insertions(+) diff --git a/iocore/aio/AIO.cc b/iocore/aio/AIO.cc index 2cd373b..df8e27b 100644 --- a/iocore/aio/AIO.cc +++ b/iocore/aio/AIO.cc @@ -192,9 +192,14 @@ struct AIOThreadInfo : public Continuation { (void)event; (void)e; #if TS_USE_HWLOC +#if HWLOC_API_VERSION >= 0x2 +hwloc_set_membind(ink_get_topology(), hwloc_topology_get_topology_nodeset(ink_get_topology()), HWLOC_MEMBIND_INTERLEAVE, + HWLOC_MEMBIND_THREAD | HWLOC_MEMBIND_BYNODESET); +#else hwloc_set_membind_nodeset(ink_get_topology(), hwloc_topology_get_topology_nodeset(ink_get_topology()), HWLOC_MEMBIND_INTERLEAVE, HWLOC_MEMBIND_THREAD); #endif +#endif aio_thread_main(this); delete this; return EVENT_DONE; diff --git a/iocore/eventsystem/UnixEventProcessor.cc b/iocore/eventsystem/UnixEventProcessor.cc index 2661b67..c2f7fad 100644 --- a/iocore/eventsystem/UnixEventProcessor.cc +++ b/iocore/eventsystem/UnixEventProcessor.cc @@ -230,7 +230,11 @@ ThreadAffinityInitializer::alloc_numa_stack(EThread *t, size_t stacksize) if (mem_policy != HWLOC_MEMBIND_DEFAULT) { // Let's temporarily set the memory binding to our destination NUMA node +#if HWLOC_API_VERSION >= 0x2 +hwloc_set_membind(ink_get_topology(), nodeset, mem_policy, HWLOC_MEMBIND_THREAD | HWLOC_MEMBIND_BYNODESET); +#else hwloc_set_membind_nodeset(ink_get_topology(), nodeset, mem_policy, HWLOC_MEMBIND_THREAD); +#endif } // Alloc our stack @@ -238,8 +242,13 @@ ThreadAffinityInitializer::alloc_numa_stack(EThread *t, size_t stacksize) if (mem_policy != HWLOC_MEMBIND_DEFAULT) { // Now let's set it back to default for this thread. +#if HWLOC_API_VERSION >= 0x2 +hwloc_set_membind(ink_get_topology(), hwloc_topology_get_topology_nodeset(ink_get_topology()), HWLOC_MEMBIND_DEFAULT, + HWLOC_MEMBIND_THREAD | HWLOC_MEMBIND_BYNODESET); +#else hwloc_set_membind_nodeset(ink_get_topology(), hwloc_topology_get_topology_nodeset(ink_get_topology()), HWLOC_MEMBIND_DEFAULT, HWLOC_MEMBIND_THREAD); +#endif } hwloc_bitmap_free(nodeset);
[trafficserver] branch 9.0.x updated: Remove Cache v23 support
This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/9.0.x by this push: new aec8f5d Remove Cache v23 support aec8f5d is described below commit aec8f5d496acc8b40756d962ebec3570a161ca50 Author: scw00 AuthorDate: Mon Apr 29 06:29:18 2019 + Remove Cache v23 support (cherry picked from commit d000f0cc0cb30d40755da408962a81c2745fbdf5) --- iocore/cache/Cache.cc | 230 ++--- iocore/cache/I_CacheDefs.h | 10 +- iocore/cache/P_CacheBC.h | 137 --- 3 files changed, 11 insertions(+), 366 deletions(-) diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc index 83b33b5..35291d2 100644 --- a/iocore/cache/Cache.cc +++ b/iocore/cache/Cache.cc @@ -34,7 +34,6 @@ #include "HttpSM.h" #include "HttpCacheSM.h" #include "InkAPIInternal.h" -#include "P_CacheBC.h" #include "tscore/hugepages.h" @@ -2152,92 +2151,6 @@ unmarshal_helper(Doc *doc, Ptr , int ) } } -/** Upgrade a marshalled fragment buffer to the current version. - -@internal I looked at doing this in place (rather than a copy & modify) but -- The in place logic would be even worse than this mess -- It wouldn't save you that much, since you end up doing inserts early in the buffer. - Without extreme care in the logic it could end up doing more copying than - the simpler copy & modify. - -@internal This logic presumes the existence of some slack at the end of the buffer, which -is usually the case (because lots of rounding is done). If there isn't enough slack then -this fails and we have a cache miss. The assumption that this is sufficiently rare that -code simplicity takes precedence should be checked at some point. - */ -static bool -upgrade_doc_version(Ptr ) -{ - // Type definition is close enough to use for initial checking. - cache_bc::Doc_v23 *doc = reinterpret_cast(buf->data()); - bool zret = true; - - if (DOC_MAGIC == doc->magic) { -if (0 == doc->hlen) { - Debug("cache_bc", "Doc %p without header, no upgrade needed.", doc); -} else if (CACHE_FRAG_TYPE_HTTP_V23 == doc->doc_type) { - cache_bc::HTTPCacheAlt_v21 *alt = reinterpret_cast(doc->hdr()); - if (alt && alt->is_unmarshalled_format()) { -Ptr d_buf(ioDataAllocator.alloc()); -Doc *d_doc; -char *src; -char *dst; -char *hdr_limit = doc->data(); -HTTPInfo::FragOffset *frags = - reinterpret_cast(static_cast(buf->data()) + sizeof(cache_bc::Doc_v23)); -int frag_count = doc->_flen / sizeof(HTTPInfo::FragOffset); -size_t n= 0; -size_t content_size = doc->data_len(); - -Debug("cache_bc", "Doc %p is 3.2", doc); - -// Use the same buffer size, fail if no fit. -d_buf->alloc(buf->_size_index, buf->_mem_type); // Duplicate. -d_doc = reinterpret_cast(d_buf->data()); -n = d_buf->block_size(); - -src = buf->data(); -dst = d_buf->data(); -memcpy(dst, src, sizeof(Doc)); -src += sizeof(Doc) + doc->_flen; -dst += sizeof(Doc); -n -= sizeof(Doc); - -// We copy the fragment table iff there is a fragment table and there is only one alternate. -if (frag_count > 0 && cache_bc::HTTPInfo_v21::marshalled_length(src) > doc->hlen) { - frag_count = 0; // inhibit fragment table insertion. -} - -while (zret && src < hdr_limit) { - zret = cache_bc::HTTPInfo_v21::copy_and_upgrade_unmarshalled_to_v23(dst, src, n, frag_count, frags); -} -if (zret && content_size <= n) { - memcpy(dst, src, content_size); // content - // Must update new Doc::len and Doc::hlen - // dst points at the first byte of the content, or one past the last byte of the alt header. - d_doc->len = (dst - reinterpret_cast(d_doc)) + content_size; - d_doc->hlen = (dst - reinterpret_cast(d_doc)) - sizeof(Doc); - buf = d_buf; // replace original buffer with new buffer. -} else { - zret = false; -} - } - Doc *n_doc = reinterpret_cast(buf->data()); // access as current version. - // For now the base header size is the same. If that changes we'll need to handle the v22/23 case here - // as with the v21 and shift the content down to accommodate the bigger header. - ink_assert(sizeof(*n_doc) == sizeof(*doc)); - - n_doc->doc_type = CACHE_FRAG_TYPE_HTTP; // We converted so adjust doc_type. - // Set these to zero for debugging - they'll be updated to the current values if/when this is - // put in the aggregation buffer. - n_doc->v_major = 0; - n_doc->v_minor = 0; - n_doc->unused = 0; // force to zero to make future use
[trafficserver] branch master updated (02c0e5b -> d000f0c)
This is an automated email from the ASF dual-hosted git repository. zwoop pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git. from 02c0e5b detect bogus jemalloc version add d000f0c Remove Cache v23 support No new revisions were added by this update. Summary of changes: iocore/cache/Cache.cc | 230 ++--- iocore/cache/I_CacheDefs.h | 10 +- iocore/cache/P_CacheBC.h | 137 --- 3 files changed, 11 insertions(+), 366 deletions(-) delete mode 100644 iocore/cache/P_CacheBC.h
[trafficserver] branch 9.0.x updated (25db8be -> 6088d51)
This is an automated email from the ASF dual-hosted git repository. zwoop pushed a change to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git. from 25db8be thread ready check new 61697bb tests: Cleans up local variable is assigned to but never used warnings new 27f0af2 Add AUTest using h2spec new 712e1b9 Allow txn handler to be set from ssn on same hook new 6088d51 tests: Cleans up imported but unused imports The 4 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: proxy/InkAPIInternal.h | 5 +- src/traffic_server/InkAPI.cc | 9 +- tests/gold_tests/autest-site/curl_header.test.ext | 1 - tests/gold_tests/autest-site/init.cli.ext | 5 +- tests/gold_tests/autest-site/microDNS.test.ext | 4 +- tests/gold_tests/autest-site/microserver.test.ext | 11 +- .../gold_tests/autest-site/traffic_replay.test.ext | 4 +- .../gold_tests/autest-site/trafficserver.test.ext | 5 +- tests/gold_tests/basic/config.test.py | 1 - tests/gold_tests/basic/copy_config.test.py | 2 +- tests/gold_tests/basic/deny0.test.py | 1 - tests/gold_tests/cache/cache-control.test.py | 3 +- .../chunked_encoding/chunked_encoding.test.py | 1 - tests/gold_tests/continuations/double.test.py | 4 +- tests/gold_tests/continuations/double_h2.test.py | 4 +- tests/gold_tests/continuations/openclose.test.py | 4 +- tests/gold_tests/h2/gold/h2spec_stdout.gold| 3 + tests/gold_tests/h2/h2active_timeout.py| 1 - tests/gold_tests/h2/h2bigclient.py | 2 - tests/gold_tests/h2/h2chunked.py | 2 - tests/gold_tests/h2/h2client.py| 2 - tests/gold_tests/h2/h2disable.test.py | 1 - .../h2/h2disable_no_accept_threads.test.py | 1 - tests/gold_tests/h2/h2enable.test.py | 1 - .../h2/h2enable_no_accept_threads.test.py | 1 - tests/gold_tests/h2/h2spec.test.py | 78 tests/gold_tests/h2/http2_priority.test.py | 6 +- .../gold_tests/headers/cache_and_req_body.test.py | 1 - tests/gold_tests/headers/cachedIMSRange.test.py| 2 - tests/gold_tests/headers/forwarded-observer.py | 1 - tests/gold_tests/headers/forwarded.test.py | 1 - tests/gold_tests/headers/hsts.test.py | 1 - tests/gold_tests/headers/http408.test.py | 1 - tests/gold_tests/headers/normalize_ae.test.py | 1 - tests/gold_tests/headers/syntax.test.py| 1 - tests/gold_tests/headers/via.test.py | 1 - tests/gold_tests/logging/all_headers.test.py | 1 - tests/gold_tests/logging/ccid_ctid.test.py | 1 - tests/gold_tests/logging/log-filter.test.py| 9 +- .../client_context_dump.test.py| 2 - .../pluginTest/compress/compress.test.py | 2 - .../header_rewrite/header_rewrite.test.py | 1 - .../pluginTest/multiplexer/multiplexer.test.py | 1 - tests/gold_tests/pluginTest/slice/slice.test.py| 2 - .../pluginTest/slice/slice_error.test.py | 2 - .../gold_tests/pluginTest/test_hooks/hook_add.gold | 7 ++ .../{test_hooks.test.py => hook_add.test.py} | 51 ++-- .../gold_tests/pluginTest/url_sig/url_sig.test.py | 3 +- tests/gold_tests/redirect/redirect_post.test.py| 1 - tests/gold_tests/remap/remap_http.test.py | 1 - tests/gold_tests/remap/remap_https.test.py | 1 - tests/gold_tests/runroot/runroot_error.test.py | 2 - tests/gold_tests/runroot/runroot_init.test.py | 2 - tests/gold_tests/runroot/runroot_manager.test.py | 2 - tests/gold_tests/runroot/runroot_remove.test.py| 2 - tests/gold_tests/runroot/runroot_use.test.py | 2 - tests/gold_tests/runroot/runroot_verify.test.py| 2 - .../gold_tests/thread_config/thread_100_0.test.py | 2 - .../gold_tests/thread_config/thread_100_1.test.py | 2 - .../gold_tests/thread_config/thread_100_10.test.py | 2 - tests/gold_tests/thread_config/thread_1_0.test.py | 2 - tests/gold_tests/thread_config/thread_1_1.test.py | 2 - tests/gold_tests/thread_config/thread_1_10.test.py | 2 - tests/gold_tests/thread_config/thread_2_0.test.py | 2 - tests/gold_tests/thread_config/thread_2_1.test.py | 2 - tests/gold_tests/thread_config/thread_2_10.test.py | 2 - tests/gold_tests/thread_config/thread_32_0.test.py | 2 - tests/gold_tests/thread_config/thread_32_1.test.py | 2 - .../gold_tests/thread_config/thread_32_10.test.py | 2 - tests/gold_tests/tls/tls.test.py | 1 -
[trafficserver] 01/04: tests: Cleans up local variable is assigned to but never used warnings
This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git commit 61697bbc96ce3c57048f93bd5c6f6c46d1814ca1 Author: Randall Meyer AuthorDate: Mon Nov 4 18:42:57 2019 -0800 tests: Cleans up local variable is assigned to but never used warnings (cherry picked from commit 61cce69983283a9613cafb8867e53b8595465efe) --- tests/gold_tests/h2/h2bigclient.py | 1 - tests/gold_tests/h2/h2chunked.py| 1 - tests/gold_tests/h2/h2client.py | 1 - tests/gold_tests/tls/tls_ticket.test.py | 1 - 4 files changed, 4 deletions(-) diff --git a/tests/gold_tests/h2/h2bigclient.py b/tests/gold_tests/h2/h2bigclient.py index 6e0cec8..8bc6a06 100644 --- a/tests/gold_tests/h2/h2bigclient.py +++ b/tests/gold_tests/h2/h2bigclient.py @@ -43,7 +43,6 @@ def makerequest(port): # Fetch the object twice so we know at least one time comes from cache # Exploring timing options sites = ['/bigfile', '/bigfile'] -responses = [] request_ids = [] for site in sites: request_id = conn.request('GET', url=site) diff --git a/tests/gold_tests/h2/h2chunked.py b/tests/gold_tests/h2/h2chunked.py index 8b1d051..e929450 100644 --- a/tests/gold_tests/h2/h2chunked.py +++ b/tests/gold_tests/h2/h2chunked.py @@ -41,7 +41,6 @@ def makerequest(port, _url): conn = HTTPConnection('localhost:{0}'.format(port), secure=True) sites = {'/'} -responses = [] request_ids = [] for site in sites: request_id = conn.request('GET', url=_url) diff --git a/tests/gold_tests/h2/h2client.py b/tests/gold_tests/h2/h2client.py index df0d19f..5042965 100644 --- a/tests/gold_tests/h2/h2client.py +++ b/tests/gold_tests/h2/h2client.py @@ -41,7 +41,6 @@ def makerequest(port): conn = HTTPConnection('localhost:{0}'.format(port), secure=True) sites = {'/'} -responses = [] request_ids = [] for site in sites: request_id = conn.request('GET', url=site) diff --git a/tests/gold_tests/tls/tls_ticket.test.py b/tests/gold_tests/tls/tls_ticket.test.py index 4d34ddb..d26e14d 100644 --- a/tests/gold_tests/tls/tls_ticket.test.py +++ b/tests/gold_tests/tls/tls_ticket.test.py @@ -95,7 +95,6 @@ def checkSession(ev) : f1Content = f1.read() f2Content = f2.read() - sessRegex = re.compile('Session-ID: ([0-9A-F]+)') match1 = re.findall('Session-ID: ([0-9A-F]+)', f1Content) match2 = re.findall('Session-ID: ([0-9A-F]+)', f2Content)
[trafficserver] 04/04: tests: Cleans up imported but unused imports
This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git commit 6088d512aee0e259ba0dba1c8d33484972cdcc80 Author: Randall Meyer AuthorDate: Mon Nov 4 18:39:49 2019 -0800 tests: Cleans up imported but unused imports (cherry picked from commit 6b08479ecfe4f677a0b22b8942f6bbaadd687d92) --- tests/gold_tests/autest-site/curl_header.test.ext | 1 - tests/gold_tests/autest-site/init.cli.ext | 5 ++--- tests/gold_tests/autest-site/microDNS.test.ext| 4 +--- tests/gold_tests/autest-site/microserver.test.ext | 11 +-- tests/gold_tests/autest-site/traffic_replay.test.ext | 4 ++-- tests/gold_tests/autest-site/trafficserver.test.ext | 5 + tests/gold_tests/basic/config.test.py | 1 - tests/gold_tests/basic/copy_config.test.py| 2 +- tests/gold_tests/basic/deny0.test.py | 1 - tests/gold_tests/cache/cache-control.test.py | 3 +-- tests/gold_tests/chunked_encoding/chunked_encoding.test.py| 1 - tests/gold_tests/continuations/double.test.py | 4 ++-- tests/gold_tests/continuations/double_h2.test.py | 4 ++-- tests/gold_tests/continuations/openclose.test.py | 4 ++-- tests/gold_tests/h2/h2active_timeout.py | 1 - tests/gold_tests/h2/h2bigclient.py| 1 - tests/gold_tests/h2/h2chunked.py | 1 - tests/gold_tests/h2/h2client.py | 1 - tests/gold_tests/h2/h2disable.test.py | 1 - tests/gold_tests/h2/h2disable_no_accept_threads.test.py | 1 - tests/gold_tests/h2/h2enable.test.py | 1 - tests/gold_tests/h2/h2enable_no_accept_threads.test.py| 1 - tests/gold_tests/h2/h2spec.test.py| 5 - tests/gold_tests/h2/http2_priority.test.py| 6 +- tests/gold_tests/headers/cache_and_req_body.test.py | 1 - tests/gold_tests/headers/cachedIMSRange.test.py | 2 -- tests/gold_tests/headers/forwarded-observer.py| 1 - tests/gold_tests/headers/forwarded.test.py| 1 - tests/gold_tests/headers/hsts.test.py | 1 - tests/gold_tests/headers/http408.test.py | 1 - tests/gold_tests/headers/normalize_ae.test.py | 1 - tests/gold_tests/headers/syntax.test.py | 1 - tests/gold_tests/headers/via.test.py | 1 - tests/gold_tests/logging/all_headers.test.py | 1 - tests/gold_tests/logging/ccid_ctid.test.py| 1 - tests/gold_tests/logging/log-filter.test.py | 9 - .../client_context_dump/client_context_dump.test.py | 2 -- tests/gold_tests/pluginTest/compress/compress.test.py | 2 -- .../pluginTest/header_rewrite/header_rewrite.test.py | 1 - tests/gold_tests/pluginTest/multiplexer/multiplexer.test.py | 1 - tests/gold_tests/pluginTest/slice/slice.test.py | 2 -- tests/gold_tests/pluginTest/slice/slice_error.test.py | 2 -- tests/gold_tests/pluginTest/test_hooks/hook_add.test.py | 2 +- tests/gold_tests/pluginTest/url_sig/url_sig.test.py | 3 +-- tests/gold_tests/redirect/redirect_post.test.py | 1 - tests/gold_tests/remap/remap_http.test.py | 1 - tests/gold_tests/remap/remap_https.test.py| 1 - tests/gold_tests/runroot/runroot_error.test.py| 2 -- tests/gold_tests/runroot/runroot_init.test.py | 2 -- tests/gold_tests/runroot/runroot_manager.test.py | 2 -- tests/gold_tests/runroot/runroot_remove.test.py | 2 -- tests/gold_tests/runroot/runroot_use.test.py | 2 -- tests/gold_tests/runroot/runroot_verify.test.py | 2 -- tests/gold_tests/thread_config/thread_100_0.test.py | 2 -- tests/gold_tests/thread_config/thread_100_1.test.py | 2 -- tests/gold_tests/thread_config/thread_100_10.test.py | 2 -- tests/gold_tests/thread_config/thread_1_0.test.py | 2 -- tests/gold_tests/thread_config/thread_1_1.test.py | 2 -- tests/gold_tests/thread_config/thread_1_10.test.py| 2 -- tests/gold_tests/thread_config/thread_2_0.test.py | 2 -- tests/gold_tests/thread_config/thread_2_1.test.py | 2 -- tests/gold_tests/thread_config/thread_2_10.test.py| 2 -- tests/gold_tests/thread_config/thread_32_0.test.py| 2 -- tests/gold_tests/thread_config/thread_32_1.test.py| 2 --
[trafficserver] 02/04: Add AUTest using h2spec
This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git commit 27f0af2b57e399cc7c352ffce7e9c42ca66dbccd Author: Masaori Koshiba AuthorDate: Fri Jun 14 11:17:09 2019 +0900 Add AUTest using h2spec (cherry picked from commit 097017d7122d7b1ba82bfe5ea92f85ab7a17599b) --- tests/gold_tests/h2/gold/h2spec_stdout.gold | 3 ++ tests/gold_tests/h2/h2spec.test.py | 83 + 2 files changed, 86 insertions(+) diff --git a/tests/gold_tests/h2/gold/h2spec_stdout.gold b/tests/gold_tests/h2/gold/h2spec_stdout.gold new file mode 100644 index 000..02732ee --- /dev/null +++ b/tests/gold_tests/h2/gold/h2spec_stdout.gold @@ -0,0 +1,3 @@ +`` +Finished in `` seconds +`` tests, `` passed, 0 skipped, 0 failed diff --git a/tests/gold_tests/h2/h2spec.test.py b/tests/gold_tests/h2/h2spec.test.py new file mode 100644 index 000..a188e80 --- /dev/null +++ b/tests/gold_tests/h2/h2spec.test.py @@ -0,0 +1,83 @@ +''' +Test HTTP/2 with h2spec +''' +# 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. + +import os + +# +# Setup Test +# +Test.Summary = ''' +Test HTTP/2 with httpspec +''' + +Test.SkipUnless( +Condition.HasProgram("h2spec", "h2spec need to be installed on system for this test to work"), +) +Test.ContinueOnFail = True + +# +# Setup httpbin Origin Server +# +httpbin = Test.MakeHttpBinServer("httpbin") + +# +# Setup ATS +# +ts = Test.MakeATSProcess("ts", select_ports=False) + +# add ssl materials like key, certificates for the server +ts.addSSLfile("ssl/server.pem") +ts.addSSLfile("ssl/server.key") + +ts.Variables.ssl_port = 4443 +ts.Disk.remap_config.AddLine( +'map / http://127.0.0.1:{0}'.format(httpbin.Variables.Port) +) +ts.Disk.ssl_multicert_config.AddLine( +'dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key' +) +ts.Disk.records_config.update({ +'proxy.config.http.server_ports': '{0} {1}:ssl'.format(ts.Variables.port, ts.Variables.ssl_port), +'proxy.config.http.insert_request_via_str': 1, +'proxy.config.http.insert_response_via_str': 1, +'proxy.config.http.cache.http': 0, +'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir), +'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir), +'proxy.config.ssl.client.verify.server': 0, +'proxy.config.diags.debug.enabled': 1, +'proxy.config.diags.debug.tags': 'http2', +}) + +# +# Test Cases +# + +# Known broken tests are left out (http2/6.4. and http2/6.9.) +h2spec_targets = "http2/1 http2/2 http2/3 http2/4 http2/5 http2/6.1 http2/6.2 http2/6.3 http2/6.5 http2/6.6 http2/6.7 http2/6.8 http2/7 http2/8 hpack" + +test_run = Test.AddTestRun() +test_run.Processes.Default.Command = 'h2spec {0} -t -k -p {1}'.format(h2spec_targets, ts.Variables.ssl_port) +test_run.Processes.Default.ReturnCode = 0 +test_run.Processes.Default.StartBefore(httpbin, ready=When.PortOpen(httpbin.Variables.Port)) +test_run.Processes.Default.StartBefore(Test.Processes.ts, ready=When.PortOpen(ts.Variables.ssl_port)) +test_run.Processes.Default.Streams.stdout = "gold/h2spec_stdout.gold" +test_run.StillRunningAfter = httpbin + +# Over riding the built in ERROR check since we expect some error cases +ts.Disk.diags_log.Content = Testers.ContainsExpression("ERROR: HTTP/2", "h2spec tests should have error log")
[trafficserver] 03/04: Allow txn handler to be set from ssn on same hook
This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git commit 712e1b9a340380e0aab45b6e7033557e37d85b13 Author: Susan Hinrichs AuthorDate: Fri Oct 25 20:28:33 2019 + Allow txn handler to be set from ssn on same hook (cherry picked from commit be2102e4b2874e69823bee5e14f7f644f65cb501) --- proxy/InkAPIInternal.h | 5 +- src/traffic_server/InkAPI.cc | 9 +- .../gold_tests/pluginTest/test_hooks/hook_add.gold | 7 ++ .../pluginTest/test_hooks/hook_add.test.py | 57 + tests/tools/plugins/hook_add_plugin.cc | 140 + 5 files changed, 214 insertions(+), 4 deletions(-) diff --git a/proxy/InkAPIInternal.h b/proxy/InkAPIInternal.h index 25fab38..4a90f35 100644 --- a/proxy/InkAPIInternal.h +++ b/proxy/InkAPIInternal.h @@ -357,8 +357,9 @@ public: protected: /// Track the state of one scope of hooks. struct Scope { -APIHook const *_c; ///< Current hook (candidate for invocation). -APIHook const *_p; ///< Previous hook (already invoked). +APIHook const *_c; ///< Current hook (candidate for invocation). +APIHook const *_p; ///< Previous hook (already invoked). +APIHooks const *_hooks; ///< Reference to the real hook list /// Initialize the scope. void init(HttpAPIHooks const *scope, TSHttpHookID id); diff --git a/src/traffic_server/InkAPI.cc b/src/traffic_server/InkAPI.cc index fb910e0..b508e03 100644 --- a/src/traffic_server/InkAPI.cc +++ b/src/traffic_server/InkAPI.cc @@ -1426,16 +1426,21 @@ HttpHookState::is_enabled() void HttpHookState::Scope::init(HttpAPIHooks const *feature_hooks, TSHttpHookID id) { - APIHooks const *hooks = (*feature_hooks)[id]; + _hooks = (*feature_hooks)[id]; _p = nullptr; - _c = hooks->head(); + _c = _hooks->head(); } APIHook const * HttpHookState::Scope::candidate() { /// Simply returns _c hook for now. Later will do priority checking here + + // Check to see if a hook has been added since this was initialized empty + if (nullptr == _c && nullptr == _p && _hooks != nullptr) { +_c = _hooks->head(); + } return _c; } diff --git a/tests/gold_tests/pluginTest/test_hooks/hook_add.gold b/tests/gold_tests/pluginTest/test_hooks/hook_add.gold new file mode 100644 index 000..9141bac --- /dev/null +++ b/tests/gold_tests/pluginTest/test_hooks/hook_add.gold @@ -0,0 +1,7 @@ +`` DIAG: (test) -- globalHandler :: TS_EVENT_HTTP_SSN_START +`` DIAG: (test) New session, cont is `` +`` DIAG: (test) -- sessionHandler :: TS_EVENT_HTTP_PRE_REMAP +`` DIAG: (test) -- transactionHandler :: TS_EVENT_HTTP_PRE_REMAP +`` DIAG: (test) -- transactionHandler :: TS_EVENT_HTTP_TXN_CLOSE +`` DIAG: (test) -- sessionHandler :: TS_EVENT_HTTP_SSN_CLOSE +`` diff --git a/tests/gold_tests/pluginTest/test_hooks/hook_add.test.py b/tests/gold_tests/pluginTest/test_hooks/hook_add.test.py new file mode 100644 index 000..3ea96bc --- /dev/null +++ b/tests/gold_tests/pluginTest/test_hooks/hook_add.test.py @@ -0,0 +1,57 @@ +# 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. + +Test.Summary = ''' +Test adding hooks +''' + +Test.ContinueOnFail = True + +server = Test.MakeOriginServer("server") + +request_header = { +"headers": "GET /argh HTTP/1.1\r\nHost: doesnotmatter\r\n\r\n", "timestamp": "1469733493.993", "body": "" } +response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": "" } +server.addResponse("sessionlog.json", request_header, response_header) + +ts = Test.MakeATSProcess("ts", select_ports=True, enable_tls=False) + +ts.Disk.records_config.update({ +'proxy.config.diags.debug.tags': 'test', +'proxy.config.diags.debug.enabled': 1, +'proxy.config.http.cache.http': 0, +'proxy.config.url_remap.remap_required': 0, +}) + +Test.PreparePlugin(Test.Variables.AtsTestToolsDir + '/plugins/hook_add_plugin.cc', ts) + +ts.Disk.remap_config.AddLine( +"map http://one http://127.0.0.1:{0}".format(server.Variables.Port) +) + +tr = Test.AddTestRun() +# Probe server port to check if ready.
[trafficserver] 03/04: Normalize loopback usage in session_match autest
This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git commit ab5f56c08ebcf5e17525ceb15611320cda77db61 Author: Randall Meyer AuthorDate: Fri Nov 1 16:46:03 2019 -0700 Normalize loopback usage in session_match autest (cherry picked from commit 07e6e2d4243ef218410b6dff22f85cfb314492cd) --- tests/gold_tests/session_sharing/session_match.test.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/gold_tests/session_sharing/session_match.test.py b/tests/gold_tests/session_sharing/session_match.test.py index 2e619e5..20dcd61 100644 --- a/tests/gold_tests/session_sharing/session_match.test.py +++ b/tests/gold_tests/session_sharing/session_match.test.py @@ -70,9 +70,9 @@ class SessionMatchTest: def _runTraffic(self): self._tr.Processes.Default.Command = ( -'curl -v -H\'Host: www.example.com\' -H\'Connection: close\' http://127.0.1:{port}/one &&' -'curl -v -H\'Host: www.example.com\' -H\'Connection: close\' http://127.0.1:{port}/two &&' -'curl -v -H\'Host: www.example.com\' -H\'Connection: close\' http://127.0.1:{port}/three'.format( +'curl -v -H\'Host: www.example.com\' -H\'Connection: close\' http://127.0.0.1:{port}/one &&' +'curl -v -H\'Host: www.example.com\' -H\'Connection: close\' http://127.0.0.1:{port}/two &&' +'curl -v -H\'Host: www.example.com\' -H\'Connection: close\' http://127.0.0.1:{port}/three'.format( port = self._ts.Variables.port)) self._tr.Processes.Default.ReturnCode = 0 self._tr.Processes.Default.StartBefore(self._server)
[trafficserver] 02/04: Only decrement log_stat_log_files_open_stat when the file is closed.
This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git commit 97b55e78b9fc9741e74230ff356c0c18cea4d4a8 Author: bneradt AuthorDate: Mon Oct 28 22:00:55 2019 + Only decrement log_stat_log_files_open_stat when the file is closed. (cherry picked from commit 0db18c7af94e6d81d997a583035f8834aa0c8813) --- include/tscore/BaseLogFile.h | 2 +- proxy/logging/LogFile.cc | 22 +++--- src/tscore/BaseLogFile.cc| 20 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/include/tscore/BaseLogFile.h b/include/tscore/BaseLogFile.h index 38f6a49..aad4735 100644 --- a/include/tscore/BaseLogFile.h +++ b/include/tscore/BaseLogFile.h @@ -177,7 +177,7 @@ public: static bool rolled_logfile(char *path); static bool exists(const char *pathname); int open_file(int perm = -1); - void close_file(); + int close_file(); void change_name(const char *new_name); void display(FILE *fd = stdout); const char * diff --git a/proxy/logging/LogFile.cc b/proxy/logging/LogFile.cc index d0b95da..59c6bde 100644 --- a/proxy/logging/LogFile.cc +++ b/proxy/logging/LogFile.cc @@ -258,18 +258,24 @@ LogFile::close_file() { if (is_open()) { if (m_file_format == LOG_FILE_PIPE) { - ::close(m_fd); - Debug("log-file", "LogFile %s (fd=%d) is closed", m_name, m_fd); + if (::close(m_fd)) { +Error("Error closing LogFile %s: %s.", m_name, strerror(errno)); + } else { +Debug("log-file", "LogFile %s (fd=%d) is closed", m_name, m_fd); +RecIncrRawStat(log_rsb, this_thread()->mutex->thread_holding, log_stat_log_files_open_stat, -1); + } m_fd = -1; } else if (m_log) { - m_log->close_file(); - Debug("log-file", "LogFile %s is closed", m_log->get_name()); + if (m_log->close_file()) { +Error("Error closing LogFile %s: %s.", m_log->get_name(), strerror(errno)); + } else { +Debug("log-file", "LogFile %s is closed", m_log->get_name()); +RecIncrRawStat(log_rsb, this_thread()->mutex->thread_holding, log_stat_log_files_open_stat, -1); + } } else { Warning("LogFile %s is open but was not closed", m_name); } } - - RecIncrRawStat(log_rsb, this_thread()->mutex->thread_holding, log_stat_log_files_open_stat, -1); } struct RolledFile { @@ -369,7 +375,9 @@ LogFile::roll(long interval_start, long interval_end, bool reopen_after_rolling) // Since these two methods of using BaseLogFile are not compatible, we perform the logging log file specific // close file operation here within the containing LogFile object. if (m_log->roll(interval_start, interval_end)) { - m_log->close_file(); + if (m_log->close_file()) { +Error("Error closing LogFile %s: %s.", m_log->get_name(), strerror(errno)); + } if (reopen_after_rolling) { /* If we re-open now log file will be created even if there is nothing being logged */ diff --git a/src/tscore/BaseLogFile.cc b/src/tscore/BaseLogFile.cc index 1dac88f..26f567e 100644 --- a/src/tscore/BaseLogFile.cc +++ b/src/tscore/BaseLogFile.cc @@ -339,18 +339,30 @@ BaseLogFile::open_file(int perm) return LOG_FILE_NO_ERROR; } -/* - * Closes actual log file, not metainfo +/** + * @brief Close the managed log file. + * + * @note This closes the actual log file, not its metainfo. + * + * @return The result of calling fclose on the file descriptor or 0 if the file + * was not open. If the result is non-zero, fclose failed and errno is set + * appropriately. */ -void +int BaseLogFile::close_file() { + int ret = 0; if (is_open()) { -fclose(m_fp); log_log_trace("BaseLogFile %s is closed\n", m_name.get()); + +// Both log_log_trace and fclose may set errno. Thus, keep fclose after +// log_log_trace so that by the time this function completes if errno was +// set by fclose it will remain upon function return. +ret = fclose(m_fp); m_fp = nullptr; m_is_init = false; } + return ret; } /*
[trafficserver] 01/04: detect bogus jemalloc version
This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git commit 7e73a385d3f13ea31faf0c6b5da23e19993f1db5 Author: Fei Deng AuthorDate: Fri Nov 8 13:44:16 2019 -0600 detect bogus jemalloc version (cherry picked from commit 02c0e5b4e2b14fc2fab567762e24a1aede3f7e29) --- build/jemalloc.m4| 13 - include/tscore/JeAllocator.h | 3 +++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/build/jemalloc.m4 b/build/jemalloc.m4 index 48b2cdc..6b707cd 100644 --- a/build/jemalloc.m4 +++ b/build/jemalloc.m4 @@ -68,7 +68,18 @@ if test "$enable_jemalloc" != "no"; then AC_CHECK_HEADERS(jemalloc/jemalloc.h, [jemalloc_have_headers=1]) fi if test "$jemalloc_have_headers" != "0"; then -jemalloch=1 +AC_RUN_IFELSE([ + AC_LANG_PROGRAM( +[#include ], +[ + #if (JEMALLOC_VERSION_MAJOR == 0) + exit(1); + #endif +] + )], + [jemalloch=1], + [AC_MSG_ERROR(jemalloc has bogus version)] +) else CPPFLAGS=$saved_cppflags LDFLAGS=$saved_ldflags diff --git a/include/tscore/JeAllocator.h b/include/tscore/JeAllocator.h index 7d1b678..24e94d9 100644 --- a/include/tscore/JeAllocator.h +++ b/include/tscore/JeAllocator.h @@ -26,6 +26,9 @@ #if TS_HAS_JEMALLOC #include +#if (JEMALLOC_VERSION_MAJOR == 0) +#error jemalloc has bogus version +#endif #if (JEMALLOC_VERSION_MAJOR == 5) && defined(MADV_DONTDUMP) #define JEMALLOC_NODUMP_ALLOCATOR_SUPPORTED 1 #endif /* MADV_DONTDUMP */
[trafficserver] branch 9.0.x updated: thread ready check
This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/9.0.x by this push: new 25db8be thread ready check 25db8be is described below commit 25db8be84f4be674fead009f32da63b19112f121 Author: Fei Deng AuthorDate: Mon Oct 28 10:15:26 2019 -0500 thread ready check (cherry picked from commit 3ceab9e3d0426000ec1ec3c34decdb375906f073) --- iocore/eventsystem/I_EventProcessor.h| 4 iocore/eventsystem/UnixEventProcessor.cc | 27 +++ proxy/http/HttpProxyServerMain.cc| 4 ++-- proxy/http/HttpProxyServerMain.h | 2 +- src/traffic_server/traffic_server.cc | 12 +--- 5 files changed, 39 insertions(+), 10 deletions(-) diff --git a/iocore/eventsystem/I_EventProcessor.h b/iocore/eventsystem/I_EventProcessor.h index 761f9ca..227ea19 100644 --- a/iocore/eventsystem/I_EventProcessor.h +++ b/iocore/eventsystem/I_EventProcessor.h @@ -325,6 +325,8 @@ public: */ int n_ethreads = 0; + bool has_tg_started(int etype); + /*--*\ | Unix & non NT Interface| \*--*/ @@ -410,3 +412,5 @@ private: }; extern inkcoreapi class EventProcessor eventProcessor; + +void thread_started(EThread *); diff --git a/iocore/eventsystem/UnixEventProcessor.cc b/iocore/eventsystem/UnixEventProcessor.cc index 2182c34..2661b67 100644 --- a/iocore/eventsystem/UnixEventProcessor.cc +++ b/iocore/eventsystem/UnixEventProcessor.cc @@ -371,6 +371,7 @@ EventProcessor::spawn_event_threads(EventType ev_type, int n_threads, size_t sta } tg->_count = n_threads; n_ethreads += n_threads; + schedule_spawn(_started, ev_type); // Separate loop to avoid race conditions between spawn events and updating the thread table for // the group. Some thread set up depends on knowing the total number of threads but that can't be @@ -394,10 +395,7 @@ EventProcessor::initThreadState(EThread *t) { // Run all thread type initialization continuations that match the event types for this thread. for (int i = 0; i < MAX_EVENT_TYPES; ++i) { -if (t->is_event_type(i)) { // that event type done here, roll thread start events of that type. - if (++thread_group[i]._started == thread_group[i]._count && thread_group[i]._afterStartCallback != nullptr) { -thread_group[i]._afterStartCallback(); - } +if (t->is_event_type(i)) { // To avoid race conditions on the event in the spawn queue, create a local one to actually send. // Use the spawn queue event as a read only model. Event *nev = eventAllocator.alloc(); @@ -491,3 +489,24 @@ EventProcessor::spawn_thread(Continuation *cont, const char *thr_name, size_t st return e; } + +bool +EventProcessor::has_tg_started(int etype) +{ + return thread_group[etype]._started == thread_group[etype]._count; +} + +void +thread_started(EThread *t) +{ + // Find what type of thread this is, and increment the "_started" counter of that thread type. + for (int i = 0; i < MAX_EVENT_TYPES; ++i) { +if (t->is_event_type(i)) { + if (++eventProcessor.thread_group[i]._started == eventProcessor.thread_group[i]._count && + eventProcessor.thread_group[i]._afterStartCallback != nullptr) { +eventProcessor.thread_group[i]._afterStartCallback(); + } + break; +} + } +} diff --git a/proxy/http/HttpProxyServerMain.cc b/proxy/http/HttpProxyServerMain.cc index 48ea161..9c80490 100644 --- a/proxy/http/HttpProxyServerMain.cc +++ b/proxy/http/HttpProxyServerMain.cc @@ -308,9 +308,9 @@ init_accept_HttpProxyServer(int n_accept_threads) * start_HttpProxyServer(). */ void -init_HttpProxyServer(EThread *) +init_HttpProxyServer() { - if (eventProcessor.thread_group[ET_NET]._started == num_of_net_threads) { + if (eventProcessor.has_tg_started(ET_NET)) { std::unique_lock lock(proxyServerMutex); et_net_threads_ready = true; lock.unlock(); diff --git a/proxy/http/HttpProxyServerMain.h b/proxy/http/HttpProxyServerMain.h index 96c461a..1de9ced 100644 --- a/proxy/http/HttpProxyServerMain.h +++ b/proxy/http/HttpProxyServerMain.h @@ -38,7 +38,7 @@ void init_accept_HttpProxyServer(int n_accept_threads = 0); /** Checkes whether we can call start_HttpProxyServer(). */ -void init_HttpProxyServer(EThread *); +void init_HttpProxyServer(); /** Start the proxy server. The port data should have been created by @c prep_HttpProxyServer(). diff --git a/src/traffic_server/traffic_server.cc b/src/traffic_server/traffic_server.cc index 07d46ad..44e3d24 100644 --- a/src/traffic_server/traffic_server.cc +++ b/src/traffic_server/traffic_server.cc @@ -1813,10 +1813,10 @@ main(int /* argc ATS_UNUSED */, const char **argv) quic_NetProcessor.init(); #endif
[trafficserver] 04/04: tests: Adds autest for WebSocket mappings
This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git commit 3115d02c16286e4180dfca7261b0e65f4ac3039c Author: Randall Meyer AuthorDate: Mon Nov 4 18:08:35 2019 -0800 tests: Adds autest for WebSocket mappings (cherry picked from commit 5902d863869e7cc5147866d96bb8efe30b241668) --- .../remap/gold/remap-ws-upgrade-400.gold | 7 ++ tests/gold_tests/remap/gold/remap-ws-upgrade.gold | 11 tests/gold_tests/remap/remap_ws.test.py| 77 ++ 3 files changed, 95 insertions(+) diff --git a/tests/gold_tests/remap/gold/remap-ws-upgrade-400.gold b/tests/gold_tests/remap/gold/remap-ws-upgrade-400.gold new file mode 100644 index 000..a46a249 --- /dev/null +++ b/tests/gold_tests/remap/gold/remap-ws-upgrade-400.gold @@ -0,0 +1,7 @@ +`` +> GET /chat HTTP/1.1 +> Host: `` +> User-Agent: curl/`` +`` +< HTTP/1.1 400 Invalid Upgrade Request +`` diff --git a/tests/gold_tests/remap/gold/remap-ws-upgrade.gold b/tests/gold_tests/remap/gold/remap-ws-upgrade.gold new file mode 100644 index 000..317fee1 --- /dev/null +++ b/tests/gold_tests/remap/gold/remap-ws-upgrade.gold @@ -0,0 +1,11 @@ +`` +> GET /chat HTTP/1.1 +> Host: `` +> User-Agent: curl/`` +`` +< HTTP/1.1 101 Switching Protocols +< Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo= +< Date: `` +< Connection: Upgrade +< Upgrade: websocket +`` diff --git a/tests/gold_tests/remap/remap_ws.test.py b/tests/gold_tests/remap/remap_ws.test.py new file mode 100644 index 000..5379c4d --- /dev/null +++ b/tests/gold_tests/remap/remap_ws.test.py @@ -0,0 +1,77 @@ +''' +''' +# 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. + +Test.Summary = ''' +Test a basic remap of a websocket connections +''' + +Test.ContinueOnFail = True + +ts = Test.MakeATSProcess("ts", select_ports=False) +server = Test.MakeOriginServer("server") + +testName = "Test WebSocket Remaps" +request_header = {"headers": "GET /chat HTTP/1.1\r\nHost: www.example.com\r\nUpgrade: websocket\r\nConnection: Upgrade\r\n\r\n", + "body": None} +response_header = {"headers": "HTTP/1.1 101 OK\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n\r\n", + "body": None} +server.addResponse("sessionlog.json", request_header, response_header) + +ts.addSSLfile("ssl/server.pem") +ts.addSSLfile("ssl/server.key") + +ts.Disk.records_config.update({ +'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir), +'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir), +'proxy.config.http.server_ports': '{0} {1}:proto=http2;http:ssl'.format(ts.Variables.port, ts.Variables.ssl_port), +}) + +ts.Disk.remap_config.AddLines([ +'map ws://www.example.com:{1} ws://127.0.0.1:{0}'.format(server.Variables.Port, ts.Variables.port), +'map wss://www.example.com:{1} ws://127.0.0.1:{0}'.format(server.Variables.Port, ts.Variables.ssl_port) +]) + +ts.Disk.ssl_multicert_config.AddLine( +'dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key' +) + +# wss mapping +tr = Test.AddTestRun() +tr.Processes.Default.StartBefore(server) +tr.Processes.Default.StartBefore(Test.Processes.ts, ready=1) +tr.Processes.Default.Command = 'curl --max-time 2 -v -s -q -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==" -H "Sec-WebSocket-Version: 13" --http1.1 --resolve www.example.com:{0}:127.0.0.1 -k https://www.example.com:{0}/chat'.format(ts.Variables.ssl_port) +tr.Processes.Default.ReturnCode = 28 +tr.Processes.Default.Streams.stderr = "gold/remap-ws-upgrade.gold" +tr.StillRunningAfter = server +tr.StillRunningAfter = ts + +# ws mapping +tr = Test.AddTestRun() +tr.Processes.Default.Command = 'curl --max-time 2 -v -s -q -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==" -H "Sec-WebSocket-Version: 13" --http1.1 --resolve www.example.com:{0}:127.0.0.1 -k http://www.example.com:{0}/chat'.format(ts.Variables.port) +tr.Processes.Default.ReturnCode = 28 +tr.Processes.Default.Streams.stderr =
[trafficserver] branch 9.0.x updated (d6b2266 -> 3115d02)
This is an automated email from the ASF dual-hosted git repository. zwoop pushed a change to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git. from d6b2266 Explicit c:type: new 7e73a38 detect bogus jemalloc version new 97b55e7 Only decrement log_stat_log_files_open_stat when the file is closed. new ab5f56c Normalize loopback usage in session_match autest new 3115d02 tests: Adds autest for WebSocket mappings The 4 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: build/jemalloc.m4 | 13 +++- include/tscore/BaseLogFile.h | 2 +- include/tscore/JeAllocator.h | 3 + proxy/logging/LogFile.cc | 22 +-- src/tscore/BaseLogFile.cc | 20 -- .../remap/gold/remap-ws-upgrade-400.gold | 7 ++ tests/gold_tests/remap/gold/remap-ws-upgrade.gold | 11 tests/gold_tests/remap/remap_ws.test.py| 77 ++ .../session_sharing/session_match.test.py | 6 +- 9 files changed, 145 insertions(+), 16 deletions(-) create mode 100644 tests/gold_tests/remap/gold/remap-ws-upgrade-400.gold create mode 100644 tests/gold_tests/remap/gold/remap-ws-upgrade.gold create mode 100644 tests/gold_tests/remap/remap_ws.test.py
[trafficserver] branch 9.0.x updated: Explicit c:type:
This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/9.0.x by this push: new d6b2266 Explicit c:type: d6b2266 is described below commit d6b2266987e1f07665c761c064bbd9f0a04a20db Author: Leif Hedstrom AuthorDate: Fri Nov 8 13:53:35 2019 -0700 Explicit c:type: --- doc/release-notes/upgrading.en.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/release-notes/upgrading.en.rst b/doc/release-notes/upgrading.en.rst index d2d20a1..67c98e2 100644 --- a/doc/release-notes/upgrading.en.rst +++ b/doc/release-notes/upgrading.en.rst @@ -116,7 +116,7 @@ Renamed or modified APIs * ``TSVConnSSLConnectionGet()`` is renamed to be :c:func:`TSVConnSslConnectionGet` -* ``TSHttpTxnServerPush()`` now returns a :type:`TSReturnCode` +* ``TSHttpTxnServerPush()`` now returns a :c:type:`TSReturnCode` Cache
[trafficserver] branch master updated (f7afea3 -> 02c0e5b)
This is an automated email from the ASF dual-hosted git repository. duke8253 pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git. from f7afea3 Move websocket upgrade later in state machine add 02c0e5b detect bogus jemalloc version No new revisions were added by this update. Summary of changes: build/jemalloc.m4| 13 - include/tscore/JeAllocator.h | 3 +++ 2 files changed, 15 insertions(+), 1 deletion(-)
[trafficserver] branch master updated (4960789 -> f7afea3)
This is an automated email from the ASF dual-hosted git repository. rrm pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git. from 4960789 Change API to return a TSReturnCode code. add f7afea3 Move websocket upgrade later in state machine No new revisions were added by this update. Summary of changes: proxy/http/HttpTransact.cc | 22 +- 1 file changed, 13 insertions(+), 9 deletions(-)
[trafficserver] branch 9.0.x updated: Cleanup of release notes
This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/9.0.x by this push: new 2b47b69 Cleanup of release notes 2b47b69 is described below commit 2b47b699bd8cb231b956fef4acc7aa150424451f Author: Leif Hedstrom AuthorDate: Fri Nov 8 12:33:13 2019 -0700 Cleanup of release notes --- doc/release-notes/upgrading.en.rst | 4 ++-- doc/release-notes/whats-new.en.rst | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/release-notes/upgrading.en.rst b/doc/release-notes/upgrading.en.rst index 4f6ab7f..d2d20a1 100644 --- a/doc/release-notes/upgrading.en.rst +++ b/doc/release-notes/upgrading.en.rst @@ -114,9 +114,9 @@ Removed APIs Renamed or modified APIs -* ``TSVConnSSLConnectionGet()`` is renamed to be :c:func:`TSVConnSslConnectionGet`. +* ``TSVConnSSLConnectionGet()`` is renamed to be :c:func:`TSVConnSslConnectionGet` -* ``TSHttpTxnServerPush()`` now returns a :type:`TSReturnCode`. +* ``TSHttpTxnServerPush()`` now returns a :type:`TSReturnCode` Cache diff --git a/doc/release-notes/whats-new.en.rst b/doc/release-notes/whats-new.en.rst index a87b84c..93486a0 100644 --- a/doc/release-notes/whats-new.en.rst +++ b/doc/release-notes/whats-new.en.rst @@ -86,4 +86,4 @@ code, to be consistent with other similar APIs. The new prototype is: .. code-block:: c -TSReturnCode TSHttpTxnServerPush(TSHttpTxn txnp, const char *url, int url_len); +.. c:function:: TSReturnCode TSHttpTxnServerPush(TSHttpTxn txnp, const char *url, int url_len);
[trafficserver] 03/04: Change API to return a TSReturnCode code.
This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git commit db47ab74b62d4efe7f93bc546f08f878f9aaf167 Author: David Calavera AuthorDate: Tue Oct 29 09:30:24 2019 -0700 Change API to return a TSReturnCode code. Return a TS_ERROR when we cannot push the url to the promise table. Signed-off-by: David Calavera (cherry picked from commit 4960789e3306dca7968a74ebd4f9eba4d45e1d2a) --- .../api/functions/TSHttpTxnServerPush.en.rst | 5 ++- include/ts/ts.h| 2 +- proxy/http2/Http2ConnectionState.cc| 11 +++--- proxy/http2/Http2ConnectionState.h | 2 +- proxy/http2/Http2Stream.cc | 4 +-- proxy/http2/Http2Stream.h | 2 +- src/traffic_server/InkAPI.cc | 41 ++ 7 files changed, 41 insertions(+), 26 deletions(-) diff --git a/doc/developer-guide/api/functions/TSHttpTxnServerPush.en.rst b/doc/developer-guide/api/functions/TSHttpTxnServerPush.en.rst index be9ba1d..0710a07 100644 --- a/doc/developer-guide/api/functions/TSHttpTxnServerPush.en.rst +++ b/doc/developer-guide/api/functions/TSHttpTxnServerPush.en.rst @@ -28,7 +28,7 @@ Synopsis #include -.. function:: void TSHttpTxnServerPush(TSHttpTxn txnp, const char *url, int url_len) +.. function:: TSReturnCode TSHttpTxnServerPush(TSHttpTxn txnp, const char *url, int url_len) Description === @@ -40,6 +40,9 @@ is not disabled by the client. You can call this API without checking whether Server Push is available on the transaction and it does nothing if Server Push is not available. +This API returns an error if the URL to push is not valid, the client has Server Push disabled, +or there is an error creating the H/2 PUSH_PROMISE frame. + See Also diff --git a/include/ts/ts.h b/include/ts/ts.h index 17748d4..79ad523 100644 --- a/include/ts/ts.h +++ b/include/ts/ts.h @@ -2542,7 +2542,7 @@ tsapi TSIOBufferReader TSHttpTxnPostBufferReaderGet(TSHttpTxn txnp); * @param url the URL string to preload. * @param url_len the length of the URL string. */ -tsapi void TSHttpTxnServerPush(TSHttpTxn txnp, const char *url, int url_len); +tsapi TSReturnCode TSHttpTxnServerPush(TSHttpTxn txnp, const char *url, int url_len); #ifdef __cplusplus } diff --git a/proxy/http2/Http2ConnectionState.cc b/proxy/http2/Http2ConnectionState.cc index 7fb41ce..b23e0a5 100644 --- a/proxy/http2/Http2ConnectionState.cc +++ b/proxy/http2/Http2ConnectionState.cc @@ -1639,7 +1639,7 @@ Http2ConnectionState::send_headers_frame(Http2Stream *stream) ats_free(buf); } -void +bool Http2ConnectionState::send_push_promise_frame(Http2Stream *stream, URL , const MIMEField *accept_encoding) { HTTPHdr h1_hdr, h2_hdr; @@ -1651,7 +1651,7 @@ Http2ConnectionState::send_push_promise_frame(Http2Stream *stream, URL , con uint8_t flags = 0x00; if (client_settings.get(HTTP2_SETTINGS_ENABLE_PUSH) == 0) { -return; +return false; } Http2StreamDebug(ua_session, stream->get_id(), "Send PUSH_PROMISE frame"); @@ -1681,14 +1681,14 @@ Http2ConnectionState::send_push_promise_frame(Http2Stream *stream, URL , con buf = static_cast(ats_malloc(buf_len)); if (buf == nullptr) { h2_hdr.destroy(); -return; +return false; } Http2ErrorCode result = http2_encode_header_blocks(_hdr, buf, buf_len, _blocks_size, *(this->remote_hpack_handle), client_settings.get(HTTP2_SETTINGS_HEADER_TABLE_SIZE)); if (result != Http2ErrorCode::HTTP2_ERROR_NO_ERROR) { h2_hdr.destroy(); ats_free(buf); -return; +return false; } // Send a PUSH_PROMISE frame @@ -1736,7 +1736,7 @@ Http2ConnectionState::send_push_promise_frame(Http2Stream *stream, URL , con stream = this->create_stream(id, error); if (!stream) { h2_hdr.destroy(); -return; +return false; } SCOPED_MUTEX_LOCK(stream_lock, stream->mutex, this_ethread()); @@ -1759,6 +1759,7 @@ Http2ConnectionState::send_push_promise_frame(Http2Stream *stream, URL , con stream->send_request(*this); h2_hdr.destroy(); + return true; } void diff --git a/proxy/http2/Http2ConnectionState.h b/proxy/http2/Http2ConnectionState.h index 01c80cf..afd4385 100644 --- a/proxy/http2/Http2ConnectionState.h +++ b/proxy/http2/Http2ConnectionState.h @@ -247,7 +247,7 @@ public: void send_data_frames(Http2Stream *stream); Http2SendDataFrameResult send_a_data_frame(Http2Stream *stream, size_t _length); void send_headers_frame(Http2Stream *stream); - void send_push_promise_frame(Http2Stream *stream, URL , const MIMEField *accept_encoding); + bool send_push_promise_frame(Http2Stream *stream, URL , const MIMEField *accept_encoding); void send_rst_stream_frame(Http2StreamId id,
[trafficserver] 04/04: Cleanup, and added TSHttpTxnServerPush changes
This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git commit 95fab5ca7f29013a1f4880cdd90d1919af2ea51e Author: Leif Hedstrom AuthorDate: Fri Nov 8 12:19:29 2019 -0700 Cleanup, and added TSHttpTxnServerPush changes --- doc/release-notes/upgrading.en.rst | 61 ++ doc/release-notes/whats-new.en.rst | 34 ++--- 2 files changed, 60 insertions(+), 35 deletions(-) diff --git a/doc/release-notes/upgrading.en.rst b/doc/release-notes/upgrading.en.rst index f7a46b8..4f6ab7f 100644 --- a/doc/release-notes/upgrading.en.rst +++ b/doc/release-notes/upgrading.en.rst @@ -97,50 +97,61 @@ you to avoid using any of these: Deprecated or Removed Features -- -The following features, configurations and plugins are either removed or deprecated in this -version of ATS. Deprecated features should be avoided, with the expectation that they will be -removed in the next major release of ATS. +The following features, configurations and plugins are either removed +or deprecated in this version of ATS. Deprecated features should be +avoided, with the expectation that they will be removed in the next major +release of ATS. API Changes --- -Our APIs are guaranteed to be compatible within major versions, but we do make changes -for each new major release. +Our APIs are guaranteed to be compatible within major versions, but we do +make changes for each new major release. Removed APIs -* `TSHttpTxnRedirectRequest()` +* ``TSHttpTxnRedirectRequest()`` Renamed or modified APIs -* `TSVConnSSLConnectionGet` is renamed to be :c:func:`TSVConnSslConnectionGet`. +* ``TSVConnSSLConnectionGet()`` is renamed to be :c:func:`TSVConnSslConnectionGet`. -Cache -- -The cache in this releases of ATS is compatible with previous versions of ATS. You would not expect -to lose your cache, or have to reinitialize the cache when upgrading. +* ``TSHttpTxnServerPush()`` now returns a :type:`TSReturnCode`. -However, due to changes in how remap plugins are processed, your cache key *might* change. In versions -to v9.0.0, the first plugin in a remap rule would get the pristine URL, and subsequent plugins would -get the remapped URL. As of v9.0.0, **all** plugins now receive the remapped URL. If you are using -a plugin that modifies the cache key, e.g. :ref:`admin-plugins-cachekey`, if it was evaluated first -in a remap rule, the behavior (input) changes, and therefore, cache keys can change! -The old `v23` cache is no longer supported, which means caches created with ATS v2.x will no longer be -possible to load with ATS v9.0.0 or later. We feel that this is an unlikely scenario, but if you do -run into this, clearing the cache is required. +Cache +- +The cache in this releases of ATS is compatible with previous versions of ATS. +You would not expect to lose your cache, or have to reinitialize the cache when +upgrading. + +However, due to changes in how remap plugins are processed, your cache key +*might* change. In versions to v9.0.0, the first plugin in a remap rule would +get the pristine URL, and subsequent plugins would get the remapped URL. As of +v9.0.0, **all** plugins now receive the remapped URL. If you are using a +plugin that modifies the cache key, e.g. :ref:`admin-plugins-cachekey`, if it +was evaluated first in a remap rule, the behavior (input) changes, and +therefore, cache keys can change! + +The old ``v23`` cache is no longer supported, which means caches created with ATS +v2.x will no longer be possible to load with ATS v9.0.0 or later. We feel that +this is an unlikely scenario, but if you do run into this, clearing the cache +is required. Plugins --- -The following plugins have changes that might require you to change configurations. +The following plugins have changes that might require you to change +configurations. header_rewrite ~~ -* The `%{PATH}` directive is now removed, and instead you want to use `%{CLIENT-URL:PATH}`. This was - done to unify the behavior of these operators, rather than having this one-off directive. +* The `%{PATH}` directive is now removed, and instead you want to use + `%{CLIENT-URL:PATH}`. This was done to unify the behavior of these + operators, rather than having this one-off directive. Platform specific - -Solaris is no longer a supported platform, but the code is still there. However, it's unlikely to work, -and unless someone takes on ownership of this Platform, it will be removed from the source in ATS v10.0.0. -For more details, see issue #5553. +Solaris is no longer a supported platform, but the code is still there. +However, it's unlikely to work, and unless someone takes on ownership of this +Platform, it will be removed from the source in ATS v10.0.0. For more
[trafficserver] branch 9.0.x updated (ebc3ec1 -> 95fab5c)
This is an automated email from the ASF dual-hosted git repository. zwoop pushed a change to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git. from ebc3ec1 Revert "Change API to return a TSReturnCode code." new 197b3ac Move TSHttpTxnServerPush to the stable API interface. new 058ac2f Promote server_push_preload plugin. new db47ab7 Change API to return a TSReturnCode code. new 95fab5c Cleanup, and added TSHttpTxnServerPush changes The 4 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../api/functions/TSHttpTxnServerPush.en.rst | 11 ++-- doc/release-notes/upgrading.en.rst | 61 +- doc/release-notes/whats-new.en.rst | 34 example/plugins/c-api/server_push/server_push.c| 1 - include/ts/experimental.h | 2 - include/ts/ts.h| 9 plugins/Makefile.am| 2 +- plugins/experimental/server_push_preload/README.md | 3 -- .../server_push_preload/Makefile.inc | 10 ++-- plugins/server_push_preload/README.md | 17 ++ .../server_push_preload/server_push_preload.cc | 53 +++ proxy/http2/Http2ConnectionState.cc| 11 ++-- proxy/http2/Http2ConnectionState.h | 2 +- proxy/http2/Http2Stream.cc | 4 +- proxy/http2/Http2Stream.h | 2 +- src/traffic_server/InkAPI.cc | 41 +-- 16 files changed, 176 insertions(+), 87 deletions(-) delete mode 100644 plugins/experimental/server_push_preload/README.md rename plugins/{experimental => }/server_push_preload/Makefile.inc (71%) create mode 100644 plugins/server_push_preload/README.md rename plugins/{experimental => }/server_push_preload/server_push_preload.cc (74%)
[trafficserver] 02/04: Promote server_push_preload plugin.
This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git commit 058ac2f8de3e270c99e03e97c6c209c4f04b6734 Author: David Calavera AuthorDate: Wed Oct 9 21:57:47 2019 -0700 Promote server_push_preload plugin. Move this plugin out of experimental at the same time that the API is promoted. Signed-off-by: David Calavera (cherry picked from commit 11a7f1d1333876a3909c578fd12f92be1da1bed9) --- plugins/Makefile.am| 2 +- plugins/experimental/server_push_preload/README.md | 3 -- .../server_push_preload/Makefile.inc | 10 ++-- plugins/server_push_preload/README.md | 17 +++ .../server_push_preload/server_push_preload.cc | 53 ++ 5 files changed, 67 insertions(+), 18 deletions(-) diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 5af6494..ff92a3d 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -50,6 +50,7 @@ include regex_remap/Makefile.inc include regex_revalidate/Makefile.inc include remap_purge/Makefile.inc include s3_auth/Makefile.inc +include server_push_preload/Makefile.inc include stats_over_http/Makefile.inc include tcpinfo/Makefile.inc include xdebug/Makefile.inc @@ -72,7 +73,6 @@ include experimental/metalink/Makefile.inc include experimental/money_trace/Makefile.inc include experimental/mp4/Makefile.inc include experimental/remap_stats/Makefile.inc -include experimental/server_push_preload/Makefile.inc include experimental/slice/Makefile.inc include experimental/sslheaders/Makefile.inc include experimental/stream_editor/Makefile.inc diff --git a/plugins/experimental/server_push_preload/README.md b/plugins/experimental/server_push_preload/README.md deleted file mode 100644 index 296794c..000 --- a/plugins/experimental/server_push_preload/README.md +++ /dev/null @@ -1,3 +0,0 @@ -Parse origin response Link headers and use H2 Server Push to initiate push requests of assets that have the preload keyword. - -https://www.w3.org/TR/preload/ diff --git a/plugins/experimental/server_push_preload/Makefile.inc b/plugins/server_push_preload/Makefile.inc similarity index 71% rename from plugins/experimental/server_push_preload/Makefile.inc rename to plugins/server_push_preload/Makefile.inc index 5a04108..518d71c 100644 --- a/plugins/experimental/server_push_preload/Makefile.inc +++ b/plugins/server_push_preload/Makefile.inc @@ -14,14 +14,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -pkglib_LTLIBRARIES += experimental/server_push_preload/server_push_preload.la +pkglib_LTLIBRARIES += server_push_preload/server_push_preload.la -experimental_server_push_preload_server_push_preload_la_SOURCES = \ - experimental/server_push_preload/server_push_preload.cc +server_push_preload_server_push_preload_la_SOURCES = \ + server_push_preload/server_push_preload.cc -experimental_server_push_preload_server_push_preload_la_LDFLAGS = \ +server_push_preload_server_push_preload_la_LDFLAGS = \ $(AM_LDFLAGS) -experimental_server_push_preload_server_push_preload_la_LIBADD = \ +server_push_preload_server_push_preload_la_LIBADD = \ $(top_builddir)/src/tscpp/api/libtscppapi.la diff --git a/plugins/server_push_preload/README.md b/plugins/server_push_preload/README.md new file mode 100644 index 000..4079c89 --- /dev/null +++ b/plugins/server_push_preload/README.md @@ -0,0 +1,17 @@ +Parse origin response Link headers and use H2 Server Push to initiate push requests of assets that have the preload keyword. + +https://www.w3.org/TR/preload/ + +This plugin can be used as a global plugin or a remap plugin. + +To use it as a global plugin for all your remaps, add this line to your `plugins.config` file: + +``` +server_push_preload.so +``` + +To use it as a remap plugin add it to one of your remaps in the `remap.config` file: + +``` +map https://foo.cow.com/ https://bar.cow.com @plugin=server_push_preload.so +``` \ No newline at end of file diff --git a/plugins/experimental/server_push_preload/server_push_preload.cc b/plugins/server_push_preload/server_push_preload.cc similarity index 74% rename from plugins/experimental/server_push_preload/server_push_preload.cc rename to plugins/server_push_preload/server_push_preload.cc index def21cc..68c4410 100644 --- a/plugins/experimental/server_push_preload/server_push_preload.cc +++ b/plugins/server_push_preload/server_push_preload.cc @@ -26,9 +26,9 @@ #include #include #include -#include #include "tscpp/api/GlobalPlugin.h" -#include "tscpp/api/utils.h" +#include "tscpp/api/RemapPlugin.h" +#include "tscpp/api/TransactionPlugin.h" #define PLUGIN_NAME "server_push_preload" #define PRELOAD_PARAM "rel=preload" @@ -41,16 +41,16 @@ static regex linkRegexp("<([^>]+)>;(.+)"); namespace { -GlobalPlugin *plugin; -} +GlobalPlugin
[trafficserver] 01/04: Move TSHttpTxnServerPush to the stable API interface.
This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git commit 197b3ac58154794445c9909311080a18df4a2ef4 Author: David Calavera AuthorDate: Wed Oct 9 21:55:43 2019 -0700 Move TSHttpTxnServerPush to the stable API interface. Signed-off-by: David Calavera (cherry picked from commit b58fcfd326c9a1ecb3f9103da838fbf17eb2afb8) --- doc/developer-guide/api/functions/TSHttpTxnServerPush.en.rst | 8 +--- example/plugins/c-api/server_push/server_push.c | 1 - include/ts/experimental.h| 2 -- include/ts/ts.h | 9 + 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/developer-guide/api/functions/TSHttpTxnServerPush.en.rst b/doc/developer-guide/api/functions/TSHttpTxnServerPush.en.rst index 3e43cd2..be9ba1d 100644 --- a/doc/developer-guide/api/functions/TSHttpTxnServerPush.en.rst +++ b/doc/developer-guide/api/functions/TSHttpTxnServerPush.en.rst @@ -26,7 +26,7 @@ Synopsis .. code-block:: cpp -#include +#include .. function:: void TSHttpTxnServerPush(TSHttpTxn txnp, const char *url, int url_len) @@ -40,12 +40,6 @@ is not disabled by the client. You can call this API without checking whether Server Push is available on the transaction and it does nothing if Server Push is not available. - -Notes -= - -This API may be changed in the future version since it is experimental. - See Also diff --git a/example/plugins/c-api/server_push/server_push.c b/example/plugins/c-api/server_push/server_push.c index 41203f5..c921269 100644 --- a/example/plugins/c-api/server_push/server_push.c +++ b/example/plugins/c-api/server_push/server_push.c @@ -36,7 +36,6 @@ #include #include "ts/ts.h" -#include "ts/experimental.h" #include "tscore/ink_defs.h" const char *PLUGIN_NAME = "server_push"; diff --git a/include/ts/experimental.h b/include/ts/experimental.h index fa8e7ea..88b7a1d 100644 --- a/include/ts/experimental.h +++ b/include/ts/experimental.h @@ -223,8 +223,6 @@ tsapi TSReturnCode TSHttpTxnUpdateCachedObject(TSHttpTxn txnp); / tsapi int TSHttpTxnLookingUpTypeGet(TSHttpTxn txnp); -tsapi void TSHttpTxnServerPush(TSHttpTxn txnp, const char *url, int url_len); - /* ip addr parsing */ tsapi TSReturnCode TSIpStringToAddr(const char *str, size_t str_len, struct sockaddr *addr); diff --git a/include/ts/ts.h b/include/ts/ts.h index 60828f9..17748d4 100644 --- a/include/ts/ts.h +++ b/include/ts/ts.h @@ -2535,6 +2535,15 @@ tsapi TSReturnCode TSRemapToUrlGet(TSHttpTxn txnp, TSMLoc *urlLocp); */ tsapi TSIOBufferReader TSHttpTxnPostBufferReaderGet(TSHttpTxn txnp); +/** + * Initiate an HTTP/2 Server Push preload request. + * Use this api to register a URL that you want to preload with HTTP/2 Server Push. + * + * @param url the URL string to preload. + * @param url_len the length of the URL string. + */ +tsapi void TSHttpTxnServerPush(TSHttpTxn txnp, const char *url, int url_len); + #ifdef __cplusplus } #endif /* __cplusplus */
[trafficserver] branch 9.0.x updated: Revert "Change API to return a TSReturnCode code."
This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/9.0.x by this push: new ebc3ec1 Revert "Change API to return a TSReturnCode code." ebc3ec1 is described below commit ebc3ec1e5d73b3b1e383eea521eda91ec59ffe53 Author: Leif Hedstrom AuthorDate: Fri Nov 8 11:48:25 2019 -0700 Revert "Change API to return a TSReturnCode code." This reverts commit 469d4d8c05c28291d40e26af8cce2abc01fc03b7. --- .../api/functions/TSHttpTxnServerPush.en.rst | 9 +++-- include/ts/ts.h| 9 - proxy/http2/Http2ConnectionState.cc| 11 +++--- proxy/http2/Http2ConnectionState.h | 2 +- proxy/http2/Http2Stream.cc | 4 +-- proxy/http2/Http2Stream.h | 2 +- src/traffic_server/InkAPI.cc | 41 -- 7 files changed, 30 insertions(+), 48 deletions(-) diff --git a/doc/developer-guide/api/functions/TSHttpTxnServerPush.en.rst b/doc/developer-guide/api/functions/TSHttpTxnServerPush.en.rst index 299172f..3e43cd2 100644 --- a/doc/developer-guide/api/functions/TSHttpTxnServerPush.en.rst +++ b/doc/developer-guide/api/functions/TSHttpTxnServerPush.en.rst @@ -28,7 +28,7 @@ Synopsis #include -.. function:: TSReturnCode TSHttpTxnServerPush(TSHttpTxn txnp, const char *url, int url_len) +.. function:: void TSHttpTxnServerPush(TSHttpTxn txnp, const char *url, int url_len) Description === @@ -40,8 +40,11 @@ is not disabled by the client. You can call this API without checking whether Server Push is available on the transaction and it does nothing if Server Push is not available. -This API returns an error if the URL to push is not valid, the client has Server Push disabled, -or there is an error creating the H/2 PUSH_PROMISE frame. + +Notes += + +This API may be changed in the future version since it is experimental. See Also diff --git a/include/ts/ts.h b/include/ts/ts.h index 79ad523..60828f9 100644 --- a/include/ts/ts.h +++ b/include/ts/ts.h @@ -2535,15 +2535,6 @@ tsapi TSReturnCode TSRemapToUrlGet(TSHttpTxn txnp, TSMLoc *urlLocp); */ tsapi TSIOBufferReader TSHttpTxnPostBufferReaderGet(TSHttpTxn txnp); -/** - * Initiate an HTTP/2 Server Push preload request. - * Use this api to register a URL that you want to preload with HTTP/2 Server Push. - * - * @param url the URL string to preload. - * @param url_len the length of the URL string. - */ -tsapi TSReturnCode TSHttpTxnServerPush(TSHttpTxn txnp, const char *url, int url_len); - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/proxy/http2/Http2ConnectionState.cc b/proxy/http2/Http2ConnectionState.cc index b23e0a5..7fb41ce 100644 --- a/proxy/http2/Http2ConnectionState.cc +++ b/proxy/http2/Http2ConnectionState.cc @@ -1639,7 +1639,7 @@ Http2ConnectionState::send_headers_frame(Http2Stream *stream) ats_free(buf); } -bool +void Http2ConnectionState::send_push_promise_frame(Http2Stream *stream, URL , const MIMEField *accept_encoding) { HTTPHdr h1_hdr, h2_hdr; @@ -1651,7 +1651,7 @@ Http2ConnectionState::send_push_promise_frame(Http2Stream *stream, URL , con uint8_t flags = 0x00; if (client_settings.get(HTTP2_SETTINGS_ENABLE_PUSH) == 0) { -return false; +return; } Http2StreamDebug(ua_session, stream->get_id(), "Send PUSH_PROMISE frame"); @@ -1681,14 +1681,14 @@ Http2ConnectionState::send_push_promise_frame(Http2Stream *stream, URL , con buf = static_cast(ats_malloc(buf_len)); if (buf == nullptr) { h2_hdr.destroy(); -return false; +return; } Http2ErrorCode result = http2_encode_header_blocks(_hdr, buf, buf_len, _blocks_size, *(this->remote_hpack_handle), client_settings.get(HTTP2_SETTINGS_HEADER_TABLE_SIZE)); if (result != Http2ErrorCode::HTTP2_ERROR_NO_ERROR) { h2_hdr.destroy(); ats_free(buf); -return false; +return; } // Send a PUSH_PROMISE frame @@ -1736,7 +1736,7 @@ Http2ConnectionState::send_push_promise_frame(Http2Stream *stream, URL , con stream = this->create_stream(id, error); if (!stream) { h2_hdr.destroy(); -return false; +return; } SCOPED_MUTEX_LOCK(stream_lock, stream->mutex, this_ethread()); @@ -1759,7 +1759,6 @@ Http2ConnectionState::send_push_promise_frame(Http2Stream *stream, URL , con stream->send_request(*this); h2_hdr.destroy(); - return true; } void diff --git a/proxy/http2/Http2ConnectionState.h b/proxy/http2/Http2ConnectionState.h index afd4385..01c80cf 100644 --- a/proxy/http2/Http2ConnectionState.h +++ b/proxy/http2/Http2ConnectionState.h @@ -247,7 +247,7 @@ public: void send_data_frames(Http2Stream *stream); Http2SendDataFrameResult
[trafficserver] branch 9.0.x updated: Change API to return a TSReturnCode code.
This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/9.0.x by this push: new 469d4d8 Change API to return a TSReturnCode code. 469d4d8 is described below commit 469d4d8c05c28291d40e26af8cce2abc01fc03b7 Author: David Calavera AuthorDate: Tue Oct 29 09:30:24 2019 -0700 Change API to return a TSReturnCode code. Return a TS_ERROR when we cannot push the url to the promise table. Signed-off-by: David Calavera (cherry picked from commit 4960789e3306dca7968a74ebd4f9eba4d45e1d2a) Conflicts: doc/developer-guide/api/functions/TSHttpTxnServerPush.en.rst include/ts/ts.h --- .../api/functions/TSHttpTxnServerPush.en.rst | 9 ++--- include/ts/ts.h| 9 + proxy/http2/Http2ConnectionState.cc| 11 +++--- proxy/http2/Http2ConnectionState.h | 2 +- proxy/http2/Http2Stream.cc | 4 +-- proxy/http2/Http2Stream.h | 2 +- src/traffic_server/InkAPI.cc | 41 ++ 7 files changed, 48 insertions(+), 30 deletions(-) diff --git a/doc/developer-guide/api/functions/TSHttpTxnServerPush.en.rst b/doc/developer-guide/api/functions/TSHttpTxnServerPush.en.rst index 3e43cd2..299172f 100644 --- a/doc/developer-guide/api/functions/TSHttpTxnServerPush.en.rst +++ b/doc/developer-guide/api/functions/TSHttpTxnServerPush.en.rst @@ -28,7 +28,7 @@ Synopsis #include -.. function:: void TSHttpTxnServerPush(TSHttpTxn txnp, const char *url, int url_len) +.. function:: TSReturnCode TSHttpTxnServerPush(TSHttpTxn txnp, const char *url, int url_len) Description === @@ -40,11 +40,8 @@ is not disabled by the client. You can call this API without checking whether Server Push is available on the transaction and it does nothing if Server Push is not available. - -Notes -= - -This API may be changed in the future version since it is experimental. +This API returns an error if the URL to push is not valid, the client has Server Push disabled, +or there is an error creating the H/2 PUSH_PROMISE frame. See Also diff --git a/include/ts/ts.h b/include/ts/ts.h index 60828f9..79ad523 100644 --- a/include/ts/ts.h +++ b/include/ts/ts.h @@ -2535,6 +2535,15 @@ tsapi TSReturnCode TSRemapToUrlGet(TSHttpTxn txnp, TSMLoc *urlLocp); */ tsapi TSIOBufferReader TSHttpTxnPostBufferReaderGet(TSHttpTxn txnp); +/** + * Initiate an HTTP/2 Server Push preload request. + * Use this api to register a URL that you want to preload with HTTP/2 Server Push. + * + * @param url the URL string to preload. + * @param url_len the length of the URL string. + */ +tsapi TSReturnCode TSHttpTxnServerPush(TSHttpTxn txnp, const char *url, int url_len); + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/proxy/http2/Http2ConnectionState.cc b/proxy/http2/Http2ConnectionState.cc index 7fb41ce..b23e0a5 100644 --- a/proxy/http2/Http2ConnectionState.cc +++ b/proxy/http2/Http2ConnectionState.cc @@ -1639,7 +1639,7 @@ Http2ConnectionState::send_headers_frame(Http2Stream *stream) ats_free(buf); } -void +bool Http2ConnectionState::send_push_promise_frame(Http2Stream *stream, URL , const MIMEField *accept_encoding) { HTTPHdr h1_hdr, h2_hdr; @@ -1651,7 +1651,7 @@ Http2ConnectionState::send_push_promise_frame(Http2Stream *stream, URL , con uint8_t flags = 0x00; if (client_settings.get(HTTP2_SETTINGS_ENABLE_PUSH) == 0) { -return; +return false; } Http2StreamDebug(ua_session, stream->get_id(), "Send PUSH_PROMISE frame"); @@ -1681,14 +1681,14 @@ Http2ConnectionState::send_push_promise_frame(Http2Stream *stream, URL , con buf = static_cast(ats_malloc(buf_len)); if (buf == nullptr) { h2_hdr.destroy(); -return; +return false; } Http2ErrorCode result = http2_encode_header_blocks(_hdr, buf, buf_len, _blocks_size, *(this->remote_hpack_handle), client_settings.get(HTTP2_SETTINGS_HEADER_TABLE_SIZE)); if (result != Http2ErrorCode::HTTP2_ERROR_NO_ERROR) { h2_hdr.destroy(); ats_free(buf); -return; +return false; } // Send a PUSH_PROMISE frame @@ -1736,7 +1736,7 @@ Http2ConnectionState::send_push_promise_frame(Http2Stream *stream, URL , con stream = this->create_stream(id, error); if (!stream) { h2_hdr.destroy(); -return; +return false; } SCOPED_MUTEX_LOCK(stream_lock, stream->mutex, this_ethread()); @@ -1759,6 +1759,7 @@ Http2ConnectionState::send_push_promise_frame(Http2Stream *stream, URL , con stream->send_request(*this); h2_hdr.destroy(); + return true; } void diff --git a/proxy/http2/Http2ConnectionState.h b/proxy/http2/Http2ConnectionState.h index
[trafficserver] branch master updated (0db18c7 -> 4960789)
This is an automated email from the ASF dual-hosted git repository. bcall pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git. from 0db18c7 Only decrement log_stat_log_files_open_stat when the file is closed. add b58fcfd Move TSHttpTxnServerPush to the stable API interface. add 11a7f1d Promote server_push_preload plugin. add 4960789 Change API to return a TSReturnCode code. No new revisions were added by this update. Summary of changes: .../api/functions/TSHttpTxnServerPush.en.rst | 11 ++--- example/plugins/c-api/server_push/server_push.c| 1 - include/ts/experimental.h | 2 - include/ts/ts.h| 9 plugins/Makefile.am| 2 +- plugins/experimental/server_push_preload/README.md | 3 -- .../server_push_preload/Makefile.inc | 10 ++-- plugins/server_push_preload/README.md | 17 +++ .../server_push_preload/server_push_preload.cc | 53 ++ proxy/http2/Http2ConnectionState.cc| 11 +++-- proxy/http2/Http2ConnectionState.h | 2 +- proxy/http2/Http2Stream.cc | 4 +- proxy/http2/Http2Stream.h | 2 +- src/traffic_server/InkAPI.cc | 41 +++-- 14 files changed, 116 insertions(+), 52 deletions(-) delete mode 100644 plugins/experimental/server_push_preload/README.md rename plugins/{experimental => }/server_push_preload/Makefile.inc (71%) create mode 100644 plugins/server_push_preload/README.md rename plugins/{experimental => }/server_push_preload/server_push_preload.cc (74%)
[trafficserver] branch master updated (07e6e2d -> 0db18c7)
This is an automated email from the ASF dual-hosted git repository. bcall pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git. from 07e6e2d Normalize loopback usage in session_match autest add 0db18c7 Only decrement log_stat_log_files_open_stat when the file is closed. No new revisions were added by this update. Summary of changes: include/tscore/BaseLogFile.h | 2 +- proxy/logging/LogFile.cc | 22 +++--- src/tscore/BaseLogFile.cc| 20 3 files changed, 32 insertions(+), 12 deletions(-)
[trafficserver] branch master updated (5902d86 -> 07e6e2d)
This is an automated email from the ASF dual-hosted git repository. rrm pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git. from 5902d86 tests: Adds autest for WebSocket mappings add 07e6e2d Normalize loopback usage in session_match autest No new revisions were added by this update. Summary of changes: tests/gold_tests/session_sharing/session_match.test.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
[trafficserver] branch master updated (98b0aea -> 5902d86)
This is an automated email from the ASF dual-hosted git repository. rrm pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git. from 98b0aea Fix building Catch on macOS add 5902d86 tests: Adds autest for WebSocket mappings No new revisions were added by this update. Summary of changes: .../remap/gold/remap-ws-upgrade-400.gold | 7 ++ tests/gold_tests/remap/gold/remap-ws-upgrade.gold | 11 tests/gold_tests/remap/remap_ws.test.py| 77 ++ 3 files changed, 95 insertions(+) create mode 100644 tests/gold_tests/remap/gold/remap-ws-upgrade-400.gold create mode 100644 tests/gold_tests/remap/gold/remap-ws-upgrade.gold create mode 100644 tests/gold_tests/remap/remap_ws.test.py
[trafficserver] branch 9.0.x updated: Fix building Catch on macOS
This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/9.0.x by this push: new 7013aff Fix building Catch on macOS 7013aff is described below commit 7013affe0f08b20586c8b66e406da572b4ff11f2 Author: Masaori Koshiba AuthorDate: Fri Nov 8 14:16:22 2019 +0900 Fix building Catch on macOS (cherry picked from commit 98b0aeaa122ac4c2711e955003c474071c8f2086) --- tests/include/catch.hpp | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/include/catch.hpp b/tests/include/catch.hpp index d7bb037..bc24a42 100644 --- a/tests/include/catch.hpp +++ b/tests/include/catch.hpp @@ -7093,6 +7093,10 @@ namespace Catch { # include # include # include + +// ink_autoconf.h is required to use HAVE_SYS_SYSCTL_H +#include "ink_autoconf.h" + #if defined(darwin) || defined(freebsd) #ifdef HAVE_SYS_SYSCTL_H # include @@ -13051,4 +13055,3 @@ using Catch::Detail::Approx; // end catch_reenable_warnings.h // end catch.hpp #endif // TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED -
[trafficserver] branch master updated (9e91efb -> 98b0aea)
This is an automated email from the ASF dual-hosted git repository. zwoop pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git. from 9e91efb Reverse debug specific check. add 98b0aea Fix building Catch on macOS No new revisions were added by this update. Summary of changes: tests/include/catch.hpp | 5 - 1 file changed, 4 insertions(+), 1 deletion(-)