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

[trafficserver] branch 9.0.x updated (c02d480 -> 4b14114)

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 c02d480  Disable max_connections_active_in default now that featur works (#6903)
     new 907a43b  Make compress plugin normalization of Accept-Encoding header compatible with normalization in core TS.
     new acb0391  Make compress Au test less flakey. (#6915)
     new 4b14114  example: Move to blocklists and allowlists

The 3 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:
 example/plugins/c-api/Makefile.am                  |  12 +-
 example/plugins/c-api/blacklist_1/readme.txt       |  17 --
 .../blacklist_0.c => blocklist_0/blocklist_0.c}    |  12 +-
 .../blacklist.txt => blocklist_1/blocklist.txt}    |   0
 .../blacklist_1.c => blocklist_1/blocklist_1.c}    |  36 ++--
 example/plugins/c-api/blocklist_1/readme.txt       |  17 ++
 .../ssl_sni_allowlist.cc}                          |   8 +-
 plugins/compress/misc.cc                           |  76 ++++---
 tests/gold_tests/pluginTest/compress/compress.gold | 225 +++++----------------
 .../pluginTest/compress/compress.test.py           | 150 ++++++++------
 .../pluginTest/compress/compress_userver.gold      |  21 ++
 tests/gold_tests/pluginTest/compress/greplog.sh    |   2 +-
 12 files changed, 272 insertions(+), 304 deletions(-)
 delete mode 100644 example/plugins/c-api/blacklist_1/readme.txt
 rename example/plugins/c-api/{blacklist_0/blacklist_0.c => blocklist_0/blocklist_0.c} (93%)
 rename example/plugins/c-api/{blacklist_1/blacklist.txt => blocklist_1/blocklist.txt} (100%)
 rename example/plugins/c-api/{blacklist_1/blacklist_1.c => blocklist_1/blocklist_1.c} (90%)
 create mode 100644 example/plugins/c-api/blocklist_1/readme.txt
 rename example/plugins/c-api/{ssl_sni_whitelist/ssl_sni_whitelist.cc => ssl_sni_allowlist/ssl_sni_allowlist.cc} (92%)
 create mode 100644 tests/gold_tests/pluginTest/compress/compress_userver.gold


[trafficserver] 01/03: Make compress plugin normalization of Accept-Encoding header compatible with normalization in core TS.

Posted by zw...@apache.org.
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 907a43b6d607a9c727e4c72b82f5c0e80ae9dce4
Author: Walter Karas <wk...@verizonmedia.com>
AuthorDate: Fri Aug 23 19:28:19 2019 -0500

    Make compress plugin normalization of Accept-Encoding header compatible with normalization in core TS.
    
    Specifically, remove parameters on values, but if there is a valid q parameter which is equal to 0.0,
    remove the associated value from the value list.
    
    (cherry picked from commit 15a6890366ff9a791afec71580b0c03f6baccf5e)
---
 plugins/compress/misc.cc                           |  76 ++++++---
 tests/gold_tests/pluginTest/compress/compress.gold | 183 ++++-----------------
 .../pluginTest/compress/compress.test.py           | 139 +++++++++-------
 .../pluginTest/compress/compress_userver.gold      |  21 +++
 4 files changed, 191 insertions(+), 228 deletions(-)

diff --git a/plugins/compress/misc.cc b/plugins/compress/misc.cc
index 4bf579c..56c3fa9 100644
--- a/plugins/compress/misc.cc
+++ b/plugins/compress/misc.cc
@@ -23,6 +23,7 @@
 
 #include "ts/ts.h"
 #include "tscore/ink_defs.h"
+#include "tscpp/util/TextView.h"
 
 #include "misc.h"
 #include <cstring>
@@ -41,40 +42,69 @@ gzip_free(voidpf /* opaque ATS_UNUSED */, voidpf address)
   TSfree(address);
 }
 
