You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2018/07/24 15:48:44 UTC

[trafficserver] branch master updated (65cb226 -> 769ca45)

This is an automated email from the ASF dual-hosted git repository.

bcall pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git.


    from 65cb226  Removes old commented-out code
     new cf353b4  Revert "Fix crashes from early post return fix."
     new 33543d8  Revert "Fix post_error test by initializating the address length of the accept call."
     new 769ca45  Revert "Fix post process to propagate early server response."

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 proxy/http/HttpSM.cc                             |  21 +----
 tests/gold_tests/post_error/create_post_body.py  |  24 ------
 tests/gold_tests/post_error/gold/post_error.gold |   3 -
 tests/gold_tests/post_error/post_error.test.py   |  69 ---------------
 tests/gold_tests/post_error/post_server.c        | 105 -----------------------
 5 files changed, 2 insertions(+), 220 deletions(-)
 delete mode 100644 tests/gold_tests/post_error/create_post_body.py
 delete mode 100644 tests/gold_tests/post_error/gold/post_error.gold
 delete mode 100644 tests/gold_tests/post_error/post_error.test.py
 delete mode 100644 tests/gold_tests/post_error/post_server.c


[trafficserver] 01/03: Revert "Fix crashes from early post return fix."

Posted by bc...@apache.org.
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

commit cf353b44e04f7711a2dcb319a6276877ec5be7f1
Author: Bryan Call <bc...@apache.org>
AuthorDate: Tue Jul 17 10:01:35 2018 -0400

    Revert "Fix crashes from early post return fix."
    
    This reverts commit c24378848ca8d083aacd69b6365ab65f291e8149.
---
 proxy/http/HttpSM.cc | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index a423123..d27a59a 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -1813,11 +1813,6 @@ HttpSM::state_read_server_response_header(int event, void *data)
   case VC_EVENT_READ_READY:
   case VC_EVENT_READ_COMPLETE:
     // More data to parse
-
-    // If there is still a post body underway, defer processing until post body is done
-    if (ua_entry->in_tunnel && !server_entry->eos) {
-      return 0;
-    }
     break;
 
   case VC_EVENT_ERROR:
@@ -2693,10 +2688,6 @@ HttpSM::tunnel_handler_post(int event, void *data)
     handle_post_failure();
     break;
   case HTTP_SM_POST_UA_FAIL:
-    // Cancel out the server read if present. Left over attempt to read server response.
-    if (server_entry && server_entry->read_vio && server_session && server_entry->read_vio->cont) {
-      server_entry->read_vio = server_session->do_io_read(nullptr, 0, nullptr);
-    }
     break;
   case HTTP_SM_POST_SUCCESS:
     // It's time to start reading the response
@@ -2708,11 +2699,7 @@ HttpSM::tunnel_handler_post(int event, void *data)
       call_transact_and_set_next_state(HttpTransact::HandleRequestBufferDone);
       break;
     }
-    // Read response already setup
-    // Signal if data is waiting
-    if (server_entry->read_vio && server_entry->read_vio->ndone > 0) {
-      handleEvent(VC_EVENT_READ_READY, server_entry->read_vio);
-    }
+    // Read reasponse already setup
     break;
   default:
     ink_release_assert(0);


[trafficserver] 03/03: Revert "Fix post process to propagate early server response."

Posted by bc...@apache.org.
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

commit 769ca455cd2afcf3259dc926696e703df4e25b86
Author: Bryan Call <bc...@apache.org>
AuthorDate: Tue Jul 17 10:01:51 2018 -0400

    Revert "Fix post process to propagate early server response."
    
    This reverts commit cafd146a56f09bc565ec4adf0308c7625e665a67.
---
 proxy/http/HttpSM.cc                             |  8 +-
 tests/gold_tests/post_error/create_post_body.py  | 24 ------
 tests/gold_tests/post_error/gold/post_error.gold |  3 -
 tests/gold_tests/post_error/post_error.test.py   | 69 -----------------
 tests/gold_tests/post_error/post_server.c        | 96 ------------------------
 5 files changed, 2 insertions(+), 198 deletions(-)

diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index d27a59a..1c07d2d 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -1978,8 +1978,6 @@ HttpSM::state_send_server_request_header(int event, void *data)
         setup_transform_to_server_transfer();
       } else {
         do_setup_post_tunnel(HTTP_SERVER_VC);
-        // Start up read response in parallel in case of early error response
-        setup_server_read_response_header();
       }
     } else {
       // It's time to start reading the response
@@ -2699,7 +2697,7 @@ HttpSM::tunnel_handler_post(int event, void *data)
       call_transact_and_set_next_state(HttpTransact::HandleRequestBufferDone);
       break;
     }
-    // Read reasponse already setup
+    setup_server_read_response_header();
     break;
   default:
     ink_release_assert(0);
@@ -5308,7 +5306,7 @@ HttpSM::handle_post_failure()
     tunnel.deallocate_buffers();
     tunnel.reset();
     // There's data from the server so try to read the header
-    // Read response is already set up
+    setup_server_read_response_header();
   } else {
     tunnel.deallocate_buffers();
     tunnel.reset();
@@ -5353,8 +5351,6 @@ HttpSM::handle_http_server_open()
       (t_state.hdr_info.request_content_length > 0 || t_state.client_info.transfer_encoding == HttpTransact::CHUNKED_ENCODING) &&
       do_post_transform_open()) {
     do_setup_post_tunnel(HTTP_TRANSFORM_VC);
-    // Start up read response in parallel in case of early error response
-    setup_server_read_response_header();
   } else {
     setup_server_send_request_api();
   }
