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 2019/01/08 17:50:50 UTC

[trafficserver] 01/02: sslheaders experimental plugin: fix doc typo, improve container use.

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

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

commit b8bb3807d3c67126b050584707f9dd82da43ae4b
Author: Walter Karas <wk...@oath.com>
AuthorDate: Mon Dec 10 12:12:24 2018 -0600

    sslheaders experimental plugin:  fix doc typo, improve container use.
    
    (cherry picked from commit 9da865baad311542ecd4142a7a111b6e7e46c595)
    
    Conflicts:
    plugins/experimental/sslheaders/sslheaders.cc
    plugins/experimental/sslheaders/sslheaders.h
    
    WARNING:  This commit is present only to record the cherry-pick, otherwise it is useless/non-functional.
---
 doc/admin-guide/plugins/sslheaders.en.rst     |  2 +-
 plugins/experimental/sslheaders/sslheaders.cc |  6 ++----
 plugins/experimental/sslheaders/sslheaders.h  | 14 ++++++++------
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/doc/admin-guide/plugins/sslheaders.en.rst b/doc/admin-guide/plugins/sslheaders.en.rst
index 8fc0881..49a8777 100644
--- a/doc/admin-guide/plugins/sslheaders.en.rst
+++ b/doc/admin-guide/plugins/sslheaders.en.rst
@@ -66,7 +66,7 @@ The `client.certificate` and `server.certificate` fields emit
 the corresponding certificate in PEM format, with newline characters
 replaced by spaces.
 
-If the ``sslheaders`` plugin activtes on non-SSL connections, it
+If the ``sslheaders`` plugin activates on non-SSL connections, it
 will delete all the configured HTTP header names so that malicious
 clients cannot inject misleading information. If any of the SSL
 fields expand to an empty string, those headers are also deleted.
diff --git a/plugins/experimental/sslheaders/sslheaders.cc b/plugins/experimental/sslheaders/sslheaders.cc
index 850f97d..100a27e 100644
--- a/plugins/experimental/sslheaders/sslheaders.cc
+++ b/plugins/experimental/sslheaders/sslheaders.cc
@@ -198,14 +198,12 @@ SslHdrParseOptions(int argc, const char **argv)
   }
 
   // Pick up the remaining options as SSL header expansions.
+  hdr->expansions.resize(argc - optind);
   for (int i = optind; i < argc; ++i) {
-    SslHdrExpansion exp;
-    if (!SslHdrParseExpansion(argv[i], exp)) {
+    if (!SslHdrParseExpansion(argv[i], hdr->expansions[i - optind])) {
       // If we fail, the expansion parsing logs the error.
       return nullptr;
     }
-
-    hdr->expansions.push_back(exp);
   }
 
   return hdr.release();
diff --git a/plugins/experimental/sslheaders/sslheaders.h b/plugins/experimental/sslheaders/sslheaders.h
index 6d43011..9cc2d62 100644
--- a/plugins/experimental/sslheaders/sslheaders.h
+++ b/plugins/experimental/sslheaders/sslheaders.h
@@ -18,9 +18,8 @@
 
 #include <ts/ts.h>
 #include <ts/remap.h>
-#include <string.h>
-#include <list>
-#include <string>
+#include <cstring>
+#include <vector>
 
 extern "C" {
 typedef struct x509_st X509;
@@ -67,12 +66,15 @@ struct SslHdrExpansion {
   ExpansionScope scope;
   ExpansionField field;
 
-private:
-  SslHdrExpansion &operator=(const SslHdrExpansion &);
+  // noncopyable but moveable
+  SslHdrExpansion(const SslHdrExpansion &) = delete;
+  SslHdrExpansion &operator=(const SslHdrExpansion &) = delete;
+  SslHdrExpansion(SslHdrExpansion &&)                 = default;
+  SslHdrExpansion &operator=(SslHdrExpansion &&) = default;
 };
 
 struct SslHdrInstance {
-  typedef std::list<SslHdrExpansion> expansion_list;
+  typedef std::vector<SslHdrExpansion> expansion_list;
 
   SslHdrInstance();
   ~SslHdrInstance();