+namespace
+{
+// Strips parameters from value.  Returns cleared TextView if a q=f parameter present, where f is less than or equal to
+// zero.
+//
+void
+strip_ae_value(ts::TextView &value)
+{
+  ts::TextView compression{value.take_prefix_at(';')};
+  compression.trim(" \t");
+  while (value) {
+    ts::TextView param{value.take_prefix_at(';')};
+    ts::TextView name{param.take_prefix_at('=')};
+    name.trim(" \t");
+    if (strcasecmp("q", name) == 0) {
+      // If q value is valid and is zero, suppress compression types.
+      param.trim(" \t");
+      if (param) {
+        ts::TextView whole{param.take_prefix_at('.')};
+        whole.ltrim(" \t");
+        if ("0" == whole) {
+          param.trim('0');
+          if (!param) {
+            // Suppress compression type.
+            compression.clear();
+            break;
+          }
+        }
+      }
+    }
+  }
+  value = compression;
+}
+} // end anonymous namespace
+
 void
 normalize_accept_encoding(TSHttpTxn /* txnp ATS_UNUSED */, TSMBuffer reqp, TSMLoc hdr_loc)
 {
   TSMLoc field = TSMimeHdrFieldFind(reqp, hdr_loc, TS_MIME_FIELD_ACCEPT_ENCODING, TS_MIME_LEN_ACCEPT_ENCODING);
-  int deflate  = 0;
-  int gzip     = 0;
-  int br       = 0;
+  bool deflate = false;
+  bool gzip    = false;
+  bool br      = false;
   // remove the accept encoding field(s),
   // while finding out if gzip or deflate is supported.
   while (field) {
-    TSMLoc tmp;
-
-    if (!deflate && !gzip) {
-      int value_count = TSMimeHdrFieldValuesCount(reqp, hdr_loc, field);
-
-      while (value_count > 0) {
-        int val_len = 0;
-        const char *val;
-
-        --value_count;
-        val = TSMimeHdrFieldValueStringGet(reqp, hdr_loc, field, value_count, &val_len);
-
-        if (val_len == static_cast<int>(strlen("br"))) {
-          br = !strncmp(val, "br", val_len);
-        }
-        if (val_len == static_cast<int>(strlen("gzip"))) {
-          gzip = !strncmp(val, "gzip", val_len);
-        } else if (val_len == static_cast<int>(strlen("deflate"))) {
-          deflate = !strncmp(val, "deflate", val_len);
+    int val_len;
+    const char *values_ = TSMimeHdrFieldValueStringGet(reqp, hdr_loc, field, -1, &val_len);
+    if (values_ && val_len) {
+      ts::TextView values(values_, val_len);
+      while (values) {
+        ts::TextView next{values.take_prefix_at(',')};
+        strip_ae_value(next);
+        if (strcasecmp("gzip", next) == 0) {
+          gzip = true;
+        } else if (strcasecmp("br", next) == 0) {
+          br = true;
+        } else if (strcasecmp("deflate", next) == 0) {
+          deflate = true;
         }
       }
     }
 
-    tmp = TSMimeHdrFieldNextDup(reqp, hdr_loc, field);
+    TSMLoc tmp = TSMimeHdrFieldNextDup(reqp, hdr_loc, field);
     TSMimeHdrFieldDestroy(reqp, hdr_loc, field); // catch retval?
     TSHandleMLocRelease(reqp, hdr_loc, field);
     field = tmp;
diff --git a/tests/gold_tests/pluginTest/compress/compress.gold b/tests/gold_tests/pluginTest/compress/compress.gold
index af5b4f0..ff02ed6 100644
--- a/tests/gold_tests/pluginTest/compress/compress.gold
+++ b/tests/gold_tests/pluginTest/compress/compress.gold
@@ -1,5 +1,5 @@
 > GET http://ae-0/obj0 HTTP/1.1
-> X-Ats-Compress-Test: ts/0/gzip, deflate, sdch, br
+> X-Ats-Compress-Test: 0/gzip, deflate, sdch, br
 > Accept-Encoding: gzip, deflate, sdch, br
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
@@ -8,7 +8,7 @@
 < Content-Length: 46
 
 > GET http://ae-0/obj0 HTTP/1.1
-> X-Ats-Compress-Test: ts/0/gzip
+> X-Ats-Compress-Test: 0/gzip
 > Accept-Encoding: gzip
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
@@ -17,7 +17,7 @@
 < Content-Length: 71
 
 > GET http://ae-0/obj0 HTTP/1.1
-> X-Ats-Compress-Test: ts/0/br
+> X-Ats-Compress-Test: 0/br
 > Accept-Encoding: br
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
@@ -26,14 +26,14 @@
 < Content-Length: 46
 
 > GET http://ae-0/obj0 HTTP/1.1
-> X-Ats-Compress-Test: ts/0/deflate
+> X-Ats-Compress-Test: 0/deflate
 > Accept-Encoding: deflate
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
 < Content-Length: 1049
 
 > GET http://ae-1/obj1 HTTP/1.1
-> X-Ats-Compress-Test: ts/1/gzip, deflate, sdch, br
+> X-Ats-Compress-Test: 1/gzip, deflate, sdch, br
 > Accept-Encoding: gzip, deflate, sdch, br
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
@@ -42,7 +42,7 @@
 < Content-Length: 71
 
 > GET http://ae-1/obj1 HTTP/1.1
-> X-Ats-Compress-Test: ts/1/gzip
+> X-Ats-Compress-Test: 1/gzip
 > Accept-Encoding: gzip
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
@@ -51,21 +51,21 @@
 < Content-Length: 71
 
 > GET http://ae-1/obj1 HTTP/1.1
-> X-Ats-Compress-Test: ts/1/br
+> X-Ats-Compress-Test: 1/br
 > Accept-Encoding: br
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
 < Content-Length: 1049
 
 > GET http://ae-1/obj1 HTTP/1.1
-> X-Ats-Compress-Test: ts/1/deflate
+> X-Ats-Compress-Test: 1/deflate
 > Accept-Encoding: deflate
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
 < Content-Length: 1049
 
 > GET http://ae-2/obj2 HTTP/1.1
-> X-Ats-Compress-Test: ts/2/gzip, deflate, sdch, br
+> X-Ats-Compress-Test: 2/gzip, deflate, sdch, br
 > Accept-Encoding: gzip, deflate, sdch, br
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
@@ -74,7 +74,7 @@
 < Content-Length: 46
 
 > GET http://ae-2/obj2 HTTP/1.1
-> X-Ats-Compress-Test: ts/2/gzip
+> X-Ats-Compress-Test: 2/gzip
 > Accept-Encoding: gzip
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
@@ -83,7 +83,7 @@
 < Content-Length: 71
 
 > GET http://ae-2/obj2 HTTP/1.1
-> X-Ats-Compress-Test: ts/2/br
+> X-Ats-Compress-Test: 2/br
 > Accept-Encoding: br
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
@@ -92,15 +92,15 @@
 < Content-Length: 46
 
 > GET http://ae-2/obj2 HTTP/1.1
-> X-Ats-Compress-Test: ts/2/deflate
+> X-Ats-Compress-Test: 2/deflate
 > Accept-Encoding: deflate
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
 < Content-Length: 1049
 
 > GET http://ae-0/obj0 HTTP/1.1
-> X-Ats-Compress-Test: ts2/0/gzip
-> Accept-Encoding: gzip
+> X-Ats-Compress-Test: 0/gzip;q=0.666
+> Accept-Encoding: gzip;q=0.666
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
 < Content-Encoding: gzip
@@ -108,8 +108,8 @@
 < Content-Length: 71
 
 > GET http://ae-0/obj0 HTTP/1.1
-> X-Ats-Compress-Test: ts2/0/gzip
-> Accept-Encoding: gzip
+> X-Ats-Compress-Test: 0/gzip;q=0.666x
+> Accept-Encoding: gzip;q=0.666x
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
 < Content-Encoding: gzip
@@ -117,97 +117,33 @@
 < Content-Length: 71
 
 > GET http://ae-0/obj0 HTTP/1.1
-> X-Ats-Compress-Test: ts2/0/br
-> Accept-Encoding: br
-< HTTP/1.1 200 OK
-< Content-Type: text/javascript
-< Content-Encoding: br
-< Vary: Accept-Encoding
-< Content-Length: 46
-
-> GET http://ae-0/obj0 HTTP/1.1
-> X-Ats-Compress-Test: ts2/0/deflate
-> Accept-Encoding: deflate
-< HTTP/1.1 200 OK
-< Content-Type: text/javascript
-< Content-Length: 1049
-
-> GET http://ae-1/obj1 HTTP/1.1
-> X-Ats-Compress-Test: ts2/1/gzip
-> Accept-Encoding: gzip
+> X-Ats-Compress-Test: 0/gzip;q=#0.666
+> Accept-Encoding: gzip;q=#0.666
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
 < Content-Encoding: gzip
 < Vary: Accept-Encoding
 < Content-Length: 71
 
-> GET http://ae-1/obj1 HTTP/1.1
-> X-Ats-Compress-Test: ts2/1/gzip
-> Accept-Encoding: gzip
-< HTTP/1.1 200 OK
-< Content-Type: text/javascript
-< Content-Encoding: gzip
-< Vary: Accept-Encoding
-< Content-Length: 71
-
-> GET http://ae-1/obj1 HTTP/1.1
-> X-Ats-Compress-Test: ts2/1/br
-> Accept-Encoding: br
-< HTTP/1.1 200 OK
-< Content-Type: text/javascript
-< Content-Length: 1049
-
-> GET http://ae-1/obj1 HTTP/1.1
-> X-Ats-Compress-Test: ts2/1/deflate
-> Accept-Encoding: deflate
-< HTTP/1.1 200 OK
-< Content-Type: text/javascript
-< Content-Length: 1049
-
-> GET http://ae-2/obj2 HTTP/1.1
-> X-Ats-Compress-Test: ts2/2/gzip
-> Accept-Encoding: gzip
-< HTTP/1.1 200 OK
-< Content-Type: text/javascript
-< Content-Encoding: gzip
-< Vary: Accept-Encoding
-< Content-Length: 71
-
-> GET http://ae-2/obj2 HTTP/1.1
-> X-Ats-Compress-Test: ts2/2/gzip
-> Accept-Encoding: gzip
+> GET http://ae-0/obj0 HTTP/1.1
+> X-Ats-Compress-Test: 0/gzip; Q = 0.666
+> Accept-Encoding: gzip; Q = 0.666
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
 < Content-Encoding: gzip
 < Vary: Accept-Encoding
 < Content-Length: 71
 
-> GET http://ae-2/obj2 HTTP/1.1
-> X-Ats-Compress-Test: ts2/2/br
-> Accept-Encoding: br
-< HTTP/1.1 200 OK
-< Content-Type: text/javascript
-< Content-Encoding: br
-< Vary: Accept-Encoding
-< Content-Length: 46
-
-> GET http://ae-2/obj2 HTTP/1.1
-> X-Ats-Compress-Test: ts2/2/deflate
-> Accept-Encoding: deflate
-< HTTP/1.1 200 OK
-< Content-Type: text/javascript
-< Content-Length: 1049
-
 > GET http://ae-0/obj0 HTTP/1.1
-> X-Ats-Compress-Test: ts3/0/deflate
-> Accept-Encoding: deflate
+> X-Ats-Compress-Test: 0/gzip;q=0.0
+> Accept-Encoding: gzip;q=0.0
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
 < Content-Length: 1049
 
 > GET http://ae-0/obj0 HTTP/1.1
-> X-Ats-Compress-Test: ts3/0/gzip
-> Accept-Encoding: gzip
+> X-Ats-Compress-Test: 0/gzip;q=-0.1
+> Accept-Encoding: gzip;q=-0.1
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
 < Content-Encoding: gzip
@@ -215,82 +151,29 @@
 < Content-Length: 71
 
 > GET http://ae-0/obj0 HTTP/1.1
-> X-Ats-Compress-Test: ts3/0/br
-> Accept-Encoding: br
-< HTTP/1.1 200 OK
-< Content-Type: text/javascript
-< Content-Encoding: br
-< Vary: Accept-Encoding
-< Content-Length: 46
-
-> GET http://ae-0/obj0 HTTP/1.1
-> X-Ats-Compress-Test: ts3/0/deflate
-> Accept-Encoding: deflate
-< HTTP/1.1 200 OK
-< Content-Type: text/javascript
-< Content-Length: 1049
-
-> GET http://ae-1/obj1 HTTP/1.1
-> X-Ats-Compress-Test: ts3/1/deflate
-> Accept-Encoding: deflate
-< HTTP/1.1 200 OK
-< Content-Type: text/javascript
-< Content-Length: 1049
-
-> GET http://ae-1/obj1 HTTP/1.1
-> X-Ats-Compress-Test: ts3/1/gzip
-> Accept-Encoding: gzip
+> X-Ats-Compress-Test: 0/aaa, gzip;q=0.666, bbb
+> Accept-Encoding: aaa, gzip;q=0.666, bbb
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
 < Content-Encoding: gzip
 < Vary: Accept-Encoding
 < Content-Length: 71
 
-> GET http://ae-1/obj1 HTTP/1.1
-> X-Ats-Compress-Test: ts3/1/br
-> Accept-Encoding: br
+> GET http://ae-0/obj0 HTTP/1.1
+> X-Ats-Compress-Test: 0/ br ; q=0.666, bbb
+> Accept-Encoding:  br ; q=0.666, bbb
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
 < Content-Encoding: br
 < Vary: Accept-Encoding
 < Content-Length: 46
 
-> GET http://ae-1/obj1 HTTP/1.1
-> X-Ats-Compress-Test: ts3/1/deflate
-> Accept-Encoding: deflate
-< HTTP/1.1 200 OK
-< Content-Type: text/javascript
-< Content-Length: 1049
-
-> GET http://ae-2/obj2 HTTP/1.1
-> X-Ats-Compress-Test: ts3/2/deflate
-> Accept-Encoding: deflate
-< HTTP/1.1 200 OK
-< Content-Type: text/javascript
-< Content-Length: 1049
-
-> GET http://ae-2/obj2 HTTP/1.1
-> X-Ats-Compress-Test: ts3/2/gzip
-> Accept-Encoding: gzip
+> GET http://ae-0/obj0 HTTP/1.1
+> X-Ats-Compress-Test: 0/aaa, gzip;q=0.666 , 
+> Accept-Encoding: aaa, gzip;q=0.666 , 
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
 < Content-Encoding: gzip
 < Vary: Accept-Encoding
 < Content-Length: 71
 
-> GET http://ae-2/obj2 HTTP/1.1
-> X-Ats-Compress-Test: ts3/2/br
-> Accept-Encoding: br
-< HTTP/1.1 200 OK
-< Content-Type: text/javascript
-< Content-Encoding: br
-< Vary: Accept-Encoding
-< Content-Length: 46
-
-> GET http://ae-2/obj2 HTTP/1.1
-> X-Ats-Compress-Test: ts3/2/deflate
-> Accept-Encoding: deflate
-< HTTP/1.1 200 OK
-< Content-Type: text/javascript
-< Content-Length: 1049
-
diff --git a/tests/gold_tests/pluginTest/compress/compress.test.py b/tests/gold_tests/pluginTest/compress/compress.test.py
index 626b74b..f93ce3d 100644
--- a/tests/gold_tests/pluginTest/compress/compress.test.py
+++ b/tests/gold_tests/pluginTest/compress/compress.test.py
@@ -30,7 +30,6 @@ Test.SkipUnless(
     Condition.HasATSFeature('TS_HAS_BROTLI')
 )
 
-
 server = Test.MakeOriginServer("server", options={'--load': '{}/compress_observer.py'.format(Test.TestDirectory)})
 
 def repeat(str, count):
@@ -62,71 +61,103 @@ for i in range(3):
     }
     server.addResponse("sessionfile.log", request_header, response_header)
 
-def curl(ts, name, idx, encodingList):
+def curl(ts, idx, encodingList):
     return (
         "curl --verbose --proxy http://127.0.0.1:{}".format(ts.Variables.port) +
-        " --header 'X-Ats-Compress-Test: {}/{}/{}'".format(name, idx, encodingList) +
+        " --header 'X-Ats-Compress-Test: {}/{}'".format(idx, encodingList) +
         " --header 'Accept-Encoding: {0}' 'http://ae-{1}/obj{1}'".format(encodingList, idx) +
         " >> {0}/compress_long.log 2>&1 ; printf '\n\n' >> {0}/compress_long.log".format(Test.RunDirectory)
     )
 
-def oneTs(name, AeHdr1='gzip, deflate, sdch, br'):
-    global waitForServer
+waitForServer = True
 
-    waitForTs = True
+waitForTs = True
 
-    ts = Test.MakeATSProcess(name)
+ts = Test.MakeATSProcess("ts")
 
-    ts.Disk.records_config.update({
-        'proxy.config.diags.debug.enabled': 0,
-        'proxy.config.diags.debug.tags': 'http|compress|cache',
-        'proxy.config.http.normalize_ae': 0,
-    })
+ts.Disk.records_config.update({
+    'proxy.config.http.cache.http': 0,
+    'proxy.config.diags.debug.enabled': 1,
+    'proxy.config.diags.debug.tags': 'compress',
+    'proxy.config.http.normalize_ae': 0,
+})
 
-    ts.Disk.remap_config.AddLine(
-        'map http://ae-0/ http://127.0.0.1:{}/'.format(server.Variables.Port) +
-        ' @plugin=compress.so @pparam={}/compress.config'.format(Test.TestDirectory)
-    )
-    ts.Disk.remap_config.AddLine(
-        'map http://ae-1/ http://127.0.0.1:{}/'.format(server.Variables.Port) +
-        ' @plugin=conf_remap.so @pparam=proxy.config.http.normalize_ae=1' +
-        ' @plugin=compress.so @pparam={}/compress.config'.format(Test.TestDirectory)
-    )
-    ts.Disk.remap_config.AddLine(
-        'map http://ae-2/ http://127.0.0.1:{}/'.format(server.Variables.Port) +
-        ' @plugin=conf_remap.so @pparam=proxy.config.http.normalize_ae=2' +
-        ' @plugin=compress.so @pparam={}/compress2.config'.format(Test.TestDirectory)
-    )
+ts.Disk.remap_config.AddLine(
+    'map http://ae-0/ http://127.0.0.1:{}/'.format(server.Variables.Port) +
+    ' @plugin=compress.so @pparam={}/compress.config'.format(Test.TestDirectory)
+)
+ts.Disk.remap_config.AddLine(
+    'map http://ae-1/ http://127.0.0.1:{}/'.format(server.Variables.Port) +
+    ' @plugin=conf_remap.so @pparam=proxy.config.http.normalize_ae=1' +
+    ' @plugin=compress.so @pparam={}/compress.config'.format(Test.TestDirectory)
+)
+ts.Disk.remap_config.AddLine(
+    'map http://ae-2/ http://127.0.0.1:{}/'.format(server.Variables.Port) +
+    ' @plugin=conf_remap.so @pparam=proxy.config.http.normalize_ae=2' +
+    ' @plugin=compress.so @pparam={}/compress2.config'.format(Test.TestDirectory)
+)
 
-    for i in range(3):
+for i in range(3):
 
-        tr = Test.AddTestRun()
-        if (waitForTs):
-            tr.Processes.Default.StartBefore(ts, ready=When.PortOpen(ts.Variables.port))
-        waitForTs = False
-        if (waitForServer):
-            tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port))
-        waitForServer = False
-        tr.Processes.Default.ReturnCode = 0
-        tr.Processes.Default.Command = curl(ts, name, i, AeHdr1)
+    tr = Test.AddTestRun()
+    if (waitForTs):
+        tr.Processes.Default.StartBefore(ts, ready=When.PortOpen(ts.Variables.port))
+    waitForTs = False
+    if (waitForServer):
+        tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port))
+    waitForServer = False
+    tr.Processes.Default.ReturnCode = 0
+    tr.Processes.Default.Command = curl(ts, i, 'gzip, deflate, sdch, br')
 
