[trafficserver] branch master updated: Add range check of Http2SettingsIdentifier

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

masaori 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  c2bc17d   Add range check of Http2SettingsIdentifier
c2bc17d is described below

commit c2bc17d665ccd70e7e33ca3c456f2e4146ea20a6
Author: Masaori Koshiba 
AuthorDate: Tue May 30 15:50:02 2017 +0900

Add range check of Http2SettingsIdentifier
---
 proxy/http2/Http2ConnectionState.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/proxy/http2/Http2ConnectionState.h 
b/proxy/http2/Http2ConnectionState.h
index 3ba9af4..05e9895 100644
--- a/proxy/http2/Http2ConnectionState.h
+++ b/proxy/http2/Http2ConnectionState.h
@@ -69,7 +69,7 @@ public:
   unsigned
   get(Http2SettingsIdentifier id) const
   {
-if (id < HTTP2_SETTINGS_MAX) {
+if (0 < id && id < HTTP2_SETTINGS_MAX) {
   return this->settings[indexof(id)];
 } else {
   ink_assert(!"Bad Settings Identifier");
@@ -95,7 +95,7 @@ private:
   static unsigned
   indexof(Http2SettingsIdentifier id)
   {
-ink_assert(id < HTTP2_SETTINGS_MAX);
+ink_assert(0 < id && id < HTTP2_SETTINGS_MAX);
 
 return id - 1;
   }

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


[trafficserver] branch 7.1.x updated: This should allow for per-version binaries

2017-05-30 Thread zwoop
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

The following commit(s) were added to refs/heads/7.1.x by this push:
   new  c7d48e2   This should allow for per-version binaries
c7d48e2 is described below

commit c7d48e2dcd97516c8b66ca365046a2d50352b5ed
Author: Leif Hedstrom 
AuthorDate: Tue May 30 10:26:00 2017 -0600

This should allow for per-version binaries
---
 tools/clang-format.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/clang-format.sh b/tools/clang-format.sh
index 293965b..1695140 100755
--- a/tools/clang-format.sh
+++ b/tools/clang-format.sh
@@ -20,9 +20,10 @@
 
 set -e # exit on error
 
+PKGDATE="20160415"
 DIR=${1:-.}
-ROOT=${ROOT:-$(cd $(dirname $0) && git rev-parse --show-toplevel)/.git/fmt}
-PACKAGE="clang-format-20160415.tar.bz2"
+ROOT=${ROOT:-$(cd $(dirname $0) && git rev-parse 
--show-toplevel)/.git/fmt/${PKGDATE}}
+PACKAGE="clang-format-${PKGDATE}.tar.bz2"
 VERSION="clang-format version 3.9.0 (trunk 265913)"
 
 
URL=${URL:-https://bintray.com/artifact/download/apache/trafficserver/${PACKAGE}}

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


[trafficserver] branch master updated: coverity 1021718: Uninitialized pointer field

2017-05-30 Thread bcall
This is an automated email from the ASF dual-hosted git repository.

bcall 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  b92d718   coverity 1021718: Uninitialized pointer field
b92d718 is described below

commit b92d7182033ea62058f45801932edea2cf1b9ed2
Author: Bryan Call 
AuthorDate: Mon May 29 19:44:05 2017 -0700

coverity 1021718: Uninitialized pointer field
---
 proxy/FetchSM.h | 64 ++---
 1 file changed, 25 insertions(+), 39 deletions(-)

diff --git a/proxy/FetchSM.h b/proxy/FetchSM.h
index 277e6d4..f7cc849 100644
--- a/proxy/FetchSM.h
+++ b/proxy/FetchSM.h
@@ -43,19 +43,6 @@ public:
   void
   init_comm()
   {
-is_internal_request= true;
-recursion  = 0;
-req_finished   = 0;
-is_method_head = 0;
-header_done= 0;
-user_data  = NULL;
-has_sent_header= false;
-destroyed  = false;
-req_content_length = 0;
-resp_is_chunked= -1;
-resp_content_length= -1;
-resp_received_body_len = 0;
-resp_received_close= -1;
 cont_mutex.clear();
 req_buffer  = new_MIOBuffer(HTTP_HEADER_BUFFER_SIZE_INDEX);
 req_reader  = req_buffer->alloc_reader();
@@ -63,7 +50,6 @@ public:
 resp_reader = resp_buffer->alloc_reader();
 http_parser_init(_parser);
 client_response_hdr.create(HTTP_TYPE_RESPONSE);
-client_response = NULL;
 SET_HANDLER(::fetch_handler);
   }
 
@@ -154,37 +140,37 @@ private:
   bool check_connection_close();
   int dechunk_body();
 
-  int recursion;
-  PluginVC *http_vc;
-  VIO *read_vio;
-  VIO *write_vio;
-  MIOBuffer *req_buffer;
-  IOBufferReader *req_reader;
-  char *client_response;
-  int client_bytes;
-  MIOBuffer *resp_buffer; // response to HttpConnect Call
-  IOBufferReader *resp_reader;
-  Continuation *contp;
+  int recursion   = 0;
+  PluginVC *http_vc   = nullptr;
+  VIO *read_vio   = nullptr;
+  VIO *write_vio  = nullptr;
+  MIOBuffer *req_buffer   = nullptr;
+  IOBufferReader *req_reader  = nullptr;
+  char *client_response   = nullptr;
+  int client_bytes= -1;
+  MIOBuffer *resp_buffer  = nullptr; // response to HttpConnect Call
+  IOBufferReader *resp_reader = nullptr;
+  Continuation *contp = nullptr;
   Ptr cont_mutex;
   HTTPParser http_parser;
   HTTPHdr client_response_hdr;
   ChunkedHandler chunked_handler;
   TSFetchEvent callback_events;
-  TSFetchWakeUpOptions callback_options;
-  bool req_finished;
-  bool header_done;
-  bool is_method_head;
-  bool is_internal_request;
-  bool destroyed;
+  TSFetchWakeUpOptions callback_options = NO_CALLBACK;
+  bool req_finished = false;
+  bool header_done  = false;
+  bool is_method_head   = false;
+  bool is_internal_request  = true;
+  bool destroyed= false;
   IpEndpoint _addr;
-  int resp_is_chunked;
-  int resp_received_close;
-  int fetch_flags;
-  void *user_data;
-  bool has_sent_header;
-  int64_t req_content_length;
-  int64_t resp_content_length;
-  int64_t resp_received_body_len;
+  int resp_is_chunked= -1;
+  int resp_received_close= -1;
+  int fetch_flags= 0;
+  void *user_data= nullptr;
+  bool has_sent_header   = false;
+  int64_t req_content_length = 0;
+  int64_t resp_content_length= -1;
+  int64_t resp_received_body_len = 0;
 };
 
 #endif

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


[trafficserver] branch master updated: Issue #1605 AWS Signature Version 4

2017-05-30 Thread gancho
This is an automated email from the ASF dual-hosted git repository.

gancho 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  fa73136   Issue #1605 AWS Signature Version 4
fa73136 is described below

commit fa731369b474cb3c46b7b8ddf98490c198cd4605
Author: Gancho Tenev 
AuthorDate: Tue Apr 25 13:02:44 2017 -0700

Issue #1605 AWS Signature Version 4

Signature Calculations for the Authorization Header:
Transferring Payload in a Single Chunk (Unsigned payload option)

http://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-header-based-auth.html
---
 doc/admin-guide/plugins/s3_auth.en.rst | 114 --
 plugins/s3_auth/Makefile.inc   |   2 +-
 plugins/s3_auth/aws_auth_v4.cc | 691 +
 plugins/s3_auth/aws_auth_v4.h  | 207 ++
 plugins/s3_auth/s3_auth.cc | 273 -
 5 files changed, 1247 insertions(+), 40 deletions(-)

diff --git a/doc/admin-guide/plugins/s3_auth.en.rst 
b/doc/admin-guide/plugins/s3_auth.en.rst
index d6f5709..7293188 100644
--- a/doc/admin-guide/plugins/s3_auth.en.rst
+++ b/doc/admin-guide/plugins/s3_auth.en.rst
@@ -27,57 +27,119 @@ to use ``S3`` as your origin server, yet want to avoid 
direct user access to
 the content.
 
 Using the plugin
-
+
 
-There are three configuration options for this plugin::
-
---access_key
---secret_key
---virtual_host
---config
 
+Using the plugin in a remap rule would be e.g.::
 
-Using the first two in a remap rule would be e.g.::
+   # remap.config
 
...  @plugin=s3_auth @pparam=--access_key @pparam=my-key \
 @pparam=--secret_key @pparam=my-secret \
@pparam=--virtual_host
 
 
-Alternatively, you can store the access key and secret in an external
-configuration file, and point the remap rule(s) to it:
+Alternatively, you can store the access key and secret in an external 
configuration file, and point the remap rule(s) to it::
 
-   ...  @plugin=s3_auth @pparam=--config @pparam=s3.config
+   # remap.config
 
+   ...  @plugin=s3_auth @pparam=--config @pparam=s3_auth_v2.config
 
-Where s3.config would look like::
 
-# AWS S3 authentication
-access_key=my-key
-secret_key=my-secret
-virtual_host=yes
+Where ``s3.config`` could look like::
 
+# s3_auth_v2.config
 
-For more details on the S3 auth, see::
+access_key=my-key
+secret_key=my-secret
+version=2
+virtual_host=yes
 
-  http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html
+Both ways could be combined as well
 
 
-ToDo
-
+AWS Authentication version 4
+
 
-This is a pretty barebone start for the S3 services, it is missing a number of 
features:
+The s3_auth plugin fully implements: `AWS Signing Version 4 
`_
 / `Authorization Header 
`_
 / `Transferring Payload in a Single Chunk 
`_
 / Unsigned Payload Option
 
-- It does not do UTF8 encoding (as required)
+Configuration options::
 
-- It only implements the v2 authentication mechanism. For details on v4, see
+# Mandatory options
+--access_key=
+--secret_key=
+--version=4
 
-  
http://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html
+# Optional
+--v4-include-headers=
+--v4-exclude-headers=
+--v4-region-map=region_map.config
 
-- It does not deal with canonicalization of AMZ headers.
 
-- It does not handle POST requests (but do we need to ?)
+If the following option is used then the options could be specified in a file::
+
+--config=s3_auth_v4.config
+
+
+The ``s3_auth_v4.config`` config file could look like this::
+
+# s3_auth_v4.config
+
+access_key=
+secret_key=
+version=4
+v4-include-headers=
+v4-exclude-headers=
+v4-region-map=region_map.config
+
+Where the ``region_map.config`` defines the entry-point hostname to region 
mapping i.e.::
+
+# region_map.config
+
+# "us-east-1"
+s3.amazonaws.com : us-east-1
+s3-external-1.amazonaws.com  : us-east-1
+s3.dualstack.us-east-1.amazonaws.com : us-east-1
+
+# us-west-1
+s3-us-west-1.amazonaws.com   : us-west-1
+s3.dualstack.us-west-1.amazonaws.com : us-west-1
+
+# Default region if no entry-point matches:
+: s3.amazonaws.com
+
+If ``--v4-region-map`` is not specified the plugin defaults to the mapping 
defined in `"Regions and Endpoints - S3" 
`_
 
+According to `Transferring 

[trafficserver] branch master updated: Add logic to flush gcov data from traffic_server on interrupt.

2017-05-30 Thread shinrich
This is an automated email from the ASF dual-hosted git repository.

shinrich 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  1f54cf0   Add logic to flush gcov data from traffic_server on 
interrupt.
1f54cf0 is described below

commit 1f54cf0c41d3bcb09f4759ccbee509d14ec1ded9
Author: Susan Hinrichs 
AuthorDate: Tue May 30 20:42:49 2017 +

Add logic to flush gcov data from traffic_server on interrupt.
---
 configure.ac   | 4 +++-
 lib/ts/ink_config.h.in | 1 +
 proxy/Main.cc  | 9 +
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 7401e1e..2c3fae6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -176,13 +176,15 @@ AC_ARG_ENABLE([mime-sanity-check],
 AC_MSG_RESULT([$enable_mime_sanity_check])
 
 # Enable code coverage instrumentation only if requested by the user.
+use_gcov=0
 AC_MSG_CHECKING([whether to code coverage])
 AC_ARG_ENABLE([coverage],
   [AS_HELP_STRING([--enable-coverage],[generate code coverage 
instrumentation])],
-  [],
+  [use_gcov=1],
   [enable_coverage=no]
 )
 AC_MSG_RESULT([$enable_coverage])
+AC_SUBST(use_gcov)
 
 #
 # Enable -Werror. We want this enabled by default for developers, but disabled 
by default
diff --git a/lib/ts/ink_config.h.in b/lib/ts/ink_config.h.in
index b96692f..475ac90 100644
--- a/lib/ts/ink_config.h.in
+++ b/lib/ts/ink_config.h.in
@@ -58,6 +58,7 @@
 #define TS_HAS_IN6_IS_ADDR_UNSPECIFIED @has_in6_is_addr_unspecified@
 #define TS_HAS_BACKTRACE @has_backtrace@
 #define TS_HAS_PROFILER @has_profiler@
+#define TS_USE_GCOV @use_gcov@
 #define TS_USE_FAST_SDK @use_fast_sdk@
 #define TS_USE_DIAGS @use_diags@
 #define TS_USE_EPOLL @use_epoll@
diff --git a/proxy/Main.cc b/proxy/Main.cc
index 9c7548c..1f48517 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -91,6 +91,7 @@ extern "C" int plock(int);
 #include "I_Tasks.h"
 #include "InkAPIInternal.h"
 #include "HTTP2.h"
+#include "ts/ink_config.h"
 
 #include 
 
@@ -99,6 +100,10 @@ extern "C" int plock(int);
 #include 
 #endif
 
+#if TS_USE_GCOV
+extern "C" void __gcov_flush();
+#endif
+
 //
 // Global Data
 //
@@ -445,6 +450,10 @@ proxy_signal_handler(int signo, siginfo_t *info, void *ctx)
   ProfilerStop();
 #endif
 
+#if TS_USE_GCOV
+  __gcov_flush();
+#endif
+
   // We don't expect any crashing signals here because, but
   // forward to the default handler just to be robust.
   if (signal_is_crash(signo)) {

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


[trafficserver] branch master updated: Change locking for spawning dedicated threads to avoid race conditions.

2017-05-30 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  ed49508   Change locking for spawning dedicated threads to avoid 
race conditions.
ed49508 is described below

commit ed49508a0f1fd457a5f234073b3e51ad9f4b7097
Author: Alan M. Carroll 
AuthorDate: Tue May 30 11:31:54 2017 -0500

Change locking for spawning dedicated threads to avoid race conditions.
---
 iocore/eventsystem/I_EventProcessor.h |  1 +
 iocore/eventsystem/P_UnixEventProcessor.h |  1 +
 iocore/eventsystem/UnixEventProcessor.cc  | 32 +++
 3 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/iocore/eventsystem/I_EventProcessor.h 
b/iocore/eventsystem/I_EventProcessor.h
index 5e1d112..f86d335 100644
--- a/iocore/eventsystem/I_EventProcessor.h
+++ b/iocore/eventsystem/I_EventProcessor.h
@@ -309,6 +309,7 @@ public:
   EThread *all_dthreads[MAX_EVENT_THREADS];
   volatile int n_dthreads; // No. of dedicated threads
   volatile int thread_data_used;
+  ink_mutex dedicated_spawn_thread_mutex;
 };
 
 extern inkcoreapi class EventProcessor eventProcessor;
diff --git a/iocore/eventsystem/P_UnixEventProcessor.h 
b/iocore/eventsystem/P_UnixEventProcessor.h
index 5ee4867..1f18ed7 100644
--- a/iocore/eventsystem/P_UnixEventProcessor.h
+++ b/iocore/eventsystem/P_UnixEventProcessor.h
@@ -36,6 +36,7 @@ EventProcessor::EventProcessor() : n_ethreads(0), 
n_thread_groups(0), n_dthreads
   memset(all_dthreads, 0, sizeof(all_dthreads));
   memset(n_threads_for_type, 0, sizeof(n_threads_for_type));
   memset(next_thread_for_type, 0, sizeof(next_thread_for_type));
+  ink_mutex_init(_spawn_thread_mutex, 
"EventProcessorDedicatedThreadSpawn");
 }
 
 TS_INLINE off_t
diff --git a/iocore/eventsystem/UnixEventProcessor.cc 
b/iocore/eventsystem/UnixEventProcessor.cc
index 2b06c84..19f3850 100644
--- a/iocore/eventsystem/UnixEventProcessor.cc
+++ b/iocore/eventsystem/UnixEventProcessor.cc
@@ -265,17 +265,33 @@ EventProcessor::shutdown()
 Event *
 EventProcessor::spawn_thread(Continuation *cont, const char *thr_name, size_t 
stacksize)
 {
-  ink_release_assert(n_dthreads < MAX_EVENT_THREADS);
-  int n = ink_atomic_increment((int *)_dthreads, 1);
-  ink_release_assert(n < MAX_EVENT_THREADS);
-
+  /* Spawning threads in a live system - There are two potential race 
conditions in this logic. The
+ first is multiple calls to this method.  In that case @a all_dthreads can 
end up in a bad state
+ as the same entry is overwritten while another is left unitialized.
+ The other is read/write contention where another thread (e.g. the stats 
collection thread) is
+ iterating over the threads while the active count (@a n_dthreads) is 
being updated causing use
+ of not yet initialized array element.
+ This logic covers both situations. For write/write the actual array 
update is locked. The
+ potentially expensive set up is done outside the lock making the time 
spent locked small For
+ read/write it suffices to do the active count increment after 
initializing the array
+ element. It's not a problem if, for one cycle, a new thread is skipped.
+  */
+
+  // Do as much as possible outside the lock. Until the array element and 
count is changed
+  // this is thread safe.
   Event *e = eventAllocator.alloc();
 
   e->init(cont, 0, 0);
-  all_dthreads[n] = new EThread(DEDICATED, e);
-  e->ethread  = all_dthreads[n];
-  e->mutex= all_dthreads[n]->mutex;
-  cont->mutex = all_dthreads[n]->mutex;
+  e->ethread  = new EThread(DEDICATED, e);
+  e->mutex= e->ethread->mutex;
+  cont->mutex = e->ethread->mutex;
+  {
+ink_mutex_acquire(_spawn_thread_mutex);
+ink_release_assert(n_dthreads < MAX_EVENT_THREADS);
+all_dthreads[n_dthreads] = e->ethread;
+++n_dthreads; // Be very sure this is after the array element update.
+ink_mutex_release(_spawn_thread_mutex);
+  }
 
   e->ethread->start(thr_name, stacksize, nullptr, nullptr, nullptr);
 

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


[trafficserver] branch master updated: This should allow for per-version binaries

2017-05-30 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  0ceaeaf   This should allow for per-version binaries
0ceaeaf is described below

commit 0ceaeaf0a46cb188fab7801b721f3efb597e46a5
Author: Leif Hedstrom 
AuthorDate: Tue May 30 10:21:06 2017 -0600

This should allow for per-version binaries
---
 tools/clang-format.sh | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/clang-format.sh b/tools/clang-format.sh
index 6b75165..2d2390b 100755
--- a/tools/clang-format.sh
+++ b/tools/clang-format.sh
@@ -20,9 +20,11 @@
 
 set -e # exit on error
 
+# Update the PKGDATE with the new version date when making a new clang-format 
binary package.
+PKGDATE="20170404"
 DIR=${1:-.}
-ROOT=${ROOT:-$(cd $(dirname $0) && git rev-parse --show-toplevel)/.git/fmt}
-PACKAGE="clang-format-20170404.tar.bz2"
+ROOT=${ROOT:-$(cd $(dirname $0) && git rev-parse 
--show-toplevel)/.git/fmt/${PKGDATE}}
+PACKAGE="clang-format-${PKGDATE}.tar.bz2"
 VERSION="clang-format version 4.0.1 (http://llvm.org/git/clang.git 
559aa046fe3260d8640791f2249d7b0d458b5700) (http://llvm.org/git/llvm.git 
08142cb734b8d2cefec8b1629f6bb170b3f94610)"
 
 
URL=${URL:-https://bintray.com/artifact/download/apache/trafficserver/${PACKAGE}}

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


[trafficserver] branch master updated: coverity 1022186: remove test_passed_parser_create

2017-05-30 Thread paziz
This is an automated email from the ASF dual-hosted git repository.

paziz 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  627e3a8   coverity 1022186: remove test_passed_parser_create
627e3a8 is described below

commit 627e3a8ecb777d8fceefb74543c493d48442651f
Author: Syeda Persia Aziz 
AuthorDate: Sat May 27 13:44:26 2017 -0500

coverity 1022186: remove test_passed_parser_create
---
 proxy/InkAPITest.cc | 112 ++--
 1 file changed, 47 insertions(+), 65 deletions(-)

diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc
index 90ef84d..dcd246e 100644
--- a/proxy/InkAPITest.cc
+++ b/proxy/InkAPITest.cc
@@ -4762,7 +4762,6 @@ REGRESSION_TEST(SDK_API_TSMimeHdrParse)(RegressionTest 
*test, int /* atype ATS_U
   TSParseResult retval;
   int hdrLength;
 
-  bool test_passed_parser_create  = false;
   bool test_passed_parse  = false;
   bool test_passed_parser_clear   = false;
   bool test_passed_parser_destroy = false;
@@ -4779,80 +4778,63 @@ REGRESSION_TEST(SDK_API_TSMimeHdrParse)(RegressionTest 
*test, int /* atype ATS_U
   // Create Parser
   parser = TSMimeParserCreate();
   SDK_RPRINT(test, "TSMimeParserCreate", "TestCase1", TC_PASS, "ok");
-  test_passed_parser_create = true;
 
-  if (test_passed_parser_create == true) {
-// Parsing
-bufp1 = TSMBufferCreate();
-if (TSMimeHdrCreate(bufp1, _hdr_loc1) != TS_SUCCESS) {
-  SDK_RPRINT(test, "TSMimeHdrParse", "TestCase1", TC_FAIL, "Cannot create 
Mime hdr for parsing");
-  SDK_RPRINT(test, "TSMimeHdrPrint", "TestCase1", TC_FAIL, "Cannot run 
test as unable to create Mime Header for parsing");
-  SDK_RPRINT(test, "TSMimeHdrLengthGet", "TestCase1", TC_FAIL, "Cannot run 
test as unable to create Mime Header for parsing");
-
-  if (TSMBufferDestroy(bufp1) == TS_ERROR) {
-SDK_RPRINT(test, "TSMimeHdrParse", "TestCase1", TC_FAIL, "Error in 
Destroying MBuffer");
-  }
-} else {
-  start = parse_string;
-  end   = parse_string + strlen(parse_string) + 1;
-  if ((retval = TSMimeHdrParse(parser, bufp1, mime_hdr_loc1, , end)) 
== TS_PARSE_ERROR) {
-SDK_RPRINT(test, "TSMimeHdrParse", "TestCase1", TC_FAIL, 
"TSMimeHdrParse returns TS_PARSE_ERROR");
-SDK_RPRINT(test, "TSMimeHdrPrint", "TestCase1", TC_FAIL, "Cannot run 
test as TSMimeHdrParse returned Error.");
-SDK_RPRINT(test, "TSMimeHdrLengthGet", "TestCase1", TC_FAIL, "Cannot 
run test as TSMimeHdrParse returned Error.");
-  } else {
-if (retval == TS_PARSE_DONE) {
-  temp = convert_mime_hdr_to_string(bufp1, mime_hdr_loc1); // 
Implements TSMimeHdrPrint.
-  if (strcmp(parse_string, temp) == 0) {
-SDK_RPRINT(test, "TSMimeHdrParse", "TestCase1", TC_PASS, "ok");
-SDK_RPRINT(test, "TSMimeHdrPrint", "TestCase1", TC_PASS, "ok");
-
-// TSMimeHdrLengthGet
-hdrLength = TSMimeHdrLengthGet(bufp1, mime_hdr_loc1);
-if (hdrLength == (int)strlen(temp)) {
-  SDK_RPRINT(test, "TSMimeHdrLengthGet", "TestCase1", TC_PASS, 
"ok");
-  test_passed_mime_hdr_length_get = true;
-} else {
-  SDK_RPRINT(test, "TSMimeHdrLengthGet", "TestCase1", TC_FAIL, 
"Value's Mismatch");
-}
+  // Parsing
+  bufp1 = TSMBufferCreate();
+  if (TSMimeHdrCreate(bufp1, _hdr_loc1) != TS_SUCCESS) {
+SDK_RPRINT(test, "TSMimeHdrParse", "TestCase1", TC_FAIL, "Cannot create 
Mime hdr for parsing");
+SDK_RPRINT(test, "TSMimeHdrPrint", "TestCase1", TC_FAIL, "Cannot run test 
as unable to create Mime Header for parsing");
+SDK_RPRINT(test, "TSMimeHdrLengthGet", "TestCase1", TC_FAIL, "Cannot run 
test as unable to create Mime Header for parsing");
 
-test_passed_parse  = true;
-test_passed_mime_hdr_print = true;
+if (TSMBufferDestroy(bufp1) == TS_ERROR) {
+  SDK_RPRINT(test, "TSMimeHdrParse", "TestCase1", TC_FAIL, "Error in 
Destroying MBuffer");
+}
+  } else {
+start = parse_string;
+end   = parse_string + strlen(parse_string) + 1;
+if ((retval = TSMimeHdrParse(parser, bufp1, mime_hdr_loc1, , end)) 
== TS_PARSE_ERROR) {
+  SDK_RPRINT(test, "TSMimeHdrParse", "TestCase1", TC_FAIL, "TSMimeHdrParse 
returns TS_PARSE_ERROR");
+  SDK_RPRINT(test, "TSMimeHdrPrint", "TestCase1", TC_FAIL, "Cannot run 
test as TSMimeHdrParse returned Error.");
+  SDK_RPRINT(test, "TSMimeHdrLengthGet", "TestCase1", TC_FAIL, "Cannot run 
test as TSMimeHdrParse returned Error.");
+} else {
+  if (retval == TS_PARSE_DONE) {
+temp = convert_mime_hdr_to_string(bufp1, mime_hdr_loc1); // Implements 
TSMimeHdrPrint.
+if (strcmp(parse_string, temp) == 0) {
+  SDK_RPRINT(test, "TSMimeHdrParse", "TestCase1", TC_PASS, "ok");
+ 

[trafficserver] branch master updated: Coverity 1373300: Use of untrusted scalar value

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

masaori 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  f45e257   Coverity 1373300: Use of untrusted scalar value
f45e257 is described below

commit f45e2574d6a298a962e1f032f5855179ee1295c3
Author: Masaori Koshiba 
AuthorDate: Tue May 30 11:38:14 2017 +0900

Coverity 1373300: Use of untrusted scalar value
---
 proxy/http2/Http2ConnectionState.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proxy/http2/Http2ConnectionState.h 
b/proxy/http2/Http2ConnectionState.h
index 8942065..3ba9af4 100644
--- a/proxy/http2/Http2ConnectionState.h
+++ b/proxy/http2/Http2ConnectionState.h
@@ -81,7 +81,7 @@ public:
   unsigned
   set(Http2SettingsIdentifier id, unsigned value)
   {
-if (id < HTTP2_SETTINGS_MAX) {
+if (0 < id && id < HTTP2_SETTINGS_MAX) {
   return this->settings[indexof(id)] = value;
 } else {
   ink_assert(!"Bad Settings Identifier");

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


[trafficserver] branch master updated: Log H2 errors with stream id

2017-05-30 Thread maskit
This is an automated email from the ASF dual-hosted git repository.

maskit 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  bd95685   Log H2 errors with stream id
bd95685 is described below

commit bd956858034b63581b63b7dc4988ce148f779f6a
Author: Masakazu Kitajo 
AuthorDate: Tue May 30 11:45:22 2017 +0900

Log H2 errors with stream id

H2 error log without stream id is not very helpful. Stream ID provides its 
context.
(e.g. which peer initiate the stream, how many requests processed on the 
session).
---
 proxy/http2/Http2ConnectionState.cc | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/proxy/http2/Http2ConnectionState.cc 
b/proxy/http2/Http2ConnectionState.cc
index 7a54c43..306c2e0 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -902,8 +902,8 @@ Http2ConnectionState::main_event_handler(int event, void 
*edata)
   const char *client_ip = ats_ip_ntop(ua_session->get_client_addr(), ipb, 
sizeof(ipb));
   if (error.cls == Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION) {
 if (error.msg) {
-  Error("HTTP/2 connection error client_ip=%s session_id=%" PRId64 " 
%s", client_ip, ua_session->connection_id(),
-error.msg);
+  Error("HTTP/2 connection error client_ip=%s session_id=%" PRId64 " 
stream_id=%u %s", client_ip,
+ua_session->connection_id(), stream_id, error.msg);
 }
 this->send_goaway_frame(this->latest_streamid_in, error.code);
 this->ua_session->set_half_close_local_flag(true);
@@ -913,7 +913,8 @@ Http2ConnectionState::main_event_handler(int event, void 
*edata)
 // The Http2ClientSession will shutdown because 
connection_state.is_state_closed() will be true
   } else if (error.cls == Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM) {
 if (error.msg) {
-  Error("HTTP/2 stream error client_ip=%s session_id=%" PRId64 " %s", 
client_ip, ua_session->connection_id(), error.msg);
+  Error("HTTP/2 stream error client_ip=%s session_id=%" PRId64 " 
stream_id=%u %s", client_ip, ua_session->connection_id(),
+stream_id, error.msg);
 }
 this->send_rst_stream_frame(stream_id, error.code);
   }

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