[trafficserver] branch master updated: Remove redundany .PHONY target.

2016-04-18 Thread jpeach
This is an automated email from the ASF dual-hosted git repository.

jpeach pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
   new  484fa21   Remove redundany .PHONY target.
484fa21 is described below

commit 484fa21d98499b8fe30927fb4f5a4831d5423a00
Author: James Peach 
AuthorDate: Mon Apr 18 22:50:48 2016 -0700

Remove redundany .PHONY target.
---
 ci/tsqa/Makefile | 2 --
 1 file changed, 2 deletions(-)

diff --git a/ci/tsqa/Makefile b/ci/tsqa/Makefile
index 58ebef2..205a03b 100644
--- a/ci/tsqa/Makefile
+++ b/ci/tsqa/Makefile
@@ -14,8 +14,6 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-.PHONY: test list clean update bootstrap
-
 -include /etc/os-release
 DISTRIBUTION := $(NAME)$(VERSION_ID)
 

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


[trafficserver] branch master updated: Update TSQA bootstrap target.

2016-04-18 Thread jpeach
This is an automated email from the ASF dual-hosted git repository.

jpeach pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
   new  17ecac0   Update TSQA bootstrap target.
17ecac0 is described below

commit 17ecac0a698e0080c2f7bd921d6b69e88f2152fe
Author: James Peach 
AuthorDate: Mon Apr 18 22:42:07 2016 -0700

Update TSQA bootstrap target.

Update the TSQA bootstrap target so that it tries to install the
right packages for the running distribution. Tested on Fedora23
only, but this should be a no-op on other distributions.

Add a trivial wrapper around nosetests to make it easier to explore
how nose runs tests.
---
 ci/tsqa/Makefile  | 46 +-
 ci/tsqa/nosetests | 30 ++
 2 files changed, 71 insertions(+), 5 deletions(-)

diff --git a/ci/tsqa/Makefile b/ci/tsqa/Makefile
index 6b58359..58ebef2 100644
--- a/ci/tsqa/Makefile
+++ b/ci/tsqa/Makefile
@@ -16,17 +16,48 @@
 
 .PHONY: test list clean update bootstrap
 