-        tr = Test.AddTestRun()
-        tr.Processes.Default.ReturnCode = 0
-        tr.Processes.Default.Command = curl(ts, name, i, "gzip")
+    tr = Test.AddTestRun()
+    tr.Processes.Default.ReturnCode = 0
+    tr.Processes.Default.Command = curl(ts, i, "gzip")
 
-        tr = Test.AddTestRun()
-        tr.Processes.Default.ReturnCode = 0
-        tr.Processes.Default.Command = curl(ts, name, i, "br")
+    tr = Test.AddTestRun()
+    tr.Processes.Default.ReturnCode = 0
+    tr.Processes.Default.Command = curl(ts, i, "br")
 
-        tr = Test.AddTestRun()
-        tr.Processes.Default.ReturnCode = 0
-        tr.Processes.Default.Command = curl(ts, name, i, "deflate")
+    tr = Test.AddTestRun()
+    tr.Processes.Default.ReturnCode = 0
+    tr.Processes.Default.Command = curl(ts, i, "deflate")
 
-waitForServer = True
+# Test Aceept-Encoding normalization.
+
+tr = Test.AddTestRun()
+tr.Processes.Default.ReturnCode = 0
+tr.Processes.Default.Command = curl(ts, 0, "gzip;q=0.666")
+
+tr = Test.AddTestRun()
+tr.Processes.Default.ReturnCode = 0
+tr.Processes.Default.Command = curl(ts, 0, "gzip;q=0.666x")
+
+tr = Test.AddTestRun()
+tr.Processes.Default.ReturnCode = 0
+tr.Processes.Default.Command = curl(ts, 0, "gzip;q=#0.666")
 