diff --git a/tests/gold_tests/post_error/create_post_body.py b/tests/gold_tests/post_error/create_post_body.py
deleted file mode 100644
index 1c3c971..0000000
--- a/tests/gold_tests/post_error/create_post_body.py
+++ /dev/null
@@ -1,24 +0,0 @@
-'''
-'''
-#  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.
-
-post_body = str(123456).zfill(1024)
-postfile = open("postbody", "w")
-for x in range(0, 3000):
-    postfile.write(post_body)
-postfile.close()
-
diff --git a/tests/gold_tests/post_error/gold/post_error.gold b/tests/gold_tests/post_error/gold/post_error.gold
deleted file mode 100644
index e071159..0000000
--- a/tests/gold_tests/post_error/gold/post_error.gold
+++ /dev/null
@@ -1,3 +0,0 @@
-``
-< HTTP/1.1 401 Auth Needed
-``
diff --git a/tests/gold_tests/post_error/post_error.test.py b/tests/gold_tests/post_error/post_error.test.py
deleted file mode 100644
index 26f1055..0000000
--- a/tests/gold_tests/post_error/post_error.test.py
+++ /dev/null
@@ -1,69 +0,0 @@
-'''
-'''
-#  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
-Test.Summary = '''
-Test post_error
-'''
-
-# need Curl
-Test.SkipUnless(
-    Condition.HasProgram("curl", "Curl need to be installed on system for this test to work")
-)
-Test.ContinueOnFail = True
-
-# build post server code
-tr=Test.Build(target='post_server',sources=['post_server.c'])
-tr.Setup.Copy('post_server.c')
-
-tr = Test.AddTestRun()
-tr.Setup.Copy('create_post_body.py')
-tr.Processes.Default.Command = "python create_post_body.py"
-
-# Define default ATS
-ts = Test.MakeATSProcess("ts", select_ports=False)
-
-# create Process
-server = Test.Processes.Process("post_server")
-port = 8888
-command = "./post_server {0}".format(port)
-
-# create process
-server.Command = command
-server.Ready = When.PortOpen(port)
-server.ReturnCode = Any(None, 0)
-
-ts.Disk.remap_config.AddLine(
-    'map / http://127.0.0.1:{0}'.format(port)
-)
-
-ts.Disk.records_config.update({
-    # enable ssl port
-    'proxy.config.http.server_ports': '{0}'.format(ts.Variables.port)
-})
-
-
-
-tr = Test.AddTestRun()
-tr.Processes.Default.Command = 'curl -H"Expect:" -v -k -d "@postbody" http://127.0.0.1:{0}/'.format(ts.Variables.port)
-tr.Processes.Default.ReturnCode = 0
-tr.Processes.Default.Streams.All = "gold/post_error.gold"
-tr.Processes.Default.StartBefore(Test.Processes.ts, ready=When.PortOpen(ts.Variables.port))
-tr.Processes.Default.StartBefore(server)
-tr.StillRunningAfter = server
-
diff --git a/tests/gold_tests/post_error/post_server.c b/tests/gold_tests/post_error/post_server.c
deleted file mode 100644
index bff4889..0000000
--- a/tests/gold_tests/post_error/post_server.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/** @file
-
-  POST test server
-
-  @section license License
-
-  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.
-
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <string.h>
-
-const char *response_buffer = "HTTP/1.1 401 Auth Needed\r\nHost:example.com\r\nContent-length:0\r\n\r\n";
-int
-main(int argc, char *argv[])
-{
-  if (argc < 2) {
-    fprintf(stderr, "USAGE: %s <listen port>\n", argv[0]);
-    exit(1);
-  }
-  printf("Starting...\n");
-
-  int listenfd = socket(AF_INET, SOCK_STREAM, 0);
-  struct sockaddr_in serv_addr, peer_addr;
-  socklen_t peer_len;
-
-  serv_addr.sin_family      = AF_INET;
-  serv_addr.sin_addr.s_addr = INADDR_ANY;
-  int port                  = atoi(argv[1]);
-  serv_addr.sin_port        = htons(port);
-  bind(listenfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr));
-  listen(listenfd, 10);
-
-  for (;;) {
-    socklen_t client_len;
-    struct sockaddr_in client;
-    int client_sock = accept(listenfd, reinterpret_cast<struct sockaddr *>(&client), &client_len);
-    if (client_sock < 0) {
-      perror("Accept failed");
-      exit(1);
-    }
-
-    printf("client_sock=%d\n", client_sock);
-
-    // Read data until we get a full header (Seen \r\n\r\n)
-    // Being simple minded and assume they all show up in a single read
-    char buffer[1024];
-    bool done_header_read = false;
-    do {
-      int count = read(client_sock, buffer, sizeof(buffer));
-      if (count <= 0) {
-        // Client bailed out on us
-        perror("Client read failed");
-        close(client_sock);
-        client_sock      = -1;
-        done_header_read = false;
-      }
-      // Not super efficient, but don't care for this test application
-      for (int i = 0; i < count - 3 && !done_header_read; i++) {
-        if (memcmp(buffer + i, "\r\n\r\n", 4) == 0) {
-          done_header_read = true;
-        }
-      }
-    } while (!done_header_read);
-
-    // Send back a fixed response header
-    write(client_sock, response_buffer, strlen(response_buffer));
-
-    // Close
-    close(client_sock);
-    printf("Sent response\n");
-  }
-  printf("Finishing\n");
-
-  exit(0);
-}


[trafficserver] 02/03: Revert "Fix post_error test by initializating the address length of the accept call."

Posted by bc...@apache.org.
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

commit 33543d89f4d87cfb3d78e2a9f79ef3e2fe6c5050
Author: Bryan Call <bc...@apache.org>
AuthorDate: Tue Jul 17 10:01:45 2018 -0400

    Revert "Fix post_error test by initializating the address length of the accept call."
    
    This reverts commit 9b3a8a2d1faf291cdfa3ad1cea46c0a75d7fd7b6.
---
 tests/gold_tests/post_error/post_server.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/tests/gold_tests/post_error/post_server.c b/tests/gold_tests/post_error/post_server.c
index cb4976f..bff4889 100644
--- a/tests/gold_tests/post_error/post_server.c
+++ b/tests/gold_tests/post_error/post_server.c
@@ -41,27 +41,18 @@ main(int argc, char *argv[])
   printf("Starting...\n");
 
   int listenfd = socket(AF_INET, SOCK_STREAM, 0);
-
-  int optval = 1;
-  setsockopt(listenfd, SOL_SOCKET, SO_REUSEPORT, &optval, sizeof(optval));
-
   struct sockaddr_in serv_addr, peer_addr;
   socklen_t peer_len;
+
   serv_addr.sin_family      = AF_INET;
   serv_addr.sin_addr.s_addr = INADDR_ANY;
   int port                  = atoi(argv[1]);
   serv_addr.sin_port        = htons(port);
-  if (bind(listenfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
-    perror("bind failed");
-    exit(1);
-  }
-  if (listen(listenfd, 10) < 0) {
-    perror("listen failed");
-    exit(1);
-  }
+  bind(listenfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr));
+  listen(listenfd, 10);
 
   for (;;) {
-    socklen_t client_len = sizeof(struct sockaddr_in);
+    socklen_t client_len;
     struct sockaddr_in client;
     int client_sock = accept(listenfd, reinterpret_cast<struct sockaddr *>(&client), &client_len);
     if (client_sock < 0) {