-VIRTUALENV_DIR = virtualenv
+-include /etc/os-release
+DISTRIBUTION := $(NAME)$(VERSION_ID)
+
+# Search for a program in $PATH (direct from the GNU make manual.
+pathsearch = $(firstword $(wildcard $(addsuffix /$(1),$(subst :, ,$(PATH)
+
+APT := $(call pathsearch,apt-get)
+DNF := $(call pathsearch,dnf)
+YUM := $(call pathsearch,yum)
+
+ifndef DISTRIBUTION
+ifneq ($(APT),)
+DISTRIBUTION := DebianGeneric
+else ifneq ($(DNF),)
+DISTRIBUTION := RedHatGeneric
+else ifneq ($(YUM),)
+DISTRIBUTION := RedHatGeneric
+endif
+endif
+
+PACKAGES_Fedora23 := python-pip python-virtualenv python-devel libffi-devel 
redhat-rpm-config
+PACKAGES_RedHatGeneric := python-pip python-virtualenv python-devel 
libcffi-devel
+PACKAGES_DebianGeneric := python-pip python-virtualenv python-dev libffi-dev
+
+PACKAGES := $(PACKAGES_$(DISTRIBUTION))
+
+VIRTUALENV_DIR := virtualenv
+
+NOSETESTS := ./nosetests
 
 # Run all tests.
+.PHONY: test
 test: $(VIRTUALENV_DIR)
-   @. $(VIRTUALENV_DIR)/bin/activate && $(VIRTUALENV_DIR)/bin/nosetests 
--with-xunit -sv --logging-level=INFO
+   @$(NOSETESTS) --with-xunit --nocapture --verbose --logging-level=INFO
 
 # Scan and list the tests.
+.PHONY: list
 list: $(VIRTUALENV_DIR)
-   @. $(VIRTUALENV_DIR)/bin/activate && $(VIRTUALENV_DIR)/bin/nosetests 
-sv --collect-only
+   @$(NOSETESTS) -sv --collect-only
 
 # Construct the virtualenv.
+.PHONY: $(VIRTUALENV_DIR)
 $(VIRTUALENV_DIR): $(VIRTUALENV_DIR)/.done
 
 $(VIRTUALENV_DIR)/.done:
@@ -37,20 +68,25 @@ $(VIRTUALENV_DIR)/.done:
@echo "Virtualenv ready!"
 
 # Update the virtualenv with the latest TSQA package and dependencies.
+.PHONY: update
 update:
@rm -f $(VIRTUALENV_DIR)/.done
@. $(VIRTUALENV_DIR)/bin/activate && \
+   $(VIRTUALENV_DIR)/bin/pip install --upgrade pip && \
$(VIRTUALENV_DIR)/bin/pip install --upgrade -r requirements.txt 
&& \
touch $(VIRTUALENV_DIR)/.done
 
 # Install TSQA bootstrap dependencies.
+.PHONY: bootstrap
 bootstrap:
+   @echo package list is $(PACKAGES)
@if [ -e /etc/debian_version ]; then \
-   apt-get install -y python-pip python-virtualenv python-dev 
libffi-dev ; \
+   $(APT) install -y $(PACKAGES) ; \
fi
@if [ -e /etc/redhat-release ]; then \
-   yum install -y python-pip python-virtualenv python-devel 
libcffi-devel ; \
+   $(YUM) install -y $(PACKAGES) ; \
fi
 
+.PHONY: clean
 clean:
rm -rf virtualenv
diff --git a/ci/tsqa/nosetests b/ci/tsqa/nosetests
new file mode 100755
index 000..7486f4d
--- /dev/null
+++ b/ci/tsqa/nosetests
@@ -0,0 +1,30 @@
+#! /usr/bin/env bash
+
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+set -e # exit on error
+
+TSQA=$(cd $(dirname $0); pwd)
+
+cd $TSQA
+
+. ./virtualenv/bin/activate
+
+./virtualenv/bin/nosetests \
+--with-xunit \
+--nocapture \
+   "$@"

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

[trafficserver-qa] branch master updated: Remove whitespace.

2016-04-18 Thread jpeach
This is an automated email from the ASF dual-hosted git repository.

jpeach pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver-qa.git

The following commit(s) were added to refs/heads/master by this push:
   new  ba4179b   Remove whitespace.
ba4179b is described below

commit ba4179b871f168f9727914b3788c0aff0345bfa5
Author: James Peach 
AuthorDate: Mon Apr 18 20:26:52 2016 -0700

Remove whitespace.
---
 doc/design.rst | 4 
 1 file changed, 4 deletions(-)

diff --git a/doc/design.rst b/doc/design.rst
index 18adfe7..4690efe 100644
--- a/doc/design.rst
+++ b/doc/design.rst
@@ -26,14 +26,12 @@ should be created as style/testing requirements of the 
project the tests are for
 This is done by effectively just creating a variety of helper classes that 
TestCases
 can sub-class to get some common functionality for free.
 
-
 
 Architecture
 
 Due to the flexible design principles at play there is very little in terms of
 architecture, but we'll go over the design of a few of the basic helper 
concepts.
 
-
 Environment
 
 One of the common use-cases of a test framework is to build and run the 
application.
@@ -48,7 +46,6 @@ for. It will then return a copy of the requested environment 
to the caller. This
 means that if N tests require the same base environment we only have to compile
 once instead of N times.
 
-
 Endpoint
 
 Another common requirement for integration testing a proxy is an origin. Not 
only
@@ -57,7 +54,6 @@ as the client (since the proxy will modify the 
request/response). To aid in thes
 sorts of tests we provide a DynamicHTTPEndpoint class which will create a Flask
 server in a separate thread with APIs to register endpoints and track requests.
 
-
 test_cases
 ==
 These are intended to be test cases that you would subclass to create your own 
test.

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


[trafficserver] branch master updated: TS-4312 Clang format

2016-04-18 Thread briang
This is an automated email from the ASF dual-hosted git repository.

briang pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
   new  900dab0   TS-4312 Clang format
900dab0 is described below

commit 900dab078b12a5afe7567fe6d24fbf16879594a0
Author: Brian Geffon 
AuthorDate: Sun Apr 17 10:06:57 2016 -0700

TS-4312 Clang format
---
 proxy/hdrs/URL.cc   |  1 -
 proxy/hdrs/URL.h|  3 ++-
 proxy/http/HttpConfig.h | 10 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/proxy/hdrs/URL.cc b/proxy/hdrs/URL.cc
index 0aff2c1..bc3851d 100644
--- a/proxy/hdrs/URL.cc
+++ b/proxy/hdrs/URL.cc
@@ -1817,7 +1817,6 @@ REGRESSION_TEST(VALIDATE_HDR_FIELD)(RegressionTest *t, 
int /* level ATS_UNUSED *
   }
 }
 
-
 REGRESSION_TEST(ParseRules_strict_URI)(RegressionTest *t, int /* level 
ATS_UNUSED */, int *pstatus)
 {
   const struct {
diff --git a/proxy/hdrs/URL.h b/proxy/hdrs/URL.h
index a68edca..ef4db3a 100644
--- a/proxy/hdrs/URL.h
+++ b/proxy/hdrs/URL.h
@@ -236,7 +236,8 @@ void url_params_set(HdrHeap *heap, URLImpl *url, const char 
*value, int length,
 void url_query_set(HdrHeap *heap, URLImpl *url, const char *value, int length, 
bool copy_string);
 void url_fragment_set(HdrHeap *heap, URLImpl *url, const char *value, int 
length, bool copy_string);
 
-MIMEParseResult url_parse(HdrHeap *heap, URLImpl *url, const char **start, 
const char *end, bool copy_strings, bool strict_uri_parsing = false);
+MIMEParseResult url_parse(HdrHeap *heap, URLImpl *url, const char **start, 
const char *end, bool copy_strings,
+  bool strict_uri_parsing = false);
 MIMEParseResult url_parse_no_path_component_breakdown(HdrHeap *heap, URLImpl 
*url, const char **start, const char *end,
   bool copy_strings);
 MIMEParseResult url_parse_internet(HdrHeap *heap, URLImpl *url, const char 
**start, const char *end, bool copy_strings);
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index e43796e..824ea7c 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -858,11 +858,11 @@ inline HttpConfigParams::HttpConfigParams()
 parent_connect_attempts(4), per_parent_connect_attempts(2), 
parent_connect_timeout(30), anonymize_other_header_list(NULL),
 enable_http_stats(1), icp_enabled(0), stale_icp_enabled(0), 
cache_vary_default_text(NULL), cache_vary_default_images(NULL),
 cache_vary_default_other(NULL), cache_enable_default_vary_headers(0), 
cache_post_method(0), connect_ports_string(NULL),
-connect_ports(NULL), push_method_enabled(0), referer_filter_enabled(0), 
referer_format_redirect(0), strict_uri_parsing(0), reverse_proxy_enabled(0),
-url_remap_required(1), record_cop_page(0), errors_log_error_pages(1), 
enable_http_info(0), cluster_time_delta(0),
-redirection_host_no_port(1), post_copy_size(2048), 
ignore_accept_mismatch(0), ignore_accept_language_mismatch(0),
-ignore_accept_encoding_mismatch(0), ignore_accept_charset_mismatch(0), 
send_100_continue_response(0),
-disallow_post_100_continue(0), parser_allow_non_http(1), max_post_size(0),
+connect_ports(NULL), push_method_enabled(0), referer_filter_enabled(0), 
referer_format_redirect(0), strict_uri_parsing(0),
+reverse_proxy_enabled(0), url_remap_required(1), record_cop_page(0), 
errors_log_error_pages(1), enable_http_info(0),
+cluster_time_delta(0), redirection_host_no_port(1), post_copy_size(2048), 
ignore_accept_mismatch(0),
+ignore_accept_language_mismatch(0), ignore_accept_encoding_mismatch(0), 
ignore_accept_charset_mismatch(0),
+send_100_continue_response(0), disallow_post_100_continue(0), 
parser_allow_non_http(1), max_post_size(0),
 server_session_sharing_pool(TS_SERVER_SESSION_SHARING_POOL_THREAD), 
synthetic_port(0)
 {
 }

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


[trafficserver] branch master updated: TS-4312 Add config to strictly parse URL according to RFC 3986. This closes #574

2016-04-18 Thread briang
This is an automated email from the ASF dual-hosted git repository.

briang pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
   new  9f9dc38   TS-4312 Add config to strictly parse URL according to RFC 
3986. This closes #574
9f9dc38 is described below

commit 9f9dc3832d16a79072e1f9c7abf69048e58535cc
Author: Shen Zhang 
AuthorDate: Sun Apr 17 09:55:34 2016 -0700

TS-4312 Add config to strictly parse URL according to RFC 3986. This closes 
#574
---
 doc/admin-guide/files/records.config.en.rst |  5 +++
 lib/ts/CompileParseRules.cc |  4 +-
 lib/ts/ParseRules.h | 39 ---
 mgmt/RecordsConfig.cc   |  2 +
 proxy/hdrs/HTTP.cc  |  6 +--
 proxy/hdrs/HTTP.h   | 10 ++---
 proxy/hdrs/HdrTSOnly.cc |  4 +-
 proxy/hdrs/URL.cc   | 59 -
 proxy/hdrs/URL.h|  2 +-
 proxy/http/HttpConfig.cc|  3 ++
 proxy/http/HttpConfig.h |  4 +-
 proxy/http/HttpSM.cc|  3 +-
 12 files changed, 120 insertions(+), 21 deletions(-)

diff --git a/doc/admin-guide/files/records.config.en.rst 
b/doc/admin-guide/files/records.config.en.rst
index 55ac374..b3421ba 100644
--- a/doc/admin-guide/files/records.config.en.rst
+++ b/doc/admin-guide/files/records.config.en.rst
@@ -1040,6 +1040,11 @@ Value Effect
An arbitrary string value that, if set, will be used to replace any request
``User-Agent`` header.
 
+.. ts:cv:: CONFIG proxy.config.http.strict_uri_parsing INT 0
+
+   Enables (``1``) or disables (``0``) Traffic Server to return a 400 Bad 
Request
+   if client's request URI includes character which is not RFC 3986 compliant
+
 Parent Proxy Configuration
 ==
 
diff --git a/lib/ts/CompileParseRules.cc b/lib/ts/CompileParseRules.cc
index efb39a0..7d92bb0 100644
--- a/lib/ts/CompileParseRules.cc
+++ b/lib/ts/CompileParseRules.cc
@@ -105,8 +105,8 @@ main()
   tparseRulesCType[c] |= is_eow_BIT;
 if (ParseRules::is_token(c))
   tparseRulesCType[c] |= is_token_BIT;
-if (ParseRules::is_wildmat(c))
-  tparseRulesCType[c] |= is_wildmat_BIT;
+if (ParseRules::is_uri(c))
+  tparseRulesCType[c] |= is_uri_BIT;
 if (ParseRules::is_sep(c))
   tparseRulesCType[c] |= is_sep_BIT;
 if (ParseRules::is_empty(c))
diff --git a/lib/ts/ParseRules.h b/lib/ts/ParseRules.h
index 2b430cf..5e8f8d6 100644
--- a/lib/ts/ParseRules.h
+++ b/lib/ts/ParseRules.h
@@ -59,7 +59,7 @@ typedef unsigned int CTypeResult;
 #define is_wslfcr_BIT (1 << 20)
 #define is_eow_BIT (1 << 21)
 #define is_token_BIT (1 << 22)
-#define is_wildmat_BIT (1 << 23)
+#define is_uri_BIT (1 << 23)
 #define is_sep_BIT (1 << 24)
 #define is_empty_BIT (1 << 25)
 #define is_alnum_BIT (1 << 26)
@@ -122,7 +122,7 @@ public:
   static CTypeResult is_punct(char c);// 
!"#$%&'()*+,-./:;<>=?@_{}|~
   static CTypeResult is_end_of_url(char c);   // NUL,CR,SP
   static CTypeResult is_eow(char c);  // NUL,CR,LF
-  static CTypeResult is_wildmat(char c);  // \,*,?,[
+  static CTypeResult is_uri(char c);  // A-Z,a-z,0-9 
:/?#[]@!$&'()*+,;=-._~%
   static CTypeResult is_sep(char c);  // NULL,COMMA,':','!',wslfcr
   static CTypeResult is_empty(char c);// wslfcr,#
   static CTypeResult is_alnum(char c);// 0-9,A-Z,a-z
@@ -590,12 +590,41 @@ ParseRules::is_eow(char c)
 }
 
 inline CTypeResult
-ParseRules::is_wildmat(char c)
+ParseRules::is_uri(char c)
 {
 #ifndef COMPILE_PARSE_RULES
-  return (parseRulesCType[(unsigned char)c] & is_wildmat_BIT);
+  return (parseRulesCType[(unsigned char)c] & is_uri_BIT);
 #else
-  return (c == '*' || c == '?' || c == '[' || c == '\\');
+  if (is_alnum(c))
+return (true);
+
+  switch (c) {
+  case ':':
+  case '/':
+  case '?':
+  case '#':
+  case '[':
+  case ']':
+  case '@':
+  case '!':
+  case '$':
+  case '&':
+  case '\'':
+  case '(':
+  case ')':
+  case '*':
+  case '+':
+  case ',':
+  case ';':
+  case '=':
+  case '-':
+  case '.':
+  case '_':
+  case '~':
+  case '%':
+return (true);
+  }
+  return (false);
 #endif
 }
 
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index 8d17edb..55d9cdc 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -440,6 +440,8 @@ static const RecordElement RecordsConfig[] =
   ,
   {RECT_CONFIG, "proxy.config.http.post.check.content_length.enabled", 
RECD_INT, "1", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
   ,
+  {RECT_CONFIG, "proxy.config.http.strict_uri_parsing", RECD_INT, "0", 
RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
+  ,
   //   # Send http11 requests
   //   #
   //   #   0 - Never
diff --git