-oneTs("ts")
-oneTs("ts2", "gzip")
-oneTs("ts3", "deflate")
+tr = Test.AddTestRun()
+tr.Processes.Default.ReturnCode = 0
+tr.Processes.Default.Command = curl(ts, 0, "gzip; Q = 0.666")
+
+tr = Test.AddTestRun()
+tr.Processes.Default.ReturnCode = 0
+tr.Processes.Default.Command = curl(ts, 0, "gzip;q=0.0")
+
+tr = Test.AddTestRun()
+tr.Processes.Default.ReturnCode = 0
+tr.Processes.Default.Command = curl(ts, 0, "gzip;q=-0.1")
+
+tr = Test.AddTestRun()
+tr.Processes.Default.ReturnCode = 0
+tr.Processes.Default.Command = curl(ts, 0, "aaa, gzip;q=0.666, bbb")
+
+tr = Test.AddTestRun()
+tr.Processes.Default.ReturnCode = 0
+tr.Processes.Default.Command = curl(ts, 0, " br ; q=0.666, bbb")
+
+tr = Test.AddTestRun()
+tr.Processes.Default.ReturnCode = 0
+tr.Processes.Default.Command = curl(ts, 0, "aaa, gzip;q=0.666 , ")
 
 tr = Test.AddTestRun()
 tr.Processes.Default.ReturnCode = 0
