[trafficserver] branch master updated: Fix OS X build.

2017-09-06 Thread sorber
This is an automated email from the ASF dual-hosted git repository.

sorber 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 2941c0b  Fix OS X build.
2941c0b is described below

commit 2941c0b4b8fbb66cc2e722157151f129237bac33
Author: Phil Sorber 
AuthorDate: Wed Sep 6 19:51:44 2017 -0600

Fix OS X build.
---
 iocore/cache/CacheRead.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/iocore/cache/CacheRead.cc b/iocore/cache/CacheRead.cc
index 1ed7dd0..0ea053d 100644
--- a/iocore/cache/CacheRead.cc
+++ b/iocore/cache/CacheRead.cc
@@ -1094,7 +1094,7 @@ CacheVC::openReadStartHead(int event, Event *e)
 }
   }
   Note("OpenReadHead failed for cachekey %X : vector inconsistency - "
-   "unmarshalled %d expecting %d in %d (base=%" PRIu64 ", 
ver=%d:%d) "
+   "unmarshalled %d expecting %d in %d (base=%zu, ver=%d:%d) "
"- vector n=%d size=%d"
"first alt=%d[%s]",
key.slice32(0), uml, doc->hlen, doc->len, sizeof(Doc), 
doc->v_major, doc->v_minor, vector.count(), alt_length,

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" '].


[trafficserver] branch master updated: Fix sizeofDoc silliness.

2017-09-06 Thread sorber
This is an automated email from the ASF dual-hosted git repository.

sorber 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 338b8ab  Fix sizeofDoc silliness.
338b8ab is described below

commit 338b8ab21a75d957984a5b1af21be67660c010ab
Author: Phil Sorber 
AuthorDate: Wed Sep 6 14:11:31 2017 -0600

Fix sizeofDoc silliness.
---
 iocore/cache/Cache.cc  | 12 ++--
 iocore/cache/CacheDir.cc   |  4 ++--
 iocore/cache/CacheRead.cc  |  4 ++--
 iocore/cache/CacheWrite.cc | 16 
 iocore/cache/P_CacheBC.h   |  7 +++
 iocore/cache/P_CacheVol.h  | 15 ++-
 6 files changed, 27 insertions(+), 31 deletions(-)

diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index daa6ea9..60cd63e 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -2215,7 +2215,7 @@ upgrade_doc_version(Ptr )
 char *dst;
 char *hdr_limit = doc->data();
 HTTPInfo::FragOffset *frags =
-  reinterpret_cast(static_cast(buf->data()) + cache_bc::sizeofDoc_v23);
+  reinterpret_cast(static_cast(buf->data()) + sizeof(cache_bc::Doc_v23));
 int frag_count  = doc->_flen / sizeof(HTTPInfo::FragOffset);
 size_t n= 0;
 size_t content_size = doc->data_len();
@@ -2229,10 +2229,10 @@ upgrade_doc_version(Ptr )
 
 src = buf->data();
 dst = d_buf->data();
-memcpy(dst, src, sizeofDoc);
-src += sizeofDoc + doc->_flen;
-dst += sizeofDoc;
-n -= sizeofDoc;
+memcpy(dst, src, sizeof(Doc));
+src += sizeof(Doc) + doc->_flen;
+dst += sizeof(Doc);
+n -= sizeof(Doc);
 
 // We copy the fragment table iff there is a fragment table and there 
