diff --git a/configs/strategies.yaml.default b/configs/strategies.yaml.default index c2f348247a6..6ef420d9019 100644 --- a/configs/strategies.yaml.default +++ b/configs/strategies.yaml.default @@ -7,30 +7,30 @@ # The purpose of this file is to specify the strategies available for # use in locating upstream caches for use to satisfy requests # -# This is a YAML formatted file to define hosts, groups of hosts and next hop strategies that +# This is a YAML formatted file to define hosts, groups of hosts and next hop strategies that # may be used by remap # # There are three top-level YAML name spaces: 'hosts', 'groups', and 'strategies'. -# 'hosts' is a YAML list of host's definitions and is used when defining 'groups' YAML -# references are supported. -# 'groups' is a YAML list that aggregates a group of hosts together and serves as the -# equivalent to the rings used in parent.config. You may define upto five groups in a +# 'hosts' is a YAML list of host's definitions and is used when defining 'groups' YAML +# references are supported. +# 'groups' is a YAML list that aggregates a group of hosts together and serves as the +# equivalent to the rings used in parent.config. You may define upto five groups in a # config, see MAX_GROUPS. -# 'strategies' is a YAML list of strategy definitions. +# 'strategies' is a YAML list of strategy definitions. # -# Files may be broken up into several different files. The main file loaded by the Next Hop -# Strategy factory is this file, strategies.yaml. You may move the 'hosts' and 'groups' -# definitions into separate files and then include them in this file using: +# Files may be broken up into several different files. The main file loaded by the Next Hop +# Strategy factory is this file, strategies.yaml. You may move the 'hosts' and 'groups' +# definitions into separate files and then include them in this file using: # # '#include path_to_hosts_and_groups_file' # -# It is even possible to put individual strategies into separate file. The Next Hop -# strategy factory concatenates all included files together in a single YAML document at +# It is even possible to put individual strategies into separate file. The Next Hop +# strategy factory concatenates all included files together in a single YAML document at # each point where it sees an '#include file_name'. When using this feature you just need to # ensure that the final concatenation is a valid YAML document with 'hosts', 'groups' # and 'strategies' in this given order. # -# +# # This example YAML document shows a complete definiton in a single strategies.yaml # file. There are other example unit test files in the source tree showing examples of # using '#include' and different formats available for use, proxy/http/remap/unit-tests/ @@ -40,7 +40,7 @@ # # # hosts: -# - &p1 +# - &p1 # host: p1.foo.com # hash_string: slsklslsk # optional hash string that replaces the hostname in consistent hashing. # protocol: @@ -59,14 +59,14 @@ # - scheme: https # port: 443 # health_check_url: https://192.168.1.2:443 -# - &s1 +# - &s1 # host: s1.foo.com # hash_string: slsklslsk # optional hash string that replaces the hostname in consistent hashing. # protocol: # - scheme: http # port: 80 # health_check_url: http://192.168.2.1:80 -# - scheme: https +# - scheme: https # port: 443 # health_check_url: https://192.168.2.1:443 # - &s2 @@ -98,8 +98,8 @@ # groups: # groups of hosts, these groups are used as rings in consistent hash and arrays of host groups for round_robin. # - *g1 # - *g2 -# scheme: http -# failover: +# scheme: http +# failover: # max_simple_retries: 2 # default is 1, indicates the maximum number of simple retries for the listed response codes. # ring_mode: exhaust_ring # enumerated as exhaust_ring or alternate_ring # #1) in 'exhaust_ring' mode all the servers in a ring are exhausted before failing over to secondary ring @@ -113,20 +113,20 @@ # - active # - strategy: 'mid-tier-south' # policy: latched -# hash_key: uri -# go_direct: false +# hash_key: uri +# go_direct: false # parent_is_proxy: false # next hop hosts are origin servers # groups: # - *g1 # - *g2 -# scheme: https -# failover: -# max_simple_retries: 2 +# scheme: https +# failover: +# max_simple_retries: 2 # ring_mode: alternate_ring # response_codes: # - 404 # - 502 # - 503 -# health_check: +# health_check: # - passive # - active diff --git a/doc/admin-guide/configuration/proxy-protocol.en.rst b/doc/admin-guide/configuration/proxy-protocol.en.rst index c857de9bf31..64a0bc2fe2c 100644 --- a/doc/admin-guide/configuration/proxy-protocol.en.rst +++ b/doc/admin-guide/configuration/proxy-protocol.en.rst @@ -31,7 +31,7 @@ TLS connections. .. note:: - The current version only supports transforming client IP from PROXY Version 1 + The current version only supports transforming client IP from PROXY Version 1 header to the Forwarded: header. In the current implementation, the client IP address in the PROXY protocol header diff --git a/doc/admin-guide/files/sni.yaml.en.rst b/doc/admin-guide/files/sni.yaml.en.rst index 8556b7ac433..09e9076987e 100644 --- a/doc/admin-guide/files/sni.yaml.en.rst +++ b/doc/admin-guide/files/sni.yaml.en.rst @@ -97,7 +97,7 @@ client_key The file containing the client private key that corres |TS| tries to use a private key in client_cert. Otherwise, :ts:cv:`proxy.config.ssl.client.private_key.filename` is used. -http2 Indicates whether the H2 protocol should be added to or removed from the +http2 Indicates whether the H2 protocol should be added to or removed from the protocol negotiation list. The valid values are :code:`on` or :code:`off`. disable_h2 Deprecated for the more general h2 setting. Setting disable_h2 diff --git a/doc/admin-guide/files/strategies.yaml.en.rst b/doc/admin-guide/files/strategies.yaml.en.rst index 5eaae3792d3..d501dd27ff5 100644 --- a/doc/admin-guide/files/strategies.yaml.en.rst +++ b/doc/admin-guide/files/strategies.yaml.en.rst @@ -27,7 +27,7 @@ strategies.yaml :maxdepth: 2 The :file:`strategies.yaml` file identifies the next hop proxies used in an -cache hierarchy and the algorithms used to select the next hop proxy. Use +cache hierarchy and the algorithms used to select the next hop proxy. Use this file to perform the following configuration: - Set up next hop cache hierarchies, with multiple parents and parent @@ -50,7 +50,7 @@ and **strategies**. These name spaces may be in separate files. When in separa **#include filename** in the `strategies.yaml` so that they are concatenated by the strategy factory into a single YAML document in the order, **hosts**, **groups**, and the **strategies**. -Alternatively if the config parameter `proxy.config.url_remap.strategies.filename` refers to +Alternatively if the config parameter `proxy.config.url_remap.strategies.filename` refers to a directory, the NextHopStrategyFactory will alphanumerically concatenate all files in that directory that end in `.yaml` by name into a single document stream for parsing. The final document must be a vaild `YAML` document with single `strategies` node and optionally a single `hosts` and `groups` node. Any **#include filename** strings are ignored when reading `.yaml` files in a directory. Hosts definitions @@ -59,14 +59,14 @@ Hosts definitions The **hosts** definitions is a **YAML** list of hosts. This list is **optional** but if not used, the **groups** list **must** include complete defintions for hosts. See the **group** examples below. -In the example below, **hosts** is a **YAML** list of hosts. Each host entry uses a **YAML** anchor, +In the example below, **hosts** is a **YAML** list of hosts. Each host entry uses a **YAML** anchor, **&p1** and **&p2** that may be used elsewhere in the **YAML** document to refer to hosts **p1** and **p2**. - **host**: the host value is a hostname string - **protocol**: a list of schemes, ports, and health check urls for the host. -- **healthcheck**: health check information with the **url** used to check +- **healthcheck**: health check information with the **url** used to check the hosts health by some external health check agent. - + Example:: hosts: @@ -85,7 +85,7 @@ Example:: - scheme: http port: 80 health_check_url: http://192.168.1.2:80 - + Groups definitions ================== @@ -111,7 +111,7 @@ Example using **YAML** anchors and references:: weight: 0.5 - <<: *p4 weight: 1.5 - + Explicitly defined Example, no **YAML** referenences:: groups: @@ -119,20 +119,20 @@ Explicitly defined Example, no **YAML** referenences:: - p1 host: p1.foo.com protocol: - - scheme: http + - scheme: http port: 80 health_check_url: http://192.168.1.1:80 - - scheme: https + - scheme: https port: 443 health_check_url: https://192.168.1.1:443 weight: 0.5 - p2 host: p2.foo.com protocol: - - scheme: http + - scheme: http port: 80 health_check_url: http://192.168.1.2:80 - - scheme: https + - scheme: https port: 443 health_check_url: https://192.168.1.2:443 weight: 0.5 @@ -140,23 +140,23 @@ Explicitly defined Example, no **YAML** referenences:: - p3 host: p3.foo.com protocol: - - scheme: http + - scheme: http port: 80 health_check_url: http://192.168.1.3:80 - - scheme: https + - scheme: https port: 443 health_check_url: https://192.168.1.3:443 weight: 0.5 - p4 host: p4.foo.com protocol: - - scheme: http + - scheme: http port: 80 health_check_url: http://192.168.1.4:80 - - scheme: https + - scheme: https port: 443 health_check_url: https://192.168.1.4:443 - weight: 0.5 + weight: 0.5 Strategies defintions ===================== @@ -171,7 +171,7 @@ Each **strategy** in the list may using the following parameters:: #. **rr_ip**: round robin selection using the modulus of the client IP #. **rr_strict**: strict round robin over the list of hosts in the primary group. - #. **first_live**: always selects the first host in the primary group. Other hosts are selected when the first host fails. + #. **first_live**: always selects the first host in the primary group. Other hosts are selected when the first host fails. #. **latched**: Same as **first_live** but primary selection sticks to whatever host was used by a previous transaction. #. **consistent_hash**: hosts are selected using a **hash_key**. @@ -184,7 +184,7 @@ Each **strategy** in the list may using the following parameters:: #. **path+fragment**: Same as **path** but adds the fragement portion of the URL. #. **cache_key**: Uses the hash key from the **cachekey** plugin. defaults to **path** if the **cachekey** plugin is not configured on the **remap**. #. **url**: Creates a hash from the entire request url. - + - **go_direct** - A boolean value indicating whether a transaction may bypass proxies and go direct to the origin. Defaults to **true** - **parent_is_proxy**: A boolean value which indicates if the groups of hosts are proxy caches or origins. **true** (default) means all the hosts used in the reamp are trafficserver caches. **false** means the hosts are origins that the next hop strategies may use for load balancing and/or failover. - **scheme** Indicates which scheme the strategy supports, *http* or *https* @@ -236,4 +236,3 @@ Example: - 503 health_check: - passive - diff --git a/doc/admin-guide/logging/formatting.en.rst b/doc/admin-guide/logging/formatting.en.rst index 43ec49c27d9..fd6a3966be5 100644 --- a/doc/admin-guide/logging/formatting.en.rst +++ b/doc/admin-guide/logging/formatting.en.rst @@ -205,9 +205,9 @@ ctid Client Request Client Transaction ID, a non-negative number for a transact which is different for all currently-active transactions on the same client connection. For client HTTP/2 transactions, this value is the stream ID for the transaction. -ctpw Client Request Client Transaction Priority Weight, the priority weight for the +ctpw Client Request Client Transaction Priority Weight, the priority weight for the underlying HTTP/2 protocol. -ctpd Client Request Client Transaction Priority Dependence, the transaction ID that +ctpd Client Request Client Transaction Priority Dependence, the transaction ID that the current transaction depends on for HTTP/2 priority logic. ===== ============== ================================================================== diff --git a/doc/admin-guide/plugins/ja3_fingerprint.en.rst b/doc/admin-guide/plugins/ja3_fingerprint.en.rst index 931b9366674..62bf31608df 100644 --- a/doc/admin-guide/plugins/ja3_fingerprint.en.rst +++ b/doc/admin-guide/plugins/ja3_fingerprint.en.rst @@ -36,7 +36,7 @@ effective way to detect malicious clients even when superficial details are modi JA3 is available `here `__. The calculated JA3 fingerprints are then appended to upstream request in the field ``X-JA3-Sig`` -(to be processed at upstream). If multiple duplicates exist for the field name, it will append to the last +(to be processed at upstream). If multiple duplicates exist for the field name, it will append to the last occurrence; if none exists, it will add such a field to the headers. The signatures can also be logged locally. Plugin Configuration @@ -72,4 +72,3 @@ API changes with regard to opaque structures. There is a potential issue with very old TLS clients which can cause a crash in the plugin. This is due to a `bug in OpenSSL `__ which should be fixed in a future release. - diff --git a/doc/admin-guide/plugins/slice.en.rst b/doc/admin-guide/plugins/slice.en.rst index e848312acfb..dca442d557b 100644 --- a/doc/admin-guide/plugins/slice.en.rst +++ b/doc/admin-guide/plugins/slice.en.rst @@ -5,9 +5,9 @@ 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 diff --git a/doc/admin-guide/plugins/ssl_session_reuse.en.rst b/doc/admin-guide/plugins/ssl_session_reuse.en.rst index c253ff9c7d9..c0e48aebe6b 100644 --- a/doc/admin-guide/plugins/ssl_session_reuse.en.rst +++ b/doc/admin-guide/plugins/ssl_session_reuse.en.rst @@ -22,7 +22,7 @@ SSL Session Reuse Plugin ************************ -This plugin coordinates session state data between ATS instances running in a group. This should +This plugin coordinates session state data between ATS instances running in a group. This should improve TLS session reuse (both ticket and ID based) for a set of machines fronted by some form of layer 4 connection load balancer. @@ -31,14 +31,14 @@ How It Works The plugin coordinates TLS session reuse for both Session ID based resumption and ticket based resumption. For Session ID base resumption in uses the ATS SSL Session Cache for the local store of TLS sessions. It uses -Redis to communication new sessions with its peers. When a new session is seen by an ATS instances it +Redis to communication new sessions with its peers. When a new session is seen by an ATS instances it publishes an encrypted copy of the session state to the local Redis channel. When a new session is received on the Redis channel, the plugin stores that session state into its local ATS SSL session cache. Once the -session state is in the local ATS SSL session cache it is available to the openssl library for future TLS +session state is in the local ATS SSL session cache it is available to the openssl library for future TLS handshakes. For the ticket based session resumption, the plugin implements logic to decide on a Session Ticket Encryption Key (STEK) -master. The master will periodically create a new STEK key and use the Redis channel to publish the new STEK key +master. The master will periodically create a new STEK key and use the Redis channel to publish the new STEK key to the other ATS boxes in the group. When the plugin starts up, it will publish a Redis message requesting the master to resend the STEK key. The plugin uses the TSSslTicketKeyUpdate call to update ATS with the last two STEK's it has received. @@ -48,7 +48,7 @@ reuse must have access to that preshared key. Building ======== -This plugin uses Redis for communication. The hiredis client development library must be installed +This plugin uses Redis for communication. The hiredis client development library must be installed for this plugin to build. It can be installed in the standard system location or the install location can be specified by the --with-hiredis argument to configure. @@ -59,8 +59,8 @@ Deploying ========= The SSL Session Reuse plugin relies on Redis for communication. To deploy build your own redis server or use a standard rpm -package. It must be installed on at least one box in the ATS group. We have it installed on two boxes in a failover -scenario. The SSL Session Reuse configuration file describes how to communicate with the redis servers. +package. It must be installed on at least one box in the ATS group. We have it installed on two boxes in a failover +scenario. The SSL Session Reuse configuration file describes how to communicate with the redis servers. * :ts:cv:`proxy.config.ssl.session_cache` should be set to 2 to enable the ATS implementation of session cache * :ts:cv:`proxy.config.ssl.session_cache.size` and :ts:cv:`proxy.config.ssl.session_cache.num_buckets` may need to be adjusted to ensure good hash table performance for your workload. For example, we needed to increase the number of buckets to avoid long hash chains. @@ -70,7 +70,7 @@ scenario. The SSL Session Reuse configuration file describes how to communicate Config File =========== -SSL Session Reuse is a global plugin. Its configuration file is given as a argument to the plugin. +SSL Session Reuse is a global plugin. Its configuration file is given as a argument to the plugin. * redis.RedisEndpoints - This is a comma separated list of Redis servers to connect to. The description of the redis server may include a port * redis.RedisConnectTimeout - Timeout on the redis connect attempt in milliseconds. @@ -91,4 +91,3 @@ Example Config File =================== .. literalinclude:: ../../../plugins/experimental/ssl_session_reuse/example_config.config - diff --git a/doc/developer-guide/api/functions/TSContCall.en.rst b/doc/developer-guide/api/functions/TSContCall.en.rst index a5dcd569733..d567fd47421 100644 --- a/doc/developer-guide/api/functions/TSContCall.en.rst +++ b/doc/developer-guide/api/functions/TSContCall.en.rst @@ -51,11 +51,11 @@ If there is a mutex associated with :arg:`contp`, :func:`TSContCall` assumes tha value returned by the handler in :arg:`contp`. If :arg:`contp` has a mutex, the plugin must acquire the lock on the mutex for :arg:`contp` before calling -:func:`TSContCall`. See :func:`TSContMutexGet` and :func:`TSMutexLockTry` for mechanisms for doing this. +:func:`TSContCall`. See :func:`TSContMutexGet` and :func:`TSMutexLockTry` for mechanisms for doing this. The most common case is the code called by :func:`TSContCall` must complete before further code is executed at the call site. An alternative approach to handling the locking directly would be to split the call site -into two continuations, one of which is signalled (possibly via :func:`TSContCall`) from the original +into two continuations, one of which is signalled (possibly via :func:`TSContCall`) from the original :func:`TSContCall` target. Note mutexes returned by :func:`TSMutexCreate` are recursive mutexes, therefore if the lock is @@ -69,4 +69,3 @@ shareable so that the same mutex can be used for multiple continuations.:: In this example case, :code:`cont1` can assume the lock for :code:`cont2` is held. This should be considered carefully because for the same reason any thread protection between the continuations is removed. This works well for tightly coupled continuations that always operate in a fixed sequence. - diff --git a/doc/developer-guide/api/functions/TSVConnReenable.en.rst b/doc/developer-guide/api/functions/TSVConnReenable.en.rst index fd691128a3a..e77bb038fc3 100644 --- a/doc/developer-guide/api/functions/TSVConnReenable.en.rst +++ b/doc/developer-guide/api/functions/TSVConnReenable.en.rst @@ -68,8 +68,6 @@ An extended version of TSVConnEnable that allows the plugin to return a status t the core logic. If all goes well this is TS_EVENT_CONTINUE. However, if the plugin wants to stop the processing it can set the event to TS_EVENT_ERROR. -For example, in the case of the TS_SSL_VERIFY_SERVER_HOOK, the plugin make decide the -origin certificate is bad. By calling TSVonnReenable with TS_EVENT_ERROR, the +For example, in the case of the TS_SSL_VERIFY_SERVER_HOOK, the plugin make decide the +origin certificate is bad. By calling TSVonnReenable with TS_EVENT_ERROR, the certificate check will error and the TLS handshake will fail. - - diff --git a/doc/developer-guide/api/functions/TSVConnSslVerifyCTXGet.en.rst b/doc/developer-guide/api/functions/TSVConnSslVerifyCTXGet.en.rst index f84e4b44507..5a90ba24a27 100644 --- a/doc/developer-guide/api/functions/TSVConnSslVerifyCTXGet.en.rst +++ b/doc/developer-guide/api/functions/TSVConnSslVerifyCTXGet.en.rst @@ -33,7 +33,7 @@ Synopsis Description =========== -Get the TSSslVerifyCTX object that corresponds to the certificates being verified for the SSL connection +Get the TSSslVerifyCTX object that corresponds to the certificates being verified for the SSL connection corresponding to :arg:`svc`. This value is only meaningful during the peer certificate verification callbacks, specifically during callbacks diff --git a/doc/developer-guide/layout/runroot.en.rst b/doc/developer-guide/layout/runroot.en.rst index 7b9c049d169..07c73bf9391 100644 --- a/doc/developer-guide/layout/runroot.en.rst +++ b/doc/developer-guide/layout/runroot.en.rst @@ -49,7 +49,7 @@ Work flow: #. Look in current directory and look up N (default 4) directories for ``runroot.yaml`` #. Look in executable directory and look up N directories for ``runroot.yaml``. #. ``$TS_ROOT`` Environment Variable -#. Compiler defaults in layout class +#. Compiler defaults in layout class Right now, the following programs are integrated with the runroot logic: **traffic_server**, **traffic_manager**, **traffic_ctl**, **traffic_layout**, **traffic_crashlog**, **traffic_logcat**, **traffic_logstat**. diff --git a/doc/developer-guide/plugins/remap-plugins.en.rst b/doc/developer-guide/plugins/remap-plugins.en.rst index b70a8ee17ab..bd4addfe779 100644 --- a/doc/developer-guide/plugins/remap-plugins.en.rst +++ b/doc/developer-guide/plugins/remap-plugins.en.rst @@ -107,7 +107,7 @@ notifications like :func:`TSRemapPreConfigReload` and :func:`TSRemapPostConfigRe Instead of trying to foresee the needs or the expectations of each use-case, a more "open-ended" and straight-forward design was chosen for the configuration reload notifications. -The notifications are broadcast to all loaded plugins at the moments before and after +The notifications are broadcast to all loaded plugins at the moments before and after the reload attempt, regardless of whether a plugin is part of the new configuration or not. :func:`TSRemapPreConfigReload` is called *before* the parsing of a new remap configuration starts diff --git a/example/plugins/lua-api/connect_geoip.lua b/example/plugins/lua-api/connect_geoip.lua index a1af55baa44..1277e205763 100644 --- a/example/plugins/lua-api/connect_geoip.lua +++ b/example/plugins/lua-api/connect_geoip.lua @@ -22,9 +22,9 @@ -- Setup Instructions -- 1) install GeoIP - 1.6.12 -- 2) install GeoIP legacy country database - https://dev.maxmind.com/geoip/legacy/install/country/ --- 3) install luajit-geoip (https://github.com/leafo/luajit-geoip) --- or just copy geoip/init.lua from the repo to /usr/local/share/lua/5.1/geoip/init.lua --- 4) You may need to make change so luajit-geoip does ffi.load() on /usr/local/lib/libGeoIP.so +-- 3) install luajit-geoip (https://github.com/leafo/luajit-geoip) +-- or just copy geoip/init.lua from the repo to /usr/local/share/lua/5.1/geoip/init.lua +-- 4) You may need to make change so luajit-geoip does ffi.load() on /usr/local/lib/libGeoIP.so ts.add_package_path('/usr/local/share/lua/5.1/?.lua') diff --git a/example/plugins/lua-api/connect_redis.lua b/example/plugins/lua-api/connect_redis.lua index 8d34f15c2f9..dddb2af3dce 100644 --- a/example/plugins/lua-api/connect_redis.lua +++ b/example/plugins/lua-api/connect_redis.lua @@ -14,10 +14,9 @@ -- See the License for the specific language governing permissions and -- limitations under the License. - -- This example depends on "redis-lua" 2.0.4 - https://github.com/nrk/redis-lua -- And redis-lua depends on LuaSocket v3.0-rc1 - https://github.com/diegonehab/luasocket --- It illustrates how to connect to redis and retrieve a key value. +-- It illustrates how to connect to redis and retrieve a key value. -- It can be used in plugin.config with the lua plugin. -- unix domain socket has better performance and so we should set up local redis to use that @@ -31,19 +30,19 @@ -- 6. sudo -u nobody redis-server /etc/redis/redis.conf -- 7. sudo -u nobody redis-cli -s /var/run/redis/redis.sock set mykey helloworld -ts.add_package_cpath('/usr/local/lib/lua/5.1/socket/?.so;/usr/local/lib/lua/5.1/mime/?.so') -ts.add_package_path('/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/socket/?.lua') +ts.add_package_cpath("/usr/local/lib/lua/5.1/socket/?.so;/usr/local/lib/lua/5.1/mime/?.so") +ts.add_package_path("/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/socket/?.lua") -local redis = require 'redis' +local redis = require "redis" -- not connecting to redis default port -- local client = redis.connect('127.0.0.1', 6379) -- connecting to unix domain socket -local client = redis.connect('unix:///var/run/redis/redis.sock') +local client = redis.connect("unix:///var/run/redis/redis.sock") function do_global_send_response() local response = client:ping() - local value = client:get('mykey') - ts.client_response.header['X-Redis-Ping'] = tostring(response) - ts.client_response.header['X-Redis-MyKey'] = value + local value = client:get("mykey") + ts.client_response.header["X-Redis-Ping"] = tostring(response) + ts.client_response.header["X-Redis-MyKey"] = value end diff --git a/example/plugins/lua-api/sorted_query_params.lua b/example/plugins/lua-api/sorted_query_params.lua index e4a45e955b3..ec6f24748bc 100644 --- a/example/plugins/lua-api/sorted_query_params.lua +++ b/example/plugins/lua-api/sorted_query_params.lua @@ -14,40 +14,44 @@ -- See the License for the specific language governing permissions and -- limitations under the License. - -- This script is for sorting query parameters on incoming requests before doing cache lookup -- so we can get better cache hit ratio -- It can be used in remap.config for a remap rule with the lua plugin. -function pairsByKeys (t, f) +function pairsByKeys(t, f) local a = {} - for n in pairs(t) do table.insert(a, n) end + for n in pairs(t) do + table.insert(a, n) + end table.sort(a, f) - local i = 0 -- iterator variable - local iter = function () -- iterator function + local i = 0 -- iterator variable + local iter = function() + -- iterator function i = i + 1 - if a[i] == nil then return nil - else return a[i], t[a[i]] + if a[i] == nil then + return nil + else + return a[i], t[a[i]] end end return iter end function do_remap() - t = {} - s = ts.client_request.get_uri_args() or '' + t = {} + s = ts.client_request.get_uri_args() or "" -- Original String i = 1 for k, v in string.gmatch(s, "([0-9a-zA-Z-_]+)=([0-9a-zA-Z-_]+)") do t[k] = v end - output = '' + output = "" for name, line in pairsByKeys(t) do - output = output .. '&' .. name .. '=' .. line + output = output .. "&" .. name .. "=" .. line end output = string.sub(output, 2) - -- Modified String + -- Modified String ts.client_request.set_uri_args(output) return 0 -end +end diff --git a/example/plugins/lua-api/uncompress.lua b/example/plugins/lua-api/uncompress.lua index c80ff228ab8..788e5c985e3 100644 --- a/example/plugins/lua-api/uncompress.lua +++ b/example/plugins/lua-api/uncompress.lua @@ -14,39 +14,38 @@ -- See the License for the specific language governing permissions and -- limitations under the License. - --- This example depends on "lua-zlib". +-- This example depends on "lua-zlib". -- It uncompresses a gzipped content body and prints it out in debug log. -- It can be added in remap.config for a remap rule with the lua plugin. -- Setup Instructions -- 1) install lua-zlib - v1.2 -ts.add_package_cpath('/usr/lib/lua/5.1/?.so') +ts.add_package_cpath("/usr/lib/lua/5.1/?.so") local zlib = require "zlib" function upper_transform(data, eos) - ts.ctx['text'] = ts.ctx['text'] .. data - - if eos ==1 then - local stream = zlib.inflate() - local inflated, eof, bytes_in, bytes_out = stream(ts.ctx['text']) - if (eof == true) then - ts.debug("==== eof ====") - end - ts.debug("==== bytes_in: "..(bytes_in or '')) - ts.debug("==== bytes_out:"..(bytes_out or '')) - ts.debug("==== uncompressed data begin ===") - ts.debug(inflated or 'no data') - ts.debug("==== uncompressed data end ===") - end + ts.ctx["text"] = ts.ctx["text"] .. data - return string.upper(data), eos + if eos == 1 then + local stream = zlib.inflate() + local inflated, eof, bytes_in, bytes_out = stream(ts.ctx["text"]) + if (eof == true) then + ts.debug("==== eof ====") + end + ts.debug("==== bytes_in: " .. (bytes_in or "")) + ts.debug("==== bytes_out:" .. (bytes_out or "")) + ts.debug("==== uncompressed data begin ===") + ts.debug(inflated or "no data") + ts.debug("==== uncompressed data end ===") + end + + return string.upper(data), eos end function do_remap() - ts.hook(TS_LUA_RESPONSE_TRANSFORM, upper_transform) - ts.ctx['text'] = '' - return 0 + ts.hook(TS_LUA_RESPONSE_TRANSFORM, upper_transform) + ts.ctx["text"] = "" + return 0 end diff --git a/lib/yamlcpp/test/create-emitter-tests.py b/lib/yamlcpp/test/create-emitter-tests.py index 7295544f1be..e202522cee9 100644 --- a/lib/yamlcpp/test/create-emitter-tests.py +++ b/lib/yamlcpp/test/create-emitter-tests.py @@ -133,7 +133,6 @@ def expand(template): for car in expand(template[:1]): for cdr in expand(template[1:]): yield car + cdr - def gen_events(): for template in gen_templates(): @@ -153,7 +152,7 @@ class Writer(object): def __init__(self, out): self.out = out self.indent = 0 - + def writeln(self, s): self.out.write('%s%s\n' % (' ' * self.indent, s)) @@ -166,14 +165,14 @@ def __init__(self, writer, name, indent): def __enter__(self): self.writer.writeln('%s {' % self.name) self.writer.indent += self.indent - + def __exit__(self, type, value, traceback): self.writer.indent -= self.indent self.writer.writeln('}') def create_emitter_tests(out): out = Writer(out) - + includes = [ 'handler_test.h', 'yaml-cpp/yaml.h', diff --git a/lib/yamlcpp/test/integration/error_messages_test.cpp b/lib/yamlcpp/test/integration/error_messages_test.cpp index 64ab6b9e5e8..ea921ce364e 100644 --- a/lib/yamlcpp/test/integration/error_messages_test.cpp +++ b/lib/yamlcpp/test/integration/error_messages_test.cpp @@ -6,7 +6,7 @@ ASSERT_THROW(statement, exception_type); \ try { \ statement; \ - } catch (const exception_type& e) { \ + } catch (const exception_type &e) { \ EXPECT_EQ(e.msg, message); \ } @@ -14,20 +14,20 @@ namespace YAML { namespace { TEST(ErrorMessageTest, BadSubscriptErrorMessage) { - const char *example_yaml = "first:\n" - " second: 1\n" - " third: 2\n"; + const char *example_yaml = + "first:\n" + " second: 1\n" + " third: 2\n"; Node doc = Load(example_yaml); // Test that printable key is part of error message EXPECT_THROW_EXCEPTION(YAML::BadSubscript, doc["first"]["second"]["fourth"], "operator[] call on a scalar (key: \"fourth\")"); - + EXPECT_THROW_EXCEPTION(YAML::BadSubscript, doc["first"]["second"][37], "operator[] call on a scalar (key: \"37\")"); - // Non-printable key is not included in error message EXPECT_THROW_EXCEPTION(YAML::BadSubscript, doc["first"]["second"][std::vector()], @@ -38,24 +38,25 @@ TEST(ErrorMessageTest, BadSubscriptErrorMessage) { } TEST(ErrorMessageTest, Ex9_1_InvalidNodeErrorMessage) { - const char *example_yaml = "first:\n" - " second: 1\n" - " third: 2\n"; + const char *example_yaml = + "first:\n" + " second: 1\n" + " third: 2\n"; const Node doc = Load(example_yaml); // Test that printable key is part of error message EXPECT_THROW_EXCEPTION(YAML::InvalidNode, doc["first"]["fourth"].as(), "invalid node; first invalid key: \"fourth\""); - + EXPECT_THROW_EXCEPTION(YAML::InvalidNode, doc["first"][37].as(), "invalid node; first invalid key: \"37\""); - + // Non-printable key is not included in error message EXPECT_THROW_EXCEPTION(YAML::InvalidNode, doc["first"][std::vector()].as(), "invalid node; this may result from using a map " "iterator as a sequence iterator, or vice-versa"); } -} -} +} // namespace +} // namespace YAML diff --git a/lib/yamlcpp/test/integration/load_node_test.cpp b/lib/yamlcpp/test/integration/load_node_test.cpp index 4f4f28e8e20..8ed3b0c39d5 100644 --- a/lib/yamlcpp/test/integration/load_node_test.cpp +++ b/lib/yamlcpp/test/integration/load_node_test.cpp @@ -58,11 +58,20 @@ TEST(LoadNodeTest, Binary) { TEST(LoadNodeTest, BinaryWithWhitespaces) { Node node = Load( "binaryText: !binary |-\n" - " TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieS\n" - " B0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIG\n" - " x1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbi\n" - " B0aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZG\n" - " dlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS\n" + " " + "TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieS\n" + " " + "B0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIG" + "\n" + " " + "x1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbi" + "\n" + " " + "B0aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZG" + "\n" + " " + "dlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS" + "\n" " 4K"); EXPECT_EQ(Binary(reinterpret_cast( "Man is distinguished, not only by his reason, " @@ -228,8 +237,8 @@ struct ParserExceptionTestCase { TEST(NodeTest, IncompleteJson) { std::vector tests = { {"JSON map without value", "{\"access\"", ErrorMsg::END_OF_MAP_FLOW}, - {"JSON map with colon but no value", "{\"access\":", - ErrorMsg::END_OF_MAP_FLOW}, + {"JSON map with colon but no value", + "{\"access\":", ErrorMsg::END_OF_MAP_FLOW}, {"JSON map with unclosed value quote", "{\"access\":\"", ErrorMsg::END_OF_MAP_FLOW}, {"JSON map without end brace", "{\"access\":\"abc\"", @@ -250,11 +259,11 @@ TEST(NodeTest, LoadTildeAsNull) { Node node = Load("~"); ASSERT_TRUE(node.IsNull()); } - + TEST(NodeTest, LoadTagWithParenthesis) { - Node node = Load("!Complex(Tag) foo"); - EXPECT_EQ(node.Tag(), "!Complex(Tag)"); - EXPECT_EQ(node.as(), "foo"); + Node node = Load("!Complex(Tag) foo"); + EXPECT_EQ(node.Tag(), "!Complex(Tag)"); + EXPECT_EQ(node.as(), "foo"); } } // namespace diff --git a/plugins/experimental/fastcgi/src/Readme b/plugins/experimental/fastcgi/src/Readme index f9771460749..24cb8c6085e 100644 --- a/plugins/experimental/fastcgi/src/Readme +++ b/plugins/experimental/fastcgi/src/Readme @@ -14,11 +14,11 @@ Extract the file and set the flag "C_Cpp.clang_format_path" to file path. 2. Adding pre-commit hook : Copy the file path/to/trafficserver/tools/git/pre-commit under .git/hook/ directory. This will does the formatting every time does a commit. - + ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- -Build and Install cmd = +Build and Install cmd = #building CPP ats_fastcgi.so @@ -40,7 +40,7 @@ tsxs -o ats_fastcgi.so \ # (for the case where the sudo context doesn't know about tsxs) mtsxs=$(which tsxs) -sudo $mtsxs -o ats_fastcgi.so -i +sudo $mtsxs -o ats_fastcgi.so -i ``` OR Build and install using Makefile utility: @@ -50,7 +50,7 @@ OR Build and install using Makefile utility: Afterwords command, $> make && sudo -E make install For example: - make ATS_SRC=/home/oschaaf/code/apache/trafficserver ATS_EXEC=/usr/local/ CPPFLAGS=-std=c++11 + make ATS_SRC=/home/oschaaf/code/apache/trafficserver ATS_EXEC=/usr/local/ CPPFLAGS=-std=c++11 ------------------------------------------------------------------------------ @@ -60,8 +60,8 @@ ATS (Apache Traffic Server) FastCGI Plugin This plugin collapses connections with identical CacheUrl/EffectiveUrl. If an entry was created for a given CacheUrl/EffectiveUrl in our global hashTable, -successive GET requests with identical CacheUrl/EffectiveUrl will be blocked in -POST_REMAP hook until the hash entry was removed. (POST_REMAP hook is the last +successive GET requests with identical CacheUrl/EffectiveUrl will be blocked in +POST_REMAP hook until the hash entry was removed. (POST_REMAP hook is the last hook before 'cache lookup') For requests going into 'cache lookup' stage, @@ -75,7 +75,7 @@ For requests going into 'read server response header' stage, if proxy.config.cache.enable_read_while_writer is enabled, hash entry will be removed at earliest possible time. else - hash entry will be removed in TXN_CLOSE hook. + hash entry will be removed in TXN_CLOSE hook. if response is not public cacheable, we will update hash entry with a special value to let successive requests pass collapsed check, this special hash entry will be removed in TXN_CLOSE hook if value of keep_pass_record_time is 0, @@ -122,7 +122,7 @@ Meaning of these configurable options: fcgi server port number in string format e.g 60000 root_directory root directory path from where fcgi server will server resources/web_contents - min_connections + min_connections min number of connections plugin will open to the php server max_connections max number of connections plugin will make to the php server @@ -145,7 +145,7 @@ Meaning of these configurable options: and require the C++11 standard. a. download libfcgi-dev package :i.e libfcgi-dev_2.4.0-8.4+b1_arm64.deb from https://packages.debian.org/sid/arm64/libfcgi-dev/download - + b. download php7.0-cli php7.0-fpm with : sudo apt-get install php7.0-cli php7.0-fpm @@ -166,4 +166,3 @@ Using Profiler: #if ATS_FCGI_PROFILER ats_plugin::ProfileTaker profile_taker(&profiler, "functinName", (std::size_t)&plugin, "B"); #endif - \ No newline at end of file diff --git a/plugins/experimental/slice/Makefile.tsxs b/plugins/experimental/slice/Makefile.tsxs index 0992d8cb27e..8e9449c3e75 100644 --- a/plugins/experimental/slice/Makefile.tsxs +++ b/plugins/experimental/slice/Makefile.tsxs @@ -62,5 +62,5 @@ TSCXXFLAGS = $(shell tsxs -q CXXFLAGS) slice_test: slice_test.cc ContentRange.cc Range.cc $(TSCXX) -o $@ $^ $(TSCXXFLAGS) -I$(TSINCLUDE) -DUNITTEST -clean: +clean: rm -fv *.lo *.so diff --git a/plugins/experimental/slice/README.md b/plugins/experimental/slice/README.md index 31746ffda45..6ae1399037a 100644 --- a/plugins/experimental/slice/README.md +++ b/plugins/experimental/slice/README.md @@ -119,7 +119,7 @@ Current error types logged: With slice error logs disabled these type errors can typically be detected by observing crc=ERR_READ_ERROR and pscl=0 in normal logs. -At the current time only single range requests or the first part of a +At the current time only single range requests or the first part of a multi part range request of the forms: ``` Range: bytes=- diff --git a/plugins/experimental/uri_signing/Makefile.inc b/plugins/experimental/uri_signing/Makefile.inc index 864d2b48b38..7632c492467 100644 --- a/plugins/experimental/uri_signing/Makefile.inc +++ b/plugins/experimental/uri_signing/Makefile.inc @@ -30,7 +30,7 @@ experimental_uri_signing_uri_signing_la_LIBADD = @LIBJANSSON@ @LIBCJOSE@ @LIBPCR check_PROGRAMS += experimental/uri_signing/test_uri_signing -experimental_uri_signing_test_uri_signing_CPPFLAGS = $(AM_CPPFLAGS) -I$(abs_top_srcdir)/tests/include -DURI_SIGNING_UNIT_TEST +experimental_uri_signing_test_uri_signing_CPPFLAGS = $(AM_CPPFLAGS) -I$(abs_top_srcdir)/tests/include -DURI_SIGNING_UNIT_TEST experimental_uri_signing_test_uri_signing_LDADD = @LIBJANSSON@ @LIBCJOSE@ @LIBPCRE@ -lm -lcrypto experimental_uri_signing_test_uri_signing_SOURCES = \ experimental/uri_signing/unit_tests/uri_signing_test.cc \ diff --git a/plugins/experimental/uri_signing/README.md b/plugins/experimental/uri_signing/README.md index 398b9869958..02d7c20f4a2 100644 --- a/plugins/experimental/uri_signing/README.md +++ b/plugins/experimental/uri_signing/README.md @@ -79,13 +79,13 @@ a path. ### More Configuration Options **Strip Token** -When the strip_token parameter is set to true, the plugin removes the -token from both the url that is sent upstream to the origin and the url that +When the strip_token parameter is set to true, the plugin removes the +token from both the url that is sent upstream to the origin and the url that is used as the cache key. The strip_token parameter defaults to false and should be set by only one issuer. **ID** The id field takes a string indicating the identification of the entity processing the request. -This is used in aud claim checks to ensure that the receiver is the intended audience of a +This is used in aud claim checks to ensure that the receiver is the intended audience of a tokenized request. The id parameter can only be set by one issuer. Example: @@ -140,7 +140,7 @@ These claims are not supported. If they are present, the token will not validate - `cdnicrit` - `cdniip` -In addition, the `cdniuc` container of `hash` is +In addition, the `cdniuc` container of `hash` is **not supported**. ### Token Renewal diff --git a/plugins/experimental/uri_signing/python_signer/README.md b/plugins/experimental/uri_signing/python_signer/README.md index baa9b229d58..daa41bb8f2c 100644 --- a/plugins/experimental/uri_signing/python_signer/README.md +++ b/plugins/experimental/uri_signing/python_signer/README.md @@ -1,31 +1,31 @@ Python URI Signer ================== -Given a configuration file and a URI, this python script will generate a signed URI according to the URI signing protocol outlined [here](https://tools.ietf.org/html/draft-ietf-cdni-uri-signing-16): +Given a configuration file and a URI, this python script will generate a signed URI according to the URI signing protocol outlined [here](https://tools.ietf.org/html/draft-ietf-cdni-uri-signing-16): The script takes a config file and a uri as command line arguments. It picks one of the keys located in the json file at random -and embeds a valid JWT as a query string parameter into the uri and prints this new signed URI to standard out. +and embeds a valid JWT as a query string parameter into the uri and prints this new signed URI to standard out. -** Disclaimer ** -Please note that this script is provided as a very simple example of how to implement a signer should not be considered production ready. +** Disclaimer ** +Please note that this script is provided as a very simple example of how to implement a signer should not be considered production ready. Requirements ------- +------ [python-jose](https://pypi.org/project/python-jose/) library must be installed (pip install python-jose). Config ------- +------ The config file should be a JSON object that contains the following: - `iss`: A string representing the issuer of the token - `token_lifetime`: The lifetime of the token in seconds. Expiry of the token is calculated as now + token_lifetime - `aud`: A string representing the intended audience of the token. - - `cdnistt`: Boolean value which if set to true uses cookie signed token transport, allowing the validator of the token to + - `cdnistt`: Boolean value which if set to true uses cookie signed token transport, allowing the validator of the token to to issue subsequent tokens via set cookie headers. - - `cdniets`: Must be set if using cdnistt. Provides means of setting Expiry Times when generating subsequent tokens. It denotes - the number of seconds to be added to the time at which the JWT is verified that gives the value of the Expiry Time claim of the + - `cdniets`: Must be set if using cdnistt. Provides means of setting Expiry Times when generating subsequent tokens. It denotes + the number of seconds to be added to the time at which the JWT is verified that gives the value of the Expiry Time claim of the next signed JWT. - `keys`: A list of json objects, each one representing a key. Each key should have the following attributes: - `alg`: The Cryptographic algorithm to be used with the key. diff --git a/proxy/http/remap/Makefile.am b/proxy/http/remap/Makefile.am index afa0de04684..89be4da59a8 100644 --- a/proxy/http/remap/Makefile.am +++ b/proxy/http/remap/Makefile.am @@ -139,7 +139,7 @@ test_NextHopStrategyFactory_LDADD = \ $(top_builddir)/mgmt/libmgmt_p.la \ $(top_builddir)/iocore/utils/libinkutils.a \ @YAMLCPP_LIBS@ \ - @HWLOC_LIBS@ + @HWLOC_LIBS@ test_NextHopStrategyFactory_LDFLAGS = $(AM_LDFLAGS) -L$(top_builddir)/src/tscore/.libs -ltscore @@ -168,7 +168,7 @@ test_NextHopRoundRobin_LDADD = \ $(top_builddir)/mgmt/libmgmt_p.la \ $(top_builddir)/iocore/utils/libinkutils.a \ @YAMLCPP_LIBS@ \ - @HWLOC_LIBS@ + @HWLOC_LIBS@ test_NextHopRoundRobin_LDFLAGS = $(AM_LDFLAGS) -L$(top_builddir)/src/tscore/.libs -ltscore @@ -197,7 +197,7 @@ test_NextHopConsistentHash_LDADD = \ $(top_builddir)/mgmt/libmgmt_p.la \ $(top_builddir)/iocore/utils/libinkutils.a \ @YAMLCPP_LIBS@ \ - @HWLOC_LIBS@ + @HWLOC_LIBS@ test_NextHopConsistentHash_LDFLAGS = $(AM_LDFLAGS) -L$(top_builddir)/src/tscore/.libs -ltscore diff --git a/proxy/http/remap/unit-tests/combined.yaml b/proxy/http/remap/unit-tests/combined.yaml index 9033dda0f2b..de4d347a3c8 100644 --- a/proxy/http/remap/unit-tests/combined.yaml +++ b/proxy/http/remap/unit-tests/combined.yaml @@ -22,18 +22,18 @@ # # @section details Details # -# +# # unit test combined hosts and strategies, combined.yaml example # hosts: - &p1 # shorthand name of host object, with an "anchor name" - host: p1.foo.com # name or IP of host + host: p1.foo.com # name or IP of host hash_string: slsklslsk # optional hash string that replaces the hostname in consistent hashing. protocol: - scheme: http port: 80 health_check_url: http://192.168.1.1:80 - - scheme: https + - scheme: https port: 443 health_check_url: https://192.168.1.1:443 - &p2 @@ -42,7 +42,7 @@ hosts: - scheme: http port: 80 health_check_url: http://192.168.1.2:80 - - scheme: https + - scheme: https port: 443 health_check_url: https://192.168.1.2:443 - &s1 @@ -75,19 +75,20 @@ groups: - <<: *s2 weight: 1.0 strategies: - - strategy: 'mid-tier-north' + - strategy: "mid-tier-north" policy: rr_ip # Selection strategy policy: Enum of 'consistent_hash' or 'first_live' or 'rr_strict' or 'rr_ip' or 'latched' go_direct: true # transactions may routed directly to the origin true/false default is true. - parent_is_proxy: false # next hop hosts are origin servers when set to 'false', defaults to true and indicates next hop hosts are ats cache's. + parent_is_proxy: false # next hop hosts are origin servers when set to 'false', defaults to true and indicates next hop hosts are ats cache's. groups: # groups of hosts, these groups are used as rings in consistent hash and arrays of host groups for round_robin. - *g1 - *g2 scheme: http # enumerated, 'http' or 'https'. by default uses the remapped scheme - failover: + failover: max_simple_retries: 2 # default is 1, indicates the maximum number of simple retries for the listed response codes. - ring_mode: exhaust_ring # enumerated as exhaust_ring or alternate_ring - #1) in 'exhaust_ring' mode all the servers in a ring are exhausted before failing over to secondary ring - #2) in 'alternate_ring' mode causes the failover to another server in secondary ring. + ring_mode: + exhaust_ring # enumerated as exhaust_ring or alternate_ring + #1) in 'exhaust_ring' mode all the servers in a ring are exhausted before failing over to secondary ring + #2) in 'alternate_ring' mode causes the failover to another server in secondary ring. response_codes: # defines the responses codes for failover in exhaust_ring mode - 404 - 502 @@ -95,76 +96,75 @@ strategies: health_check: # specifies the list of healthchecks that should be considered for failover. A list of enums: 'passive' or 'active' - passive - active - - strategy: 'mid-tier-south' + - strategy: "mid-tier-south" policy: latched - go_direct: false - parent_is_proxy: false # next hop hosts are origin servers + go_direct: false + parent_is_proxy: false # next hop hosts are origin servers ignore_self_detect: false groups: - *g1 - *g2 - scheme: http - failover: - max_simple_retries: 2 + scheme: http + failover: + max_simple_retries: 2 ring_mode: alternate_ring response_codes: - 404 - 502 - 503 - health_check: + health_check: - passive - active - - strategy: 'mid-tier-east' + - strategy: "mid-tier-east" policy: first_live - go_direct: false - parent_is_proxy: false # next hop hosts are origin servers + go_direct: false + parent_is_proxy: false # next hop hosts are origin servers ignore_self_detect: true groups: - *g1 - *g2 - scheme: https - failover: - max_simple_retries: 2 - ring_mode: alternate_ring + scheme: https + failover: + max_simple_retries: 2 + ring_mode: alternate_ring response_codes: - 404 - 502 - 503 health_check: - passive - - strategy: 'mid-tier-west' + - strategy: "mid-tier-west" policy: rr_strict - go_direct: true - parent_is_proxy: false # next hop hosts are origin servers + go_direct: true + parent_is_proxy: false # next hop hosts are origin servers groups: - *g1 - *g2 - scheme: https - failover: - max_simple_retries: 2 - ring_mode: exhaust_ring + scheme: https + failover: + max_simple_retries: 2 + ring_mode: exhaust_ring response_codes: - 404 - 502 - 503 - health_check: + health_check: - active - - strategy: 'mid-tier-midwest' + - strategy: "mid-tier-midwest" policy: consistent_hash - hash_key: cache_key - go_direct: true - parent_is_proxy: false # next hop hosts are origin servers + hash_key: cache_key + go_direct: true + parent_is_proxy: false # next hop hosts are origin servers groups: - *g1 - *g2 - scheme: https - failover: - max_simple_retries: 2 - ring_mode: exhaust_ring + scheme: https + failover: + max_simple_retries: 2 + ring_mode: exhaust_ring response_codes: - 404 - 502 - 503 - health_check: + health_check: - active - diff --git a/proxy/http/remap/unit-tests/consistent-hash-tests.yaml b/proxy/http/remap/unit-tests/consistent-hash-tests.yaml index 6c8b5f27230..5bb1d9bfeea 100644 --- a/proxy/http/remap/unit-tests/consistent-hash-tests.yaml +++ b/proxy/http/remap/unit-tests/consistent-hash-tests.yaml @@ -22,14 +22,14 @@ # # @section details Details # -# +# # unit testing strategies for NextHopConsistentHash. # strategies: - - strategy: 'consistent-hash-1' - policy: consistent_hash - hash_key: path - groups: + - strategy: "consistent-hash-1" + policy: consistent_hash + hash_key: path + groups: - &g1 - host: p1.foo.com protocol: @@ -87,21 +87,21 @@ strategies: port: 443 health_check_url: https://192.168.3.2:443 weight: 1.0 - scheme: http - failover: - ring_mode: exhaust_ring - response_codes: + scheme: http + failover: + ring_mode: exhaust_ring + response_codes: - 404 - 502 - 503 - health_check: + health_check: - passive - active - - strategy: 'consistent-hash-2' - policy: consistent_hash - hash_key: path + - strategy: "consistent-hash-2" + policy: consistent_hash + hash_key: path go_direct: false - groups: + groups: - &g1 - host: c1.foo.com protocol: @@ -146,26 +146,26 @@ strategies: - scheme: http port: 80 health_check_url: http://192.168.3.1:80 - - scheme: https + - scheme: https port: 443 health_check_url: https://192.168.3.1:443 weight: 1.0 - host: c6.bar.com protocol: - - scheme: http + - scheme: http port: 80 health_check_url: http://192.168.3.2:80 - - scheme: https + - scheme: https port: 443 health_check_url: https://192.168.3.2:443 weight: 1.0 - scheme: http - failover: - ring_mode: alternate_ring - response_codes: + scheme: http + failover: + ring_mode: alternate_ring + response_codes: - 404 - 502 - 503 - health_check: + health_check: - passive - active diff --git a/proxy/http/remap/unit-tests/hosts.yaml b/proxy/http/remap/unit-tests/hosts.yaml index 616e316db9b..f8ab3294072 100644 --- a/proxy/http/remap/unit-tests/hosts.yaml +++ b/proxy/http/remap/unit-tests/hosts.yaml @@ -26,38 +26,38 @@ # hosts: - &p1 - host: 'p1.foo.com' + host: "p1.foo.com" protocol: - scheme: http port: 80 - health_check_url: 'http://192.168.1.1:80' + health_check_url: "http://192.168.1.1:80" - scheme: https port: 443 - health_check_url: 'https://192.168.1.1:443' + health_check_url: "https://192.168.1.1:443" - &p2 - host: 'p2.foo.com' + host: "p2.foo.com" protocol: - scheme: http port: 80 - health_check_url: 'http://192.168.1.2:80' + health_check_url: "http://192.168.1.2:80" - &p3 - host: 'p3.foo.com' + host: "p3.foo.com" protocol: - scheme: http port: 8080 - health_check_url: 'http://192.168.1.3:8080' + health_check_url: "http://192.168.1.3:8080" - scheme: https - port: 8443 - health_check_url: 'https://192.168.1.3:8443' + port: 8443 + health_check_url: "https://192.168.1.3:8443" - &p4 - host: 'p4.foo.com' + host: "p4.foo.com" protocol: - - scheme: http + - scheme: http port: 8080 - health_check_url: 'http://192.168.1.4:8080' + health_check_url: "http://192.168.1.4:8080" - scheme: https port: 8443 - health_check_url: 'https://192.168.1.4:8443' + health_check_url: "https://192.168.1.4:8443" groups: - &g1 - <<: *p1 diff --git a/proxy/http/remap/unit-tests/round-robin-tests.yaml b/proxy/http/remap/unit-tests/round-robin-tests.yaml index f0f1573a47e..0ff9267d032 100644 --- a/proxy/http/remap/unit-tests/round-robin-tests.yaml +++ b/proxy/http/remap/unit-tests/round-robin-tests.yaml @@ -22,31 +22,31 @@ # # @section details Details # -# +# # unit testing strategies for NextHopRoundRobin. # strategies: - - strategy: 'first-live' - policy: first_live - groups: + - strategy: "first-live" + policy: first_live + groups: - &g1 - host: p1.foo.com hash_string: slsklslsk protocol: - - scheme: http + - scheme: http port: 80 health_check_url: http://192.168.1.1:80 - - scheme: https + - scheme: https port: 443 health_check_url: https://192.168.1.1:443 weight: 1.0 - host: p2.foo.com hash_string: srskrsrsk protocol: - - scheme: http + - scheme: http port: 80 health_check_url: http://192.168.1.2:80 - - scheme: https + - scheme: https port: 443 health_check_url: https://192.168.1.2:443 weight: 1.0 @@ -54,54 +54,54 @@ strategies: - host: s1.bar.com hash_string: lslalalal protocol: - - scheme: http + - scheme: http port: 80 health_check_url: http://192.168.2.1:80 - - scheme: https + - scheme: https port: 443 health_check_url: https://192.168.2.1:443 weight: 1.0 - host: s2.bar.com hash_string: alalalalal protocol: - - scheme: http + - scheme: http port: 80 health_check_url: http://192.168.2.2:80 - - scheme: https + - scheme: https port: 443 health_check_url: https://192.168.2.2:443 weight: 1.0 - scheme: http - failover: - ring_mode: exhaust_ring - response_codes: + scheme: http + failover: + ring_mode: exhaust_ring + response_codes: - 404 - 502 - 503 - health_check: + health_check: - passive - active - - strategy: 'rr-strict-exhaust-ring' - policy: rr_strict - groups: + - strategy: "rr-strict-exhaust-ring" + policy: rr_strict + groups: - &g1 - host: p1.foo.com hash_string: slsklslsk protocol: - - scheme: http + - scheme: http port: 80 health_check_url: http://192.168.1.1:80 - - scheme: https + - scheme: https port: 443 health_check_url: https://192.168.1.1:443 weight: 1.0 - host: p2.foo.com hash_string: srskrsrsk protocol: - - scheme: http + - scheme: http port: 80 health_check_url: http://192.168.1.2:80 - - scheme: https + - scheme: https port: 443 health_check_url: https://192.168.1.2:443 weight: 1.0 @@ -109,10 +109,10 @@ strategies: - host: s1.bar.com hash_string: lslalalal protocol: - - scheme: http + - scheme: http port: 80 health_check_url: http://192.168.2.1:80 - - scheme: https + - scheme: https port: 443 health_check_url: https://192.168.2.1:443 weight: 1.0 @@ -126,82 +126,81 @@ strategies: port: 443 health_check_url: https://192.168.2.2:443 weight: 1.0 - scheme: http - failover: - ring_mode: exhaust_ring - response_codes: + scheme: http + failover: + ring_mode: exhaust_ring + response_codes: - 404 - 502 - 503 - health_check: + health_check: - passive - active - - strategy: 'rr-ip' + - strategy: "rr-ip" policy: rr_ip groups: - &g1 - host: p3.foo.com hash_string: slsklslsk protocol: - - scheme: http + - scheme: http port: 80 health_check_url: http://192.168.1.3:80 - - scheme: https + - scheme: https port: 443 health_check_url: https://192.168.1.3:443 weight: 1.0 - host: p4.foo.com hash_string: srskrsrsk protocol: - - scheme: http + - scheme: http port: 80 health_check_url: http://192.168.1.4:80 - - scheme: https + - scheme: https port: 443 health_check_url: https://192.168.1.4:443 weight: 1.0 - scheme: http - failover: + scheme: http + failover: ring_mode: alternate_ring response_codes: - 404 - 502 - 503 - health_check: + health_check: - passive - active - - strategy: 'latched' + - strategy: "latched" policy: latched groups: - &g1 - host: p3.foo.com hash_string: slsklslsk protocol: - - scheme: http + - scheme: http port: 80 health_check_url: http://192.168.1.3:80 - - scheme: https + - scheme: https port: 443 health_check_url: https://192.168.1.3:443 weight: 1.0 - host: p4.foo.com hash_string: srskrsrsk protocol: - - scheme: http + - scheme: http port: 80 health_check_url: http://192.168.1.4:80 - scheme: https port: 443 health_check_url: https://192.168.1.4:443 weight: 1.0 - scheme: http - failover: + scheme: http + failover: ring_mode: alternate_ring response_codes: - 404 - 502 - 503 - health_check: + health_check: - passive - active - diff --git a/proxy/http/remap/unit-tests/simple-strategy.yaml b/proxy/http/remap/unit-tests/simple-strategy.yaml index 8697b1ab70b..23ef1d694a7 100644 --- a/proxy/http/remap/unit-tests/simple-strategy.yaml +++ b/proxy/http/remap/unit-tests/simple-strategy.yaml @@ -22,13 +22,13 @@ # # @section details Details # -# +# # unit test simple-strategy.yaml example # strategies: - - strategy: 'strategy-3' - policy: rr_ip - groups: + - strategy: "strategy-3" + policy: rr_ip + groups: - &g1 - host: p1.foo.com hash_string: slsklslsk @@ -71,17 +71,17 @@ strategies: port: 443 health_check_url: https://192.168.2.2:443 weight: 1.0 - scheme: https - failover: - ring_mode: exhaust_ring - response_codes: + scheme: https + failover: + ring_mode: exhaust_ring + response_codes: - 404 - 502 - 503 - health_check: + health_check: - passive - active - - strategy: 'strategy-4' + - strategy: "strategy-4" policy: latched groups: - &g1 @@ -105,14 +105,13 @@ strategies: port: 443 health_check_url: https://192.168.1.4:443 weight: 1.0 - scheme: http - failover: + scheme: http + failover: ring_mode: alternate_ring response_codes: - 404 - 502 - 503 - health_check: + health_check: - passive - active - diff --git a/proxy/http/remap/unit-tests/strategies-dir/01-hosts.yaml b/proxy/http/remap/unit-tests/strategies-dir/01-hosts.yaml index f0750585444..99af17c3952 100644 --- a/proxy/http/remap/unit-tests/strategies-dir/01-hosts.yaml +++ b/proxy/http/remap/unit-tests/strategies-dir/01-hosts.yaml @@ -26,35 +26,35 @@ # hosts: - &p1 - host: 'p1.foo.com' + host: "p1.foo.com" protocol: - scheme: http port: 80 - health_check_url: 'http://192.168.1.1:80' + health_check_url: "http://192.168.1.1:80" - scheme: https port: 443 - health_check_url: 'https://192.168.1.1:443' + health_check_url: "https://192.168.1.1:443" - &p2 - host: 'p2.foo.com' + host: "p2.foo.com" protocol: - scheme: http port: 80 - health_check_url: 'http://192.168.1.2:80' + health_check_url: "http://192.168.1.2:80" - &p3 - host: 'p3.foo.com' + host: "p3.foo.com" protocol: - scheme: http port: 8080 - health_check_url: 'http://192.168.1.3:8080' + health_check_url: "http://192.168.1.3:8080" - scheme: https - port: 8443 - health_check_url: 'https://192.168.1.3:8443' + port: 8443 + health_check_url: "https://192.168.1.3:8443" - &p4 - host: 'p4.foo.com' + host: "p4.foo.com" protocol: - - scheme: http + - scheme: http port: 8080 - health_check_url: 'http://192.168.1.4:8080' + health_check_url: "http://192.168.1.4:8080" - scheme: https port: 8443 - health_check_url: 'https://192.168.1.4:8443' + health_check_url: "https://192.168.1.4:8443" diff --git a/proxy/http/remap/unit-tests/strategies-dir/03-strategies.yaml b/proxy/http/remap/unit-tests/strategies-dir/03-strategies.yaml index 3bbd67075a2..b60101d1602 100644 --- a/proxy/http/remap/unit-tests/strategies-dir/03-strategies.yaml +++ b/proxy/http/remap/unit-tests/strategies-dir/03-strategies.yaml @@ -22,7 +22,7 @@ # # @section details Details # -# +# # unit test data. # strategies: @@ -52,14 +52,14 @@ strategies: groups: - *g1 - *g2 - scheme: http - failover: + scheme: http + failover: max_simple_retries: 2 ring_mode: alternate_ring response_codes: - 404 - 502 - 503 - health_check: + health_check: - passive - active diff --git a/proxy/http/remap/unit-tests/strategy.yaml b/proxy/http/remap/unit-tests/strategy.yaml index fb7cc65069d..b3f438a1bb2 100644 --- a/proxy/http/remap/unit-tests/strategy.yaml +++ b/proxy/http/remap/unit-tests/strategy.yaml @@ -22,7 +22,7 @@ # # @section details Details # -# +# # unit test strategy.yaml example # #include unit-tests/hosts.yaml @@ -36,7 +36,7 @@ strategies: - *g1 - *g2 scheme: http - failover: + failover: ring_mode: exhaust_ring response_codes: - 404 diff --git a/tests/README.md b/tests/README.md index db84c568e21..32f2a5d2570 100644 --- a/tests/README.md +++ b/tests/README.md @@ -23,16 +23,16 @@ This file is a simple wrapper that will call the Reusable Gold Testing System (A This script will check for the necessary packages needed to create a pipenv that can run Autest. If any package is missing, the script will alert the user. If all packages are available, it install a virtual environment using the provided Pipfile. ### Pipfile -This file is used to setup a virtual environment using pipenv. It contains information including the packages needed for Autest. +This file is used to setup a virtual environment using pipenv. It contains information including the packages needed for Autest. A set of commands for pipenv: - * **pipenv install**: create virtual environment from the Pipfile. + * **pipenv install**: create virtual environment from the Pipfile. * **pipenv shell**: launch a shell with the environment running(type "exit" to leave the shell). * **pipenv run cmd**: run command in the virtual environment without entering a shell, where cmd is the shell command to run. * **pipenv --rm**: remove the environment. # Basic setup -AuTest can be run using the script file autest.sh listed above. Run the file from the tests/ directory followed by --ats-bin and the bin name. (ie ~/ats/bin) This will run the wrapper for the tests. +AuTest can be run using the script file autest.sh listed above. Run the file from the tests/ directory followed by --ats-bin and the bin name. (ie ~/ats/bin) This will run the wrapper for the tests. To run autest manually, the recommended way is to follow these steps: 1. **pipenv install**: create the virtual environment(only needed once). @@ -65,7 +65,7 @@ This command line argument will point to your build of ATS you want to test. At * select_ports - have the testing system automatically select a nonSSL port to use for this instance of ATS * enable_tls - have the testing system also auto-select a SSL port to use (NOTE: This does not set up certs and other TLS-related configs.) -This function will define a sandbox for an instance of trafficserver to run under. The function will return a AuTest process object that will have a number of files and variables define for making it easier to define a test. If both *select_ports* and *enable_tls* are toggled to **False**, then the test writer will be responsible for setting up the ports and the ready condition for an instance of ATS. +This function will define a sandbox for an instance of trafficserver to run under. The function will return a AuTest process object that will have a number of files and variables define for making it easier to define a test. If both *select_ports* and *enable_tls* are toggled to **False**, then the test writer will be responsible for setting up the ports and the ready condition for an instance of ATS. #### Environment The environment of the process will have a number of added environment variables to control trafficserver running the in the sandbox location correctly. This can be used to easily setup other commands that should run under same environment. diff --git a/tests/gold_tests/autest-site/readme.md b/tests/gold_tests/autest-site/readme.md index 8ab499d1a15..72c89c7b419 100644 --- a/tests/gold_tests/autest-site/readme.md +++ b/tests/gold_tests/autest-site/readme.md @@ -14,18 +14,18 @@ To use the CurlHeader tester when writing tests, which is not one of the default Examples: * To check for header 'X-Cache' that have value 'miss' and header 'cache-control' that have value starting with 'max', provide the following dictionary to tester: - - { - 'X-Cache' : 'miss', + + { + 'X-Cache' : 'miss', 'cache-control' : {'equal_re' : 'max.*'} } * To check for header 'Age' that can have any value and header 'etag' that have value either matching 'myetag' or end with 'p', provide the following dictionary to tester: - + { 'Age' : None, 'etag' : { 'equal' : 'myetag', 'equal_re' : '.*p' } - } \ No newline at end of file + } diff --git a/tests/gold_tests/tls/test-nc-s_client.sh b/tests/gold_tests/tls/test-nc-s_client.sh index a11a80c9329..8aaf1192987 100644 --- a/tests/gold_tests/tls/test-nc-s_client.sh +++ b/tests/gold_tests/tls/test-nc-s_client.sh @@ -15,5 +15,5 @@ # 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. -nc -l -p $1 -c 'echo -e "This is a reply"' -o test.out & -echo "This is a test" | openssl s_client -servername bar.com -connect localhost:$2 -ign_eof +nc -l -p $1 -c 'echo -e "This is a reply"' -o test.out & +echo "This is a test" | openssl s_client -servername bar.com -connect localhost:$2 -ign_eof diff --git a/tests/tools/README.md b/tests/tools/README.md index 4e7e208e63b..32c0b3bf3c8 100644 --- a/tests/tools/README.md +++ b/tests/tools/README.md @@ -7,21 +7,21 @@ Note these Tools require python 3.4 or better. Replay client to replay session logs. -Usage: +Usage: python3.5 traffic-replay/ -type -log_dir /path/to/log -v -Session Log format (in JSON): +Session Log format (in JSON): - {"version": "0.1", + {"version": "0.1", "txns": [ - {"request": {"headers": "POST ……\r\n\r\n", "timestamp": "..", "body": ".."}, + {"request": {"headers": "POST ……\r\n\r\n", "timestamp": "..", "body": ".."}, "response": {"headers": "HTTP/1.1..\r\n\r\n", "timestamp": "..", "body": ".."}, - "uuid": "1"}, - {"request": {"headers": "POST ..….\r\n\r\n", "timestamp": "..", "body": ".."}, - "response": {"headers": "HTTP/1.1..\r\nr\n", "timestamp": "..", "body": ".."}, + "uuid": "1"}, + {"request": {"headers": "POST ..….\r\n\r\n", "timestamp": "..", "body": ".."}, + "response": {"headers": "HTTP/1.1..\r\nr\n", "timestamp": "..", "body": ".."}, "uuid": "2"} - ], - "timestamp": "....", + ], + "timestamp": "....", "encoding": "...."} Configuration: The configuration required to run traffic-replay can be specified in traffic-replay/Config.py