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 2013/04/28 21:58:33 UTC

[1/2] git commit: TS-1732 Do an ugly const_cast to work around an anomaly on Solaris. On linux, this cast is a "no-op", since the struct option is sane and the compile with convert it back to a const char*. Always doing the const_cast avoids #ifdef's to

Updated Branches:
  refs/heads/master 8ba444a60 -> d1bb9ed9e


TS-1732 Do an ugly const_cast to work around an anomaly on Solaris.
On linux, this cast is a "no-op", since the struct option is sane
and the compile with convert it back to a const char*. Always doing
the const_cast avoids #ifdef's to maintain.


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/854c6c18
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/854c6c18
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/854c6c18

Branch: refs/heads/master
Commit: 854c6c18b524c749b437d18009e2b13c78cbc5ce
Parents: 8ba444a
Author: Leif Hedstrom <zw...@apache.org>
Authored: Sun Apr 28 13:49:31 2013 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Sun Apr 28 13:49:31 2013 -0600

----------------------------------------------------------------------
 plugins/experimental/authproxy/authproxy.cc |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/854c6c18/plugins/experimental/authproxy/authproxy.cc
----------------------------------------------------------------------
diff --git a/plugins/experimental/authproxy/authproxy.cc b/plugins/experimental/authproxy/authproxy.cc
index 4254879..b46d3d6 100644
--- a/plugins/experimental/authproxy/authproxy.cc
+++ b/plugins/experimental/authproxy/authproxy.cc
@@ -706,12 +706,15 @@ AuthProxyGlobalHook(TSCont /* cont ATS_UNUSED */, TSEvent event, void * edata)
 static AuthOptions *
 AuthParseOptions(int argc, const char ** argv)
 {
+  // The const_cast<> here is magic to work around a flaw in the definition of struct option
+  // on some platforms (e.g. Solaris / Illumos). On sane platforms (e.g. linux), it'll get
+  // automatically casted back to the const char*, as the struct is defined in <getopt.h>.
     static const struct option longopt[] =
     {
-        { "auth-host", required_argument, 0, 'h' },
-        { "auth-port", required_argument, 0, 'p' },
-        { "auth-transform", required_argument, 0, 't' },
-        { "force-cacheability", no_argument, 0, 'c' },
+        { const_cast<char *>("auth-host"), required_argument, 0, 'h' },
+        { const_cast<char *>("auth-port"), required_argument, 0, 'p' },
+        { const_cast<char *>("auth-transform"), required_argument, 0, 't' },
+        { const_cast<char *>("force-cacheability"), no_argument, 0, 'c' },
         {0, 0, 0, 0 }
     };
 
@@ -760,6 +763,7 @@ AuthParseOptions(int argc, const char ** argv)
 
     return options;
 }
+#undef LONGOPT_OPTION_CAST
 
 void
 TSPluginInit(int argc, const char *argv[])


[2/2] git commit: TS-1860 cacheurl doesn't compile on platforms with pcre/pcre.h (e.g. solaris).

Posted by zw...@apache.org.
TS-1860 cacheurl doesn't compile on platforms with pcre/pcre.h (e.g.
solaris).


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/d1bb9ed9
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/d1bb9ed9
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/d1bb9ed9

Branch: refs/heads/master
Commit: d1bb9ed9e1f12de3f97c0c5101e848c96e2a18da
Parents: 854c6c1
Author: Leif Hedstrom <zw...@apache.org>
Authored: Sun Apr 28 13:54:53 2013 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Sun Apr 28 13:54:53 2013 -0600

----------------------------------------------------------------------
 CHANGES                                  |    3 +++
 plugins/experimental/cacheurl/cacheurl.c |    9 ++++++++-
 2 files changed, 11 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d1bb9ed9/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index b1a039e..8691daf 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@
   Changes with Apache Traffic Server 3.3.3
 
 
+  *) [TS-1860] cacheurl doesn't compile on platforms with pcre/pcre.h
+   (e.g. solaris).
+
   *) [TS-1729] Fix channel_stats to compile on various Unixen. Note that this
    is still IPV4 only.
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d1bb9ed9/plugins/experimental/cacheurl/cacheurl.c
----------------------------------------------------------------------
diff --git a/plugins/experimental/cacheurl/cacheurl.c b/plugins/experimental/cacheurl/cacheurl.c
index 4d330ed..fff57a8 100644
--- a/plugins/experimental/cacheurl/cacheurl.c
+++ b/plugins/experimental/cacheurl/cacheurl.c
@@ -23,9 +23,16 @@
  */
 
 #include <stdio.h>
-#include <pcre.h>
 #include <string.h>
 
+#include "ink_config.h"
+
+#ifdef HAVE_PCRE_PCRE_H
+#include <pcre/pcre.h>
+#else
+#include <pcre.h>
+#endif
+
 #include "ts/ts.h"
 #include "ts/remap.h"
 #include "ink_defs.h"