@@ -136,9 +167,7 @@ tr.Processes.Default.Command = (
 f = tr.Disk.File("compress_short.log")
 f.Content = "compress.gold"
 
-# Have to comment this out, because caching does not seem to be consistent, which is disturbing.
-#
-# tr = Test.AddTestRun()
-# tr.Processes.Default.Command = "echo"
-# f = tr.Disk.File("compress_userver.log")
-# f.Content = "compress_userver.gold"
+tr = Test.AddTestRun()
+tr.Processes.Default.Command = "echo"
+f = tr.Disk.File("compress_userver.log")
+f.Content = "compress_userver.gold"
diff --git a/tests/gold_tests/pluginTest/compress/compress_userver.gold b/tests/gold_tests/pluginTest/compress/compress_userver.gold
new file mode 100644
index 0000000..f3253de
--- /dev/null
+++ b/tests/gold_tests/pluginTest/compress/compress_userver.gold
@@ -0,0 +1,21 @@
+0/gzip, deflate, sdch, br
+0/gzip
+0/br
+0/deflate
+1/gzip, deflate, sdch, br
+1/gzip
+1/br
+1/deflate
+2/gzip, deflate, sdch, br
+2/gzip
+2/br
+2/deflate
+0/gzip;q=0.666
+0/gzip;q=0.666x
+0/gzip;q=#0.666
+0/gzip; Q = 0.666
+0/gzip;q=0.0
+0/gzip;q=-0.1
+0/aaa, gzip;q=0.666, bbb
+0/ br ; q=0.666, bbb
+0/aaa, gzip;q=0.666 , 


[trafficserver] 02/03: Make compress Au test less flakey. (#6915)

Posted by zw...@apache.org.
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 acb03919ffffb697afb81a73fe9319bfa79da175
Author: Walt Karas <wk...@verizonmedia.com>
AuthorDate: Mon Jun 22 17:51:23 2020 -0500

    Make compress Au test less flakey. (#6915)
    
    (cherry picked from commit 74366b963fd18e97d80e9c91681fe232678d6faf)
---
 tests/gold_tests/pluginTest/compress/compress.gold | 42 +++++++++++-----------
 .../pluginTest/compress/compress.test.py           | 11 ++++--
 tests/gold_tests/pluginTest/compress/greplog.sh    |  2 +-
 3 files changed, 30 insertions(+), 25 deletions(-)

diff --git a/tests/gold_tests/pluginTest/compress/compress.gold b/tests/gold_tests/pluginTest/compress/compress.gold
index ff02ed6..05c8eb5 100644
--- a/tests/gold_tests/pluginTest/compress/compress.gold
+++ b/tests/gold_tests/pluginTest/compress/compress.gold
@@ -6,7 +6,7 @@
 < Content-Encoding: br
 < Vary: Accept-Encoding
 < Content-Length: 46
-
+===
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: 0/gzip
 > Accept-Encoding: gzip
@@ -15,7 +15,7 @@
 < Content-Encoding: gzip
 < Vary: Accept-Encoding
 < Content-Length: 71
-
+===
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: 0/br
 > Accept-Encoding: br
@@ -24,14 +24,14 @@
 < Content-Encoding: br
 < Vary: Accept-Encoding
 < Content-Length: 46
-
+===
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: 0/deflate
 > Accept-Encoding: deflate
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
 < Content-Length: 1049
-
+===
 > GET http://ae-1/obj1 HTTP/1.1
 > X-Ats-Compress-Test: 1/gzip, deflate, sdch, br
 > Accept-Encoding: gzip, deflate, sdch, br
@@ -40,7 +40,7 @@
 < Content-Encoding: gzip
 < Vary: Accept-Encoding
 < Content-Length: 71
-
+===
 > GET http://ae-1/obj1 HTTP/1.1
 > X-Ats-Compress-Test: 1/gzip
 > Accept-Encoding: gzip
@@ -49,21 +49,21 @@
 < Content-Encoding: gzip
 < Vary: Accept-Encoding
 < Content-Length: 71
-
+===
 > GET http://ae-1/obj1 HTTP/1.1
 > X-Ats-Compress-Test: 1/br
 > Accept-Encoding: br
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
 < Content-Length: 1049
-
+===
 > GET http://ae-1/obj1 HTTP/1.1
 > X-Ats-Compress-Test: 1/deflate
 > Accept-Encoding: deflate
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
 < Content-Length: 1049
-
+===
 > GET http://ae-2/obj2 HTTP/1.1
 > X-Ats-Compress-Test: 2/gzip, deflate, sdch, br
 > Accept-Encoding: gzip, deflate, sdch, br
@@ -72,7 +72,7 @@
 < Content-Encoding: br
 < Vary: Accept-Encoding
 < Content-Length: 46
-
+===
 > GET http://ae-2/obj2 HTTP/1.1
 > X-Ats-Compress-Test: 2/gzip
 > Accept-Encoding: gzip
@@ -81,7 +81,7 @@
 < Content-Encoding: gzip
 < Vary: Accept-Encoding
 < Content-Length: 71
-
+===
 > GET http://ae-2/obj2 HTTP/1.1
 > X-Ats-Compress-Test: 2/br
 > Accept-Encoding: br
@@ -90,14 +90,14 @@
 < Content-Encoding: br
 < Vary: Accept-Encoding
 < Content-Length: 46
-
+===
 > GET http://ae-2/obj2 HTTP/1.1
 > X-Ats-Compress-Test: 2/deflate
 > Accept-Encoding: deflate
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
 < Content-Length: 1049
-
+===
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: 0/gzip;q=0.666
 > Accept-Encoding: gzip;q=0.666
@@ -106,7 +106,7 @@
 < Content-Encoding: gzip
 < Vary: Accept-Encoding
 < Content-Length: 71
-
+===
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: 0/gzip;q=0.666x
 > Accept-Encoding: gzip;q=0.666x
@@ -115,7 +115,7 @@
 < Content-Encoding: gzip
 < Vary: Accept-Encoding
 < Content-Length: 71
-
+===
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: 0/gzip;q=#0.666
 > Accept-Encoding: gzip;q=#0.666
@@ -124,7 +124,7 @@
 < Content-Encoding: gzip
 < Vary: Accept-Encoding
 < Content-Length: 71
-
+===
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: 0/gzip; Q = 0.666
 > Accept-Encoding: gzip; Q = 0.666
@@ -133,14 +133,14 @@
 < Content-Encoding: gzip
 < Vary: Accept-Encoding
 < Content-Length: 71
-
+===
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: 0/gzip;q=0.0
 > Accept-Encoding: gzip;q=0.0
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
 < Content-Length: 1049
-
+===
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: 0/gzip;q=-0.1
 > Accept-Encoding: gzip;q=-0.1
@@ -149,7 +149,7 @@
 < Content-Encoding: gzip
 < Vary: Accept-Encoding
 < Content-Length: 71
-
+===
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: 0/aaa, gzip;q=0.666, bbb
 > Accept-Encoding: aaa, gzip;q=0.666, bbb
@@ -158,7 +158,7 @@
 < Content-Encoding: gzip
 < Vary: Accept-Encoding
 < Content-Length: 71
-
+===
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: 0/ br ; q=0.666, bbb
 > Accept-Encoding:  br ; q=0.666, bbb
@@ -167,7 +167,7 @@
 < Content-Encoding: br
 < Vary: Accept-Encoding
 < Content-Length: 46
-
+===
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: 0/aaa, gzip;q=0.666 , 
 > Accept-Encoding: aaa, gzip;q=0.666 , 
@@ -176,4 +176,4 @@
 < Content-Encoding: gzip
 < Vary: Accept-Encoding
 < Content-Length: 71
-
+===
diff --git a/tests/gold_tests/pluginTest/compress/compress.test.py b/tests/gold_tests/pluginTest/compress/compress.test.py
index f93ce3d..30f62e8 100644
--- a/tests/gold_tests/pluginTest/compress/compress.test.py
+++ b/tests/gold_tests/pluginTest/compress/compress.test.py
@@ -66,7 +66,7 @@ def curl(ts, idx, encodingList):
         "curl --verbose --proxy http://127.0.0.1:{}".format(ts.Variables.port) +
         " --header 'X-Ats-Compress-Test: {}/{}'".format(idx, encodingList) +
         " --header 'Accept-Encoding: {0}' 'http://ae-{1}/obj{1}'".format(encodingList, idx) +
-        " >> {0}/compress_long.log 2>&1 ; printf '\n\n' >> {0}/compress_long.log".format(Test.RunDirectory)
+        " 2>> compress_long.log ; printf '\n===\n' >> compress_long.log"
     )
 
 waitForServer = True
@@ -159,11 +159,16 @@ tr = Test.AddTestRun()
 tr.Processes.Default.ReturnCode = 0
 tr.Processes.Default.Command = curl(ts, 0, "aaa, gzip;q=0.666 , ")
 
+# compress_long.log contains all the output from the curl commands.  The tr removes the carriage returns for easier
+# readability.  Curl seems to have a bug, where it will neglect to output an end of line before outputing an HTTP
+# message header line.  The sed command is a work-around for this problem.  greplog.sh uses the grep command to
+# select HTTP request/response line that should be consitent every time the test runs.
+#
 tr = Test.AddTestRun()
 tr.Processes.Default.ReturnCode = 0
 tr.Processes.Default.Command = (
-    r"tr -d '\r' < {1}/compress_long.log | sed 's/\(..*\)\([<>]\)/\1\n\2/' | {0}/greplog.sh > {1}/compress_short.log"
-).format(Test.TestDirectory, Test.RunDirectory)
+    r"tr -d '\r' < compress_long.log | sed 's/\(..*\)\([<>]\)/\1\n\2/' | {0}/greplog.sh > compress_short.log"
+).format(Test.TestDirectory)
 f = tr.Disk.File("compress_short.log")
 f.Content = "compress.gold"
 
diff --git a/tests/gold_tests/pluginTest/compress/greplog.sh b/tests/gold_tests/pluginTest/compress/greplog.sh
index b16fa48..5148beb 100755
--- a/tests/gold_tests/pluginTest/compress/greplog.sh
+++ b/tests/gold_tests/pluginTest/compress/greplog.sh
@@ -20,4 +20,4 @@ grep --text \
  -e '^> Accept-Encoding:' \
  -e '^< Content-' \
  -e '^< Vary:' \
- -e '^$'
+ -e '^===$'


[trafficserver] 03/03: example: Move to blocklists and allowlists

Posted by zw...@apache.org.
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 4b14114474f8abacc58fd4a5d560fca5c4dc538e
Author: Randall Meyer <rr...@apache.org>
AuthorDate: Thu Jun 18 09:04:37 2020 -0700

    example: Move to blocklists and allowlists
    
    This change renames the blacklist* to blocklist* and ssl_sni_whitelist
    to ssl_sni_allowlist
    
    (cherry picked from commit 9ae1a7666ae0419173894b1a11c16f74f0541878)
---
 example/plugins/c-api/Makefile.am                  | 12 ++++----
 example/plugins/c-api/blacklist_1/readme.txt       | 17 ----------
 .../blacklist_0.c => blocklist_0/blocklist_0.c}    | 12 ++++----
 .../blacklist.txt => blocklist_1/blocklist.txt}    |  0
 .../blacklist_1.c => blocklist_1/blocklist_1.c}    | 36 +++++++++++-----------
 example/plugins/c-api/blocklist_1/readme.txt       | 17 ++++++++++
 .../ssl_sni_allowlist.cc}                          |  8 ++---
 7 files changed, 51 insertions(+), 51 deletions(-)

