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 2018/05/11 20:21:36 UTC

[trafficserver] branch master updated: Clean up copy disabling in compress plugin.

This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new d4557f1  Clean up copy disabling in compress plugin.
d4557f1 is described below

commit d4557f160d1ad98d588434ddc6db0c18965c37d5
Author: Walt Karas <wk...@yahoo-inc.com>
AuthorDate: Thu May 10 22:55:28 2018 +0000

    Clean up copy disabling in compress plugin.
---
 plugins/compress/configuration.h                   |  8 +--
 plugins/compress/debug_macros.h                    |  5 --
 tests/gold_tests/pluginTest/compress/compress.gold | 78 ++++------------------
 .../pluginTest/compress/compress.test.py           |  3 +-
 4 files changed, 19 insertions(+), 75 deletions(-)

diff --git a/plugins/compress/configuration.h b/plugins/compress/configuration.h
index dcb9ba2..d20f754 100644
--- a/plugins/compress/configuration.h
+++ b/plugins/compress/configuration.h
@@ -28,6 +28,7 @@
 #include <vector>
 #include "debug_macros.h"
 #include "ts/ink_atomic.h"
+#include <atscppapi/noncopyable.h>
 
 namespace Gzip
 {
@@ -40,7 +41,7 @@ enum CompressionAlgorithm {
   ALGORITHM_BROTLI  = 4 // For bit manipulations
 };
 
-class HostConfiguration
+class HostConfiguration : private atscppapi::noncopyable
 {
 public:
   explicit HostConfiguration(const std::string &host)
@@ -157,13 +158,11 @@ private:
   // maintain backwards compatibility/usability out of the box
   std::set<TSHttpStatus> compressible_status_codes_ = {TS_HTTP_STATUS_OK, TS_HTTP_STATUS_PARTIAL_CONTENT,
                                                        TS_HTTP_STATUS_NOT_MODIFIED};
-
-  DISALLOW_COPY_AND_ASSIGN(HostConfiguration);
 };
 
 typedef std::vector<HostConfiguration *> HostContainer;
 
-class Configuration
+class Configuration : private atscppapi::noncopyable
 {
   friend class HostConfiguration;
 
@@ -178,7 +177,6 @@ private:
 
   HostContainer host_configurations_;
 
-  DISALLOW_COPY_AND_ASSIGN(Configuration);
 }; // class Configuration
 
 } // namespace Gzip
diff --git a/plugins/compress/debug_macros.h b/plugins/compress/debug_macros.h
index 3104052..446461f 100644
--- a/plugins/compress/debug_macros.h
+++ b/plugins/compress/debug_macros.h
@@ -56,9 +56,4 @@
     exit(-1);                                                                           \
   } while (0)
 
-// FIXME: this one doesn't deserve to be here
-#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
-  TypeName(const TypeName &) = delete;     \
-  void operator=(const TypeName &) = delete
-
 #endif //_DBG_MACROS_H
diff --git a/tests/gold_tests/pluginTest/compress/compress.gold b/tests/gold_tests/pluginTest/compress/compress.gold
index d2d3061..af5b4f0 100644
--- a/tests/gold_tests/pluginTest/compress/compress.gold
+++ b/tests/gold_tests/pluginTest/compress/compress.gold
@@ -7,7 +7,6 @@
 < Vary: Accept-Encoding
 < Content-Length: 46
 
-
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: ts/0/gzip
 > Accept-Encoding: gzip
@@ -17,7 +16,6 @@
 < Vary: Accept-Encoding
 < Content-Length: 71
 
-
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: ts/0/br
 > Accept-Encoding: br
@@ -27,15 +25,12 @@
 < Vary: Accept-Encoding
 < Content-Length: 46
 
-
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: ts/0/deflate
 > Accept-Encoding: deflate
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
-< Content-Length: 1050
-
-
+< Content-Length: 1049
 
 > GET http://ae-1/obj1 HTTP/1.1
 > X-Ats-Compress-Test: ts/1/gzip, deflate, sdch, br
@@ -46,7 +41,6 @@
 < Vary: Accept-Encoding
 < Content-Length: 71
 
-
 > GET http://ae-1/obj1 HTTP/1.1
 > X-Ats-Compress-Test: ts/1/gzip
 > Accept-Encoding: gzip
@@ -56,24 +50,19 @@
 < Vary: Accept-Encoding
 < Content-Length: 71
 
-
 > GET http://ae-1/obj1 HTTP/1.1
 > X-Ats-Compress-Test: ts/1/br
 > Accept-Encoding: br
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
-< Content-Length: 1050
-
-
+< Content-Length: 1049
 
 > GET http://ae-1/obj1 HTTP/1.1
 > X-Ats-Compress-Test: ts/1/deflate
 > Accept-Encoding: deflate
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
-< Content-Length: 1050
-
-
+< Content-Length: 1049
 
 > GET http://ae-2/obj2 HTTP/1.1
 > X-Ats-Compress-Test: ts/2/gzip, deflate, sdch, br
@@ -84,7 +73,6 @@
 < Vary: Accept-Encoding
 < Content-Length: 46
 