is only one alternate.
 if (frag_count > 0 && cache_bc::HTTPInfo_v21::marshalled_length(src) > 
doc->hlen) {
@@ -2247,7 +2247,7 @@ upgrade_doc_version(Ptr )
   // Must update new Doc::len and Doc::hlen
   // dst points at the first byte of the content, or one past the last 
byte of the alt header.
   d_doc->len  = (dst - reinterpret_cast(d_doc)) + content_size;
-  d_doc->hlen = (dst - reinterpret_cast(d_doc)) - sizeofDoc;
+  d_doc->hlen = (dst - reinterpret_cast(d_doc)) - sizeof(Doc);
   buf = d_buf; // replace original buffer with new buffer.
 } else {
   zret = false;
diff --git a/iocore/cache/CacheDir.cc b/iocore/cache/CacheDir.cc
index 2616d81..01c76ef 100644
--- a/iocore/cache/CacheDir.cc
+++ b/iocore/cache/CacheDir.cc
@@ -605,7 +605,7 @@ dir_insert(const CacheKey *key, Vol *d, Dir *to_part)
   ink_assert(d->mutex->thread_holding == this_ethread());
   int s  = key->slice32(0) % d->segments, l;
   int bi = key->slice32(1) % d->buckets;
-  ink_assert(dir_approx_size(to_part) <= MAX_FRAG_SIZE + sizeofDoc);
+  ink_assert(dir_approx_size(to_part) <= MAX_FRAG_SIZE + sizeof(Doc));
   Dir *seg = dir_segment(s, d);
   Dir *e   = nullptr;
   Dir *b   = dir_bucket(bi, seg);
@@ -671,7 +671,7 @@ dir_overwrite(const CacheKey *key, Vol *d, Dir *dir, Dir 
*overwrite, bool must_o
   Vol *vol = d;
   CHECK_DIR(d);
 
-  ink_assert((unsigned int)dir_approx_size(dir) <= (unsigned 
int)(MAX_FRAG_SIZE + sizeofDoc)); // XXX - size should be unsigned
+  ink_assert((unsigned int)dir_approx_size(dir) <= (unsigned 
int)(MAX_FRAG_SIZE + sizeof(Doc))); // XXX - size should be unsigned
 Lagain:
   // find entry to overwrite
   e = b;
diff --git a/iocore/cache/CacheRead.cc b/iocore/cache/CacheRead.cc
index b9a6ccd..1ed7dd0 100644
--- a/iocore/cache/CacheRead.cc
+++ b/iocore/cache/CacheRead.cc
@@ -1094,10 +1094,10 @@ CacheVC::openReadStartHead(int event, Event *e)
 }
   }
   Note("OpenReadHead failed for cachekey %X : vector inconsistency - "
-   "unmarshalled %d expecting %d in %d (base=%d, ver=%d:%d) "
+   "unmarshalled %d expecting %d in %d (base=%" PRIu64 ", 
ver=%d:%d) "
"- vector n=%d size=%d"
"first alt=%d[%s]",
-   key.slice32(0), uml, doc->hlen, doc->len, sizeofDoc, 
doc->v_major, doc->v_minor, vector.count(), alt_length,
+   key.slice32(0), uml, doc->hlen, doc->len, sizeof(Doc), 
doc->v_major, doc->v_minor, vector.count(), alt_length,
alt->m_magic,
(CACHE_ALT_MAGIC_ALIVE == alt->m_magic ?
   "alive" :
diff --git a/iocore/cache/CacheWrite.cc b/iocore/cache/CacheWrite.cc
index 5871980..d633799 100644
--- a/iocore/cache/CacheWrite.cc
+++ b/iocore/cache/CacheWrite.cc
@@ -190,9 +190,9 @@ CacheVC::handleWrite(int event, Event * /* e ATS_UNUSED */)
 
   set_agg_write_in_progress();
   POP_HANDLER;
-  agg_len = vol->round_to_approx_size(write_len + header_len + frag_len + 
sizeofDoc);
+  agg_len = vol->round_to_approx_size(write_len + header_len + frag_len + 

[trafficserver] branch master updated: Fix logging of cache stale miss connecton error being reported as TCP_HIT/502 to ERR_CONNECT_FAIL/502.

2017-09-06 Thread zwoop
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 9c07093  Fix logging of cache stale miss connecton error being 
reported as TCP_HIT/502 to ERR_CONNECT_FAIL/502.
9c07093 is described below

commit 9c070937be512f55d838675c9ff6c95e83afd14d
Author: Peter Chou 
AuthorDate: Wed Aug 30 15:52:34 2017 -0700

Fix logging of cache stale miss connecton error being reported as
TCP_HIT/502 to ERR_CONNECT_FAIL/502.
---
 proxy/http/HttpTransact.cc| 4 +++-
 proxy/http/HttpTransactHeaders.cc | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 67e9247..c9c0fdf 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -2354,8 +2354,10 @@ HttpTransact::HandleCacheOpenReadHitFreshness(State *s)
   }
 
   ink_assert(s->cache_lookup_result != HttpTransact::CACHE_LOOKUP_MISS);
-  if (s->cache_lookup_result == HttpTransact::CACHE_LOOKUP_HIT_STALE)
+  if (s->cache_lookup_result == HttpTransact::CACHE_LOOKUP_HIT_STALE) {
 SET_VIA_STRING(VIA_DETAIL_CACHE_LOOKUP, VIA_DETAIL_MISS_EXPIRED);
+SET_VIA_STRING(VIA_CACHE_RESULT, VIA_IN_CACHE_STALE);
+  }
 
   if (!s->force_dns) { // If DNS is not performed before
 if (need_to_revalidate(s)) {
diff --git a/proxy/http/HttpTransactHeaders.cc 
b/proxy/http/HttpTransactHeaders.cc
index ee2bb38..69b97c1 100644
--- a/proxy/http/HttpTransactHeaders.cc
+++ b/proxy/http/HttpTransactHeaders.cc
@@ -591,7 +591,7 @@ HttpTransactHeaders::generate_and_set_squid_codes(HTTPHdr 
*header, char *via_str
 log_code = SQUID_LOG_ERR_PROXY_DENIED;
 break;
   case VIA_ERROR_CONNECTION:
-if (log_code == SQUID_LOG_TCP_MISS) {
+if (log_code == SQUID_LOG_TCP_MISS || log_code == 
SQUID_LOG_TCP_REFRESH_MISS) {
   log_code = SQUID_LOG_ERR_CONNECT_FAIL;
 }
 break;

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" '].


[trafficserver] branch master updated: TS-4976: Regularize plugins - ssl_sni_whitelist.

2017-09-06 Thread amc
This is an automated email from the ASF dual-hosted git repository.

amc 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 acab1e2  TS-4976: Regularize plugins - ssl_sni_whitelist.
acab1e2 is described below

commit acab1e20f1dd2a0ac2e879657b5809dbd9c1bbac
Author: Alan M. Carroll 
AuthorDate: Mon Sep 4 12:07:32 2017 -0500

TS-4976: Regularize plugins - ssl_sni_whitelist.
---
 example/Makefile.am|  4 ++--
 .../ssl_sni_whitelist.cc}  | 26 ++
 .../ssl_sni_whitelist.config   |  0
 3 files changed, 9 insertions(+), 21 deletions(-)

diff --git a/example/Makefile.am b/example/Makefile.am
index eab366f..4e1df3b 100644
--- a/example/Makefile.am
+++ b/example/Makefile.am
@@ -54,7 +54,7 @@ example_Plugins = \
server_transform.la \
session_hooks.la \
ssl_preaccept.la \
-   ssl-sni-whitelist.la \
+   ssl_sni_whitelist.la \
ssl_sni.la \
statistic.la \
thread-1.la \
@@ -120,7 +120,7 @@ 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_la_LIBADD = $(libtsconfig)
-ssl_sni_whitelist_la_SOURCES = ssl-sni-whitelist/ssl-sni-whitelist.cc
+ssl_sni_whitelist_la_SOURCES = ssl_sni_whitelist/ssl_sni_whitelist.cc
 ssl_sni_whitelist_la_LIBADD = $(libtsconfig)
 disable_http2_la_SOURCES = disable_http2/disable_http2.cc
 statistic_la_SOURCES = statistic/statistic.cc
diff --git a/example/ssl-sni-whitelist/ssl-sni-whitelist.cc 
b/example/ssl_sni_whitelist/ssl_sni_whitelist.cc
similarity index 87%
rename from example/ssl-sni-whitelist/ssl-sni-whitelist.cc
rename to example/ssl_sni_whitelist/ssl_sni_whitelist.cc
index c4dd585..49c8f3f 100644
--- a/example/ssl-sni-whitelist/ssl-sni-whitelist.cc
+++ b/example/ssl_sni_whitelist/ssl_sni_whitelist.cc
@@ -35,10 +35,8 @@
 using ts::config::Configuration;
 using ts::config::Value;
 
-#define PN "ssl-sni-whitelist"
-#define PCP "[" PN " Plugin] "
-
-#if TS_USE_TLS_SNI
+#define PLUGIN_NAME "ssl_sni_whitelist"
+#define PCP "[" PLUGIN_NAME "] "
 
 namespace
 {
@@ -112,9 +110,9 @@ TSPluginInit(int argc, const char *argv[])
 {const_cast("config"), required_argument, nullptr, 'c'}, {nullptr, 
no_argument, nullptr, '\0'},
   };
 
-  info.plugin_name   = const_cast("SSL SNI whitelist");
-  info.vendor_name   = const_cast("Network Geographics");
-  info.support_email = const_cast("shinr...@network-geographics.com");
+  info.plugin_name   = PLUGIN_NAME;
+  info.vendor_name   = "Apache Software Foundation";
+  info.support_email = "d...@trafficserver.apache.org";
 
   int opt = 0;
   while (opt >= 0) {
@@ -129,7 +127,7 @@ TSPluginInit(int argc, const char *argv[])
   if (ConfigPath.length() == 0) {
 static const char *const DEFAULT_CONFIG_PATH = "ssl_sni_whitelist.config";
 ConfigPath   = 
std::string(TSConfigDirGet()) + '/' + std::string(DEFAULT_CONFIG_PATH);
-TSDebug(PN, "No config path set in arguments, using default: %s", 
DEFAULT_CONFIG_PATH);
+TSDebug(PLUGIN_NAME, "No config path set in arguments, using default: %s", 
DEFAULT_CONFIG_PATH);
   }
 
   if (TS_SUCCESS != TSPluginRegister()) {
@@ -148,17 +146,7 @@ TSPluginInit(int argc, const char *argv[])
   if (!success) {
 TSError(PCP "not initialized");
   }
-  TSDebug(PN, "Plugin %s", success ? "online" : "offline");
+  TSDebug(PLUGIN_NAME, "Plugin %s", success ? "online" : "offline");
 
   return;
 }
-
-#else // ! TS_USE_TLS_SNI
-
-void
-TSPluginInit(int, const char *[])
-{
-  TSError(PCP "requires TLS SNI which is not available");
-}
-
-#endif // TS_USE_TLS_SNI
diff --git a/example/ssl-sni-whitelist/ssl_sni_whitelist.config 
b/example/ssl_sni_whitelist/ssl_sni_whitelist.config
similarity index 100%
rename from example/ssl-sni-whitelist/ssl_sni_whitelist.config
rename to example/ssl_sni_whitelist/ssl_sni_whitelist.config

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" '].


[trafficserver] branch quic-latest updated: Rename buffer for received STREAM frame

2017-09-06 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/quic-latest by this push:
 new 6d8eee5  Rename buffer for received STREAM frame
6d8eee5 is described below

commit 6d8eee58fb8abdff2e796c0f1a9f12ba64ec37f6
Author: Masaori Koshiba 
AuthorDate: Wed Sep 6 16:35:15 2017 +0900

Rename buffer for received STREAM frame
---
 iocore/net/quic/QUICStream.cc | 10 +-
 iocore/net/quic/QUICStream.h  |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/iocore/net/quic/QUICStream.cc b/iocore/net/quic/QUICStream.cc
index c16d0dd..0ca060d 100644
--- a/iocore/net/quic/QUICStream.cc
+++ b/iocore/net/quic/QUICStream.cc
@@ -267,10 +267,10 @@ QUICStream::_write_to_read_vio(const 
std::shared_ptr 
 void
 QUICStream::_reorder_data()
 {
-  auto frame = _request_stream_frame_buffer.find(this->_recv_offset);
-  while (frame != this->_request_stream_frame_buffer.end()) {
+  auto frame = _received_stream_frame_buffer.find(this->_recv_offset);
+  while (frame != this->_received_stream_frame_buffer.end()) {
 this->_write_to_read_vio(frame->second);
-frame = _request_stream_frame_buffer.find(this->_recv_offset);
+frame = _received_stream_frame_buffer.find(this->_recv_offset);
   }
 }
 
@@ -310,9 +310,9 @@ QUICStream::recv(const std::shared_ptr frame)
 this->_write_to_read_vio(frame);
 this->_reorder_data();
   } else {
-// NOTE: push fragments in _request_stream_frame_buffer temporally.
+// NOTE: push fragments in _received_stream_frame_buffer temporally.
 // They will be reordered when missing data is filled and offset is 
matched.
-this->_request_stream_frame_buffer.insert(std::make_pair(frame->offset(), 
frame));
+this->_received_stream_frame_buffer.insert(std::make_pair(frame->offset(), 
frame));
   }
 
   return QUICError(QUICErrorClass::NONE);
diff --git a/iocore/net/quic/QUICStream.h b/iocore/net/quic/QUICStream.h
index 0c3e73b..ff7bb14 100644
--- a/iocore/net/quic/QUICStream.h
+++ b/iocore/net/quic/QUICStream.h
@@ -105,7 +105,7 @@ private:
 
   // Fragments of received STREAM frame (offset is unmatched)
   // TODO: Consider to replace with ts/RbTree.h or other data structure
-  std::map 
_request_stream_frame_buffer;
+  std::map 
_received_stream_frame_buffer;
 
   QUICStreamManager *_stream_manager = nullptr;
   QUICFrameTransmitter *_tx  = nullptr;

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" '].


[trafficserver] branch master updated: Coverity: CID 1380282: Error handling issues (CHECKED_RETURN)

2017-09-06 Thread oknet
This is an automated email from the ASF dual-hosted git repository.

oknet 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 55f7449  Coverity: CID 1380282:  Error handling issues  
(CHECKED_RETURN)
55f7449 is described below

commit 55f7449ef3dc12224182a820a087911906917f4c
Author: Oknet Xu 
AuthorDate: Mon Sep 4 23:45:22 2017 +0800

Coverity: CID 1380282:  Error handling issues  (CHECKED_RETURN)
---
 proxy/InkAPITest.cc | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc
index 6ed87d3..a73ce52 100644
--- a/proxy/InkAPITest.cc
+++ b/proxy/InkAPITest.cc
@@ -1622,12 +1622,13 @@ REGRESSION_TEST(SDK_API_TSMutexCreate)(RegressionTest 
*test, int /* atype ATS_UN
   TSMutexLock(mutexp);
 
   /* This is normal because all locking is from the same thread */
-  TSReturnCode lock = TS_ERROR;
+  TSReturnCode lock1 = TS_ERROR;
+  TSReturnCode lock2 = TS_ERROR;
 
-  TSMutexLockTry(mutexp);
-  lock = TSMutexLockTry(mutexp);
+  lock1 = TSMutexLockTry(mutexp);
+  lock2 = TSMutexLockTry(mutexp);
 
-  if (TS_SUCCESS == lock) {
+  if (TS_SUCCESS == lock1 && TS_SUCCESS == lock2) {
 SDK_RPRINT(test, "TSMutexCreate", "TestCase1", TC_PASS, "ok");
 SDK_RPRINT(test, "TSMutexLock", "TestCase1", TC_PASS, "ok");
 SDK_RPRINT(test, "TSMutexLockTry", "TestCase1", TC_PASS, "ok");

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" '].