diff --git a/example/plugins/c-api/Makefile.am b/example/plugins/c-api/Makefile.am
index b63f81e..97abebb 100644
--- a/example/plugins/c-api/Makefile.am
+++ b/example/plugins/c-api/Makefile.am
@@ -26,8 +26,8 @@ example_Plugins = \
 	add_header.la \
 	append_transform.la \
 	basic_auth.la \
-	blacklist_0.la \
-	blacklist_1.la \
+	blocklist_0.la \
+	blocklist_1.la \
 	bnull_transform.la \
 	cert_update.la \
 	request_buffer.la \
@@ -54,7 +54,7 @@ example_Plugins = \
 	server_transform.la \
 	session_hooks.la \
 	ssl_preaccept.la \
-	ssl_sni_whitelist.la \
+	ssl_sni_allowlist.la \
 	ssl_sni.la \
 	statistic.la \
 	thread_1.la \
@@ -71,8 +71,8 @@ endif
 add_header_la_SOURCES = add_header/add_header.c
 append_transform_la_SOURCES = append_transform/append_transform.c
 basic_auth_la_SOURCES = basic_auth/basic_auth.c
-blacklist_0_la_SOURCES = blacklist_0/blacklist_0.c
-blacklist_1_la_SOURCES = blacklist_1/blacklist_1.c
+blocklist_0_la_SOURCES = blocklist_0/blocklist_0.c
+blocklist_1_la_SOURCES = blocklist_1/blocklist_1.c
 bnull_transform_la_SOURCES = bnull_transform/bnull_transform.c
 cert_update_la_SOURCES = cert_update/cert_update.cc
 request_buffer_la_SOURCES = request_buffer/request_buffer.c
