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 2015/08/07 04:56:54 UTC

[1/6] trafficserver git commit: TS-3828: HEAD requests hang when origin returns Transfer-Encoding: Chunked

Repository: trafficserver
Updated Branches:
  refs/heads/6.0.x 8f89e542c -> 84cfe45c4


TS-3828: HEAD requests hang when origin returns Transfer-Encoding: Chunked


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

Branch: refs/heads/6.0.x
Commit: aa9b94fab4020798b81a749f6e5994387f7a09c9
Parents: 5597664
Author: Zizhong Zhang <zi...@linkedin.com>
Authored: Thu Aug 6 01:49:50 2015 -0700
Committer: Zizhong Zhang <zi...@linkedin.com>
Committed: Thu Aug 6 01:49:50 2015 -0700

----------------------------------------------------------------------
 proxy/http/HttpTransact.cc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/aa9b94fa/proxy/http/HttpTransact.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 3fb42fa..a4d492e 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -7928,8 +7928,12 @@ HttpTransact::build_response(State *s, HTTPHdr *base_response, HTTPHdr *outgoing
 
   // If the response is prohibited from containing a body,
   //  we know the content length is trustable for keep-alive
-  if (is_response_body_precluded(status_code, s->method))
+  if (is_response_body_precluded(status_code, s->method)) {
     s->hdr_info.trust_response_cl = true;
+    s->hdr_info.response_content_length = 0;
+    s->client_info.transfer_encoding = HttpTransact::NO_TRANSFER_ENCODING;
+    s->server_info.transfer_encoding = HttpTransact::NO_TRANSFER_ENCODING;
+  }
 
   handle_response_keep_alive_headers(s, outgoing_version, outgoing_response);
 


[4/6] trafficserver git commit: TS-3828: HEAD requests hang when origin returns Transfer-Encoding: Chunked. ADD TESTS. ensure the Content-Length is passed over.

Posted by zw...@apache.org.
TS-3828: HEAD requests hang when origin returns Transfer-Encoding: Chunked. ADD TESTS. ensure the Content-Length is passed over.


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

Branch: refs/heads/6.0.x
Commit: a0f8567a2ad75b8c25781e9e20cdcfb208b1fe6b
Parents: d7fa8cc
Author: Zizhong Zhang <zi...@linkedin.com>
Authored: Thu Aug 6 17:28:38 2015 -0700
Committer: Zizhong Zhang <zi...@linkedin.com>
Committed: Thu Aug 6 17:28:38 2015 -0700

----------------------------------------------------------------------
 ci/tsqa/tests/test_headrequest.py | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a0f8567a/ci/tsqa/tests/test_headrequest.py
----------------------------------------------------------------------
diff --git a/ci/tsqa/tests/test_headrequest.py b/ci/tsqa/tests/test_headrequest.py
index 1e75edc..a636db8 100644
--- a/ci/tsqa/tests/test_headrequest.py
+++ b/ci/tsqa/tests/test_headrequest.py
@@ -107,6 +107,7 @@ class TestHeadRequestWithoutTimeout(helpers.EnvironmentCase):
                     resp = conn.recv(4096)
                     if len(resp) == 0: 
                         break
+                    response_content = resp
                     log.info(resp)
                 except:
                     break
@@ -116,3 +117,5 @@ class TestHeadRequestWithoutTimeout(helpers.EnvironmentCase):
             log.info("head request with case(%s) costs %f seconds while the timout is %f seconds." % (
                     request_case, end_time - begin_time, cls.timeout))
             cls.assertGreater(cls.timeout, end_time - begin_time)
+            if request_case == 'CL':
+                cls.assertIn('Content-Length', response_content)


[3/6] trafficserver git commit: TS-3829 Remove remnants of proxy.pac

Posted by zw...@apache.org.
TS-3829 Remove remnants of proxy.pac


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

Branch: refs/heads/6.0.x
Commit: 1bf8746e0c60899a1f87fc6a47af2cceb55dd45a
Parents: 5597664
Author: Leif Hedstrom <zw...@apache.org>
Authored: Thu Aug 6 16:52:33 2015 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Thu Aug 6 16:52:33 2015 -0600

----------------------------------------------------------------------
 cmd/traffic_manager/AddConfigFilesHere.cc                    | 1 -
 cmd/traffic_manager/traffic_manager.cc                       | 3 ---
 doc/locale/ja/LC_MESSAGES/admin/explicit-proxy-caching.en.po | 8 --------
 3 files changed, 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1bf8746e/cmd/traffic_manager/AddConfigFilesHere.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_manager/AddConfigFilesHere.cc b/cmd/traffic_manager/AddConfigFilesHere.cc
index 56b7aca..34bc1da 100644
--- a/cmd/traffic_manager/AddConfigFilesHere.cc
+++ b/cmd/traffic_manager/AddConfigFilesHere.cc
@@ -70,7 +70,6 @@ initializeRegistry()
   configFiles->addFile("logs_xml.config", false);
   configFiles->addFile("storage.config", false);
   configFiles->addFile("socks.config", false);
-  configFiles->addFile("proxy.pac", false);
   configFiles->addFile("records.config", false);
   configFiles->addFile("vaddrs.config", false);
   configFiles->addFile("cache.config", false);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1bf8746e/cmd/traffic_manager/traffic_manager.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_manager/traffic_manager.cc b/cmd/traffic_manager/traffic_manager.cc
index d0ed870..cb6d00a 100644
--- a/cmd/traffic_manager/traffic_manager.cc
+++ b/cmd/traffic_manager/traffic_manager.cc
@@ -916,9 +916,6 @@ fileUpdated(char *fname, bool incVersion)
   } else if (strcmp(fname, "storage.config") == 0) {
     mgmt_log(stderr, "[fileUpdated] storage.config changed, need restart auto-rebuild mode\n");
 
-  } else if (strcmp(fname, "proxy.pac") == 0) {
-    mgmt_log(stderr, "[fileUpdated] proxy.pac file has been modified\n");
-
   } else if (strcmp(fname, "icp.config") == 0) {
     lmgmt->signalFileChange("proxy.config.icp.icp_configuration");
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1bf8746e/doc/locale/ja/LC_MESSAGES/admin/explicit-proxy-caching.en.po
----------------------------------------------------------------------
diff --git a/doc/locale/ja/LC_MESSAGES/admin/explicit-proxy-caching.en.po b/doc/locale/ja/LC_MESSAGES/admin/explicit-proxy-caching.en.po
index cda9a04..02c2fc9 100644
--- a/doc/locale/ja/LC_MESSAGES/admin/explicit-proxy-caching.en.po
+++ b/doc/locale/ja/LC_MESSAGES/admin/explicit-proxy-caching.en.po
@@ -96,14 +96,6 @@ msgid ""
 "perform the following configuration:"
 msgstr ""
 
-#: ../../admin/explicit-proxy-caching.en.rst:69
-msgid ""
-"Either copy an existing PAC file into the Traffic Server ``config`` "
-"directory or enter a script that defines the proxy server configuration "
-"settings in the ``proxy.pac`` file provided. The file is empty by default. "
-"A sample script is provided in `Sample PAC File`_."
-msgstr ""
-
 #: ../../admin/explicit-proxy-caching.en.rst:74
 msgid ""
 "Specify the port Traffic Server uses to serve the its synthetic healthchecks. The default "


[6/6] trafficserver git commit: Merge branch 'master' into 6.0.x

Posted by zw...@apache.org.
Merge branch 'master' into 6.0.x

* master:
  TS-3828: HEAD requests hang when origin returns Transfer-Encoding: Chunked. ADD TESTS. ensure the Content-Length is passed over.
  TS-3829 Remove remnants of proxy.pac
  TS-3828: HEAD requests hang when origin returns Transfer-Encoding: Chunked. ADD TESTS
  TS-3828: HEAD requests hang when origin returns Transfer-Encoding: Chunked


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

Branch: refs/heads/6.0.x
Commit: 84cfe45c4891df5ea1f5b06547727afe7c0beed9
Parents: 8f89e54 2f15429
Author: Leif Hedstrom <zw...@apache.org>
Authored: Thu Aug 6 20:56:41 2015 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Thu Aug 6 20:56:41 2015 -0600

----------------------------------------------------------------------
 ci/tsqa/tests/test_headrequest.py | 121 +++++++++++++++++++++++++++++++++
 1 file changed, 121 insertions(+)
----------------------------------------------------------------------



[5/6] trafficserver git commit: Merge branch 'TS-3828' of https://github.com/zizhong/trafficserver

Posted by zw...@apache.org.
Merge branch 'TS-3828' of https://github.com/zizhong/trafficserver


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

Branch: refs/heads/6.0.x
Commit: 2f154297a749bc9da54ce4373ef7198dcd75fb02
Parents: 1bf8746 a0f8567
Author: Brian Geffon <br...@apache.org>
Authored: Thu Aug 6 18:46:47 2015 -0700
Committer: Brian Geffon <br...@apache.org>
Committed: Thu Aug 6 18:46:47 2015 -0700

----------------------------------------------------------------------
 ci/tsqa/tests/test_headrequest.py | 121 +++++++++++++++++++++++++++++++++
 proxy/http/HttpTransact.cc        |   6 +-
 2 files changed, 126 insertions(+), 1 deletion(-)
----------------------------------------------------------------------



[2/6] trafficserver git commit: TS-3828: HEAD requests hang when origin returns Transfer-Encoding: Chunked. ADD TESTS

Posted by zw...@apache.org.
TS-3828: HEAD requests hang when origin returns Transfer-Encoding: Chunked. ADD TESTS


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

Branch: refs/heads/6.0.x
Commit: d7fa8ccdde14b205ebb6ce423df7313e69574794
Parents: aa9b94f
Author: Zizhong Zhang <zi...@linkedin.com>
Authored: Thu Aug 6 01:51:54 2015 -0700
Committer: Zizhong Zhang <zi...@linkedin.com>
Committed: Thu Aug 6 01:51:54 2015 -0700

----------------------------------------------------------------------
 ci/tsqa/tests/test_headrequest.py | 118 +++++++++++++++++++++++++++++++++
 1 file changed, 118 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d7fa8ccd/ci/tsqa/tests/test_headrequest.py
----------------------------------------------------------------------
diff --git a/ci/tsqa/tests/test_headrequest.py b/ci/tsqa/tests/test_headrequest.py
new file mode 100644
index 0000000..1e75edc
--- /dev/null
+++ b/ci/tsqa/tests/test_headrequest.py
@@ -0,0 +1,118 @@
+'''
+Test Head Request
+'''
+
+#  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.
+
+import os
+import requests
+import time
+import logging
+import SocketServer
+import random
+import tsqa.test_cases
+import helpers
+import json
+import select
+import socket
+
+log = logging.getLogger(__name__)
+
+
+class HeadRequestServerHandler(SocketServer.BaseRequestHandler):
+    """ 
+    A subclass of RequestHandler which will response to head requests
+    """
+
+    def handle(self):
+        # Receive the data in small chunks and retransmit it
+        while True:
+            data = self.request.recv(4096).strip()
+            if data:
+                log.debug('Sending data back to the client')
+            else:
+                log.debug('Client disconnected')
+                break
+            if 'TE' in data:
+                resp = ('HTTP/1.1 200 OK\r\n'
+                    'Server: Apache-Coyote/1.1\r\n'
+                    'Transfer-Encoding: chunked\r\n'
+                    'Vary: Accept-Encoding\r\n'
+                    '\r\n'
+                    )  
+                self.request.sendall(resp)
+            elif 'CL' in data:
+                resp = ('HTTP/1.1 200 OK\r\n'
+                    'Server: Apache-Coyote/1.1\r\n'
+                    'Content-Length: 123\r\n'
+                    'Vary: Accept-Encoding\r\n'
+                    '\r\n'
+                    )  
+                self.request.sendall(resp)
+            else:
+                resp = ('HTTP/1.1 200 OK\r\n'
+                    'Server: Apache-Coyote/1.1\r\n'
+                    'Vary: Accept-Encoding\r\n'
+                    '\r\n'
+                    )  
+                self.request.sendall(resp)
+
+
+
+class TestHeadRequestWithoutTimeout(helpers.EnvironmentCase):
+    '''
+    Tests for ATS handling head requests correctly without waiting for the http body
+    '''
+    @classmethod
+    def setUpEnv(cls, env):
+        cls.timeout = 5
+        cls.configs['records.config']['CONFIG'].update({
+            'proxy.config.http.transaction_no_activity_timeout_out': cls.timeout,
+        })
+        cls.socket_server = tsqa.endpoint.SocketServerDaemon(HeadRequestServerHandler)
+        cls.socket_server.start()
+        cls.socket_server.ready.wait()
+        cls.configs['remap.config'].add_line('map / http://127.0.0.1:{0}/'.format(cls.socket_server.port))
+        log.info('map / http://127.0.0.1:{0}/'.format(cls.socket_server.port))
+
+        cls.proxy_host = '127.0.0.1'
+        cls.proxy_port = int(cls.configs['records.config']['CONFIG']['proxy.config.http.server_ports'])
+
+    def test_head_request_without_timout(cls):
+        request_cases = ['TE', 'CL', '']
+        for request_case in request_cases:
+            begin_time = time.time()
+            conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+            conn.connect((cls.proxy_host, cls.proxy_port))
+            request_content = 'HEAD / HTTP/1.1\r\nConnection: close\r\nHost: 127.0.0.1\r\nContent-Length: %d\r\n\r\n%s' % (
+                    len(request_case), request_case)
+            conn.setblocking(1)
+            conn.send(request_content)
+            while 1:
+                try:
+                    resp = conn.recv(4096)
+                    if len(resp) == 0: 
+                        break
+                    log.info(resp)
+                except:
+                    break
+            conn.shutdown(socket.SHUT_RDWR)
+            conn.close()
+            end_time = time.time()
+            log.info("head request with case(%s) costs %f seconds while the timout is %f seconds." % (
+                    request_case, end_time - begin_time, cls.timeout))
+            cls.assertGreater(cls.timeout, end_time - begin_time)