-
 > GET http://ae-2/obj2 HTTP/1.1
 > X-Ats-Compress-Test: ts/2/gzip
 > Accept-Encoding: gzip
@@ -94,7 +82,6 @@
 < Vary: Accept-Encoding
 < Content-Length: 71
 
-
 > GET http://ae-2/obj2 HTTP/1.1
 > X-Ats-Compress-Test: ts/2/br
 > Accept-Encoding: br
@@ -104,15 +91,12 @@
 < Vary: Accept-Encoding
 < Content-Length: 46
 
-
 > GET http://ae-2/obj2 HTTP/1.1
 > X-Ats-Compress-Test: ts/2/deflate
 > Accept-Encoding: deflate
 < HTTP/1.1 200 OK
 < Content-Type: text/javascript
-< Content-Length: 1050
-
-
+< Content-Length: 1049
 
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: ts2/0/gzip
@@ -123,7 +107,6 @@
 < Vary: Accept-Encoding
 < Content-Length: 71
 
-
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: ts2/0/gzip
 > Accept-Encoding: gzip
@@ -133,7 +116,6 @@
 < Vary: Accept-Encoding
 < Content-Length: 71
 
-
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: ts2/0/br
 > Accept-Encoding: br
@@ -143,15 +125,12 @@
 < 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: 1050
-
-
+< Content-Length: 1049
 
 > GET http://ae-1/obj1 HTTP/1.1
 > X-Ats-Compress-Test: ts2/1/gzip
@@ -162,7 +141,6 @@
 < Vary: Accept-Encoding
 < Content-Length: 71
 
-
 > GET http://ae-1/obj1 HTTP/1.1
 > X-Ats-Compress-Test: ts2/1/gzip
 > Accept-Encoding: gzip
@@ -172,24 +150,19 @@
 < 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: 1050
-
-
+< 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: 1050
-
-
+< Content-Length: 1049
 
 > GET http://ae-2/obj2 HTTP/1.1
 > X-Ats-Compress-Test: ts2/2/gzip
@@ -200,7 +173,6 @@
 < Vary: Accept-Encoding
 < Content-Length: 71
 
-
 > GET http://ae-2/obj2 HTTP/1.1
 > X-Ats-Compress-Test: ts2/2/gzip
 > Accept-Encoding: gzip
@@ -210,7 +182,6 @@
 < Vary: Accept-Encoding
 < Content-Length: 71
 
-
 > GET http://ae-2/obj2 HTTP/1.1
 > X-Ats-Compress-Test: ts2/2/br
 > Accept-Encoding: br
@@ -220,24 +191,19 @@
 < 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: 1050
-
-
+< Content-Length: 1049
 
 > 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: 1050
-
-
+< Content-Length: 1049
 
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: ts3/0/gzip
@@ -248,7 +214,6 @@
 < Vary: Accept-Encoding
 < Content-Length: 71
 
-
 > GET http://ae-0/obj0 HTTP/1.1
 > X-Ats-Compress-Test: ts3/0/br
 > Accept-Encoding: br
@@ -258,24 +223,19 @@
 < 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: 1050
-
-
+< 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: 1050
-
-
+< Content-Length: 1049
 
 > GET http://ae-1/obj1 HTTP/1.1
 > X-Ats-Compress-Test: ts3/1/gzip
@@ -286,7 +246,6 @@
 < Vary: Accept-Encoding
 < Content-Length: 71
 
-
 > GET http://ae-1/obj1 HTTP/1.1
 > X-Ats-Compress-Test: ts3/1/br
 > Accept-Encoding: br
@@ -296,24 +255,19 @@
 < 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: 1050
-
-
+< 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: 1050
-
-
+< Content-Length: 1049
 
 > GET http://ae-2/obj2 HTTP/1.1
 > X-Ats-Compress-Test: ts3/2/gzip
@@ -324,7 +278,6 @@
 < Vary: Accept-Encoding
 < Content-Length: 71
 
-
 > GET http://ae-2/obj2 HTTP/1.1
 > X-Ats-Compress-Test: ts3/2/br
 > Accept-Encoding: br
@@ -334,13 +287,10 @@
 < 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: 1050
-
-
+< Content-Length: 1049
 
diff --git a/tests/gold_tests/pluginTest/compress/compress.test.py b/tests/gold_tests/pluginTest/compress/compress.test.py
index 818abce..65d2890 100644
--- a/tests/gold_tests/pluginTest/compress/compress.test.py
+++ b/tests/gold_tests/pluginTest/compress/compress.test.py
@@ -43,7 +43,8 @@ def repeat(str, count):
     return result
 
 # Need a fairly big body, otherwise the plugin will refuse to compress
-body = repeat("lets go surfin now everybodys learnin how\n", 25)
+body = repeat("lets go surfin now everybodys learnin how\n", 24)
+body = body + "lets go surfin now everybodys learnin how"
 
 # expected response from the origin server
 response_header = {

-- 
To stop receiving notification emails like this one, please contact
zwoop@apache.org.