@@ -98,7 +98,7 @@ server_push_la_SOURCES = server_push/server_push.c
 server_transform_la_SOURCES = server_transform/server_transform.c
 ssl_preaccept_la_SOURCES = ssl_preaccept/ssl_preaccept.cc
 ssl_sni_la_SOURCES = ssl_sni/ssl_sni.cc
-ssl_sni_whitelist_la_SOURCES = ssl_sni_whitelist/ssl_sni_whitelist.cc
+ssl_sni_allowlist_la_SOURCES = ssl_sni_allowlist/ssl_sni_allowlist.cc
 disable_http2_la_SOURCES = disable_http2/disable_http2.cc
 verify_cert_la_SOURCES = verify_cert/verify_cert.cc
 statistic_la_SOURCES = statistic/statistic.cc
diff --git a/example/plugins/c-api/blacklist_1/readme.txt b/example/plugins/c-api/blacklist_1/readme.txt
deleted file mode 100644
index 0e7cf27..0000000
--- a/example/plugins/c-api/blacklist_1/readme.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-How to run the blacklist plugin
-===============================
-
-1. Modify blacklist.cgi to specify the location of perl and traffic server.
-2. Copy blacklist.cgi, blacklist_1.so, PoweredByInktomi.gif to the directory
-   specified by the variable proxy.config.plugin.plugin_dir.
-3. Modify plugin.config to load the blacklist plugin.
-
-
-
-About the blacklist plugin
-==========================
-
-The blacklist plugin allows Traffic Server to compare all incoming request
-origin servers with a blacklisted set of web servers. If the requested origin
-server is blacklisted, Traffic Server sends the client a message saying that
-access is denied.
diff --git a/example/plugins/c-api/blacklist_0/blacklist_0.c b/example/plugins/c-api/blocklist_0/blocklist_0.c
similarity index 93%
rename from example/plugins/c-api/blacklist_0/blacklist_0.c
rename to example/plugins/c-api/blocklist_0/blocklist_0.c
index 5ca5179..a7da67c 100644
--- a/example/plugins/c-api/blacklist_0/blacklist_0.c
+++ b/example/plugins/c-api/blocklist_0/blocklist_0.c
@@ -22,8 +22,8 @@
  */
 
 /*
- *   blacklist_0.c:
- *	original version of blacklist-1, now used for internal testing
+ *   blocklist_0.c:
+ *	original version of blocklist-1, now used for internal testing
  *
  *
  *	Usage:
@@ -34,7 +34,7 @@
 #include <string.h>
 #include <ts/ts.h>
 
-#define PLUGIN_NAME "blacklist_0"
+#define PLUGIN_NAME "blocklist_0"
 
 static char **sites;
 static int nsites;
@@ -69,7 +69,7 @@ handle_dns(TSHttpTxn txnp, TSCont contp)
   }
   for (i = 0; i < nsites; i++) {
     if (strncmp(host, sites[i], host_length) == 0) {
-      printf("blacklisting site: %s\n", sites[i]);
+      printf("blocklisting site: %s\n", sites[i]);
       TSHttpTxnHookAdd(txnp, TS_HTTP_SEND_RESPONSE_HDR_HOOK, contp);
       TSHandleMLocRelease(bufp, hdr_loc, url_loc);
       TSHandleMLocRelease(bufp, TS_NULL_MLOC, url_loc);
@@ -130,7 +130,7 @@ done:
 }
 
 static int
-blacklist_plugin(TSCont contp, TSEvent event, void *edata)
+blocklist_plugin(TSCont contp, TSEvent event, void *edata)
 {
   TSHttpTxn txnp = (TSHttpTxn)edata;
 
@@ -168,6 +168,6 @@ TSPluginInit(int argc, const char *argv[])
       sites[i] = TSstrdup(argv[i + 1]);
     }
 
-    TSHttpHookAdd(TS_HTTP_OS_DNS_HOOK, TSContCreate(blacklist_plugin, NULL));
+    TSHttpHookAdd(TS_HTTP_OS_DNS_HOOK, TSContCreate(blocklist_plugin, NULL));
   }
 }
diff --git a/example/plugins/c-api/blacklist_1/blacklist.txt b/example/plugins/c-api/blocklist_1/blocklist.txt
similarity index 100%
rename from example/plugins/c-api/blacklist_1/blacklist.txt
rename to example/plugins/c-api/blocklist_1/blocklist.txt
diff --git a/example/plugins/c-api/blacklist_1/blacklist_1.c b/example/plugins/c-api/blocklist_1/blocklist_1.c
similarity index 90%
rename from example/plugins/c-api/blacklist_1/blacklist_1.c
rename to example/plugins/c-api/blocklist_1/blocklist_1.c
index 7b08186..0475b4e 100644
--- a/example/plugins/c-api/blacklist_1/blacklist_1.c
+++ b/example/plugins/c-api/blocklist_1/blocklist_1.c
@@ -1,6 +1,6 @@
 /** @file
 
-  An example plugin that denies client access to blacklisted sites (blacklist.txt).
+  An example plugin that denies client access to blocklisted sites (blocklist.txt).
 
   @section license License
 
@@ -27,7 +27,7 @@
 #include "ts/ts.h"
 #include "tscore/ink_defs.h"
 
-#define PLUGIN_NAME "blacklist_1"
+#define PLUGIN_NAME "blocklist_1"
 
 #define MAX_NSITES 500
 #define RETRY_TIME 10
@@ -44,7 +44,7 @@ typedef struct contp_data {
   enum calling_func {
     HANDLE_DNS,
     HANDLE_RESPONSE,
-    READ_BLACKLIST,
+    READ_BLOCKLIST,
   } cf;
 
   TSHttpTxn txnp;
@@ -95,7 +95,7 @@ handle_dns(TSHttpTxn txnp, TSCont contp)
   }
 
   /* We need to lock the sites_mutex as that is the mutex that is
-     protecting the global list of all blacklisted sites. */
+     protecting the global list of all blocklisted sites. */
   if (TSMutexLockTry(sites_mutex) != TS_SUCCESS) {
     TSDebug(PLUGIN_NAME, "Unable to get lock. Will retry after some time");
     TSHandleMLocRelease(bufp, hdr_loc, url_loc);
@@ -107,9 +107,9 @@ handle_dns(TSHttpTxn txnp, TSCont contp)
   for (i = 0; i < nsites; i++) {
     if (strncmp(host, sites[i], host_length) == 0) {
       if (log) {
-        TSTextLogObjectWrite(log, "blacklisting site: %s", sites[i]);
+        TSTextLogObjectWrite(log, "blocklisting site: %s", sites[i]);
       } else {
-        TSDebug(PLUGIN_NAME, "blacklisting site: %s", sites[i]);
+        TSDebug(PLUGIN_NAME, "blocklisting site: %s", sites[i]);
       }
       TSHttpTxnHookAdd(txnp, TS_HTTP_SEND_RESPONSE_HDR_HOOK, contp);
       TSHandleMLocRelease(bufp, hdr_loc, url_loc);
@@ -174,13 +174,13 @@ done:
 }
 
 static void
-read_blacklist(TSCont contp)
+read_blocklist(TSCont contp)
 {
-  char blacklist_file[1024];
+  char blocklist_file[1024];
   TSFile file;
 
-  sprintf(blacklist_file, "%s/blacklist.txt", TSPluginDirGet());
-  file   = TSfopen(blacklist_file, "r");
+  sprintf(blocklist_file, "%s/blocklist.txt", TSPluginDirGet());
+  file   = TSfopen(blocklist_file, "r");
   nsites = 0;
 
   /* If the Mutex lock is not successful try again in RETRY_TIME */
@@ -215,7 +215,7 @@ read_blacklist(TSCont contp)
 
     TSfclose(file);
   } else {
-    TSError("[%s] Unable to open %s", PLUGIN_NAME, blacklist_file);
+    TSError("[%s] Unable to open %s", PLUGIN_NAME, blocklist_file);
     TSError("[%s] All sites will be allowed", PLUGIN_NAME);
   }
 
@@ -223,7 +223,7 @@ read_blacklist(TSCont contp)
 }
 
 static int
-blacklist_plugin(TSCont contp, TSEvent event, void *edata)
+blocklist_plugin(TSCont contp, TSEvent event, void *edata)
 {
   TSHttpTxn txnp;
   cdata *cd;
@@ -276,7 +276,7 @@ blacklist_plugin(TSCont contp, TSEvent event, void *edata)
         break;
       }
     } else {
-      read_blacklist(contp);
+      read_blocklist(contp);
       return 0;
     }
   default:
@@ -291,7 +291,7 @@ handle_txn_start(TSCont contp ATS_UNUSED, TSHttpTxn txnp)
   TSCont txn_contp;
   cdata *cd;
 
-  txn_contp = TSContCreate((TSEventFunc)blacklist_plugin, TSMutexCreate());
+  txn_contp = TSContCreate((TSEventFunc)blocklist_plugin, TSMutexCreate());
   /* create the data that'll be associated with the continuation */
   cd = (cdata *)TSmalloc(sizeof(cdata));
   TSContDataSet(txn_contp, cd);
@@ -319,8 +319,8 @@ TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)
     TSError("[%s] Plugin registration failed", PLUGIN_NAME);
   }
 
-  /* create an TSTextLogObject to log blacklisted requests to */
-  error = TSTextLogObjectCreate("blacklist", TS_LOG_MODE_ADD_TIMESTAMP, &log);
+  /* create an TSTextLogObject to log blocklisted requests to */
+  error = TSTextLogObjectCreate("blocklist", TS_LOG_MODE_ADD_TIMESTAMP, &log);
   if (!log || error == TS_ERROR) {
     TSDebug(PLUGIN_NAME, "error while creating log");
   }
@@ -332,8 +332,8 @@ TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)
     sites[i] = NULL;
   }
 
-  global_contp = TSContCreate(blacklist_plugin, sites_mutex);
-  read_blacklist(global_contp);
+  global_contp = TSContCreate(blocklist_plugin, sites_mutex);
+  read_blocklist(global_contp);
 
   /*TSHttpHookAdd (TS_HTTP_OS_DNS_HOOK, contp); */
   TSHttpHookAdd(TS_HTTP_TXN_START_HOOK, global_contp);
diff --git a/example/plugins/c-api/blocklist_1/readme.txt b/example/plugins/c-api/blocklist_1/readme.txt
new file mode 100644
index 0000000..0402434
--- /dev/null
+++ b/example/plugins/c-api/blocklist_1/readme.txt
@@ -0,0 +1,17 @@
+How to run the blocklist plugin
+===============================
+
+1. Modify blocklist.cgi to specify the location of perl and traffic server.
+2. Copy blocklist.cgi, blocklist_1.so, PoweredByInktomi.gif to the directory
+   specified by the variable proxy.config.plugin.plugin_dir.
+3. Modify plugin.config to load the blocklist plugin.
+
+
+
+About the blocklist plugin
+==========================
+
+The blocklist plugin allows Traffic Server to compare all incoming request
+origin servers with a blocklisted set of web servers. If the requested origin
+server is blocklisted, Traffic Server sends the client a message saying that
+access is denied.
diff --git a/example/plugins/c-api/ssl_sni_whitelist/ssl_sni_whitelist.cc b/example/plugins/c-api/ssl_sni_allowlist/ssl_sni_allowlist.cc
similarity index 92%
rename from example/plugins/c-api/ssl_sni_whitelist/ssl_sni_whitelist.cc
rename to example/plugins/c-api/ssl_sni_allowlist/ssl_sni_allowlist.cc
index 5da3e40..b2e969c 100644
--- a/example/plugins/c-api/ssl_sni_whitelist/ssl_sni_whitelist.cc
+++ b/example/plugins/c-api/ssl_sni_allowlist/ssl_sni_allowlist.cc
@@ -1,6 +1,6 @@
 /** @file
 
-  SSL SNI white list plugin
+  SSL SNI allow list plugin
   If the server name and IP address are not in the ssl_multicert.config
   go ahead and blind tunnel it.
 
@@ -31,13 +31,13 @@
 
 #include <openssl/ssl.h>
 
-#define PLUGIN_NAME "ssl_sni_whitelist"
+#define PLUGIN_NAME "ssl_sni_allowlist"
 #define PCP "[" PLUGIN_NAME "] "
 
 namespace
 {
 int
-CB_servername_whitelist(TSCont /* contp */, TSEvent /* event */, void *edata)
+CB_servername_allowlist(TSCont /* contp */, TSEvent /* event */, void *edata)
 {
   TSVConn ssl_vc         = reinterpret_cast<TSVConn>(edata);
   TSSslConnection sslobj = TSVConnSslConnectionGet(ssl_vc);
@@ -84,7 +84,7 @@ TSPluginInit(int argc, const char *argv[])
     TSError(PCP "registration failed");
   } else if (TSTrafficServerVersionGetMajor() < 2) {
     TSError(PCP "requires Traffic Server 2.0 or later");
-  } else if (nullptr == (cb_sni = TSContCreate(&CB_servername_whitelist, TSMutexCreate()))) {
+  } else if (nullptr == (cb_sni = TSContCreate(&CB_servername_allowlist, TSMutexCreate()))) {
     TSError(PCP "Failed to create SNI callback");
   } else {
     TSHttpHookAdd(TS_SSL_CERT_HOOK, cb_sni);