You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by us...@apache.org on 2014/01/01 00:37:53 UTC

git commit: TS-2464: Remove useless and buggy connection header handling

Updated Branches:
  refs/heads/master 3be2c67b8 -> 1ef600983


TS-2464: Remove useless and buggy connection header handling


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

Branch: refs/heads/master
Commit: 1ef60098387c4e14ae0d75454e47f13815aa94bb
Parents: 3be2c67
Author: Uri Shachar <us...@apache.org>
Authored: Wed Jan 1 01:30:59 2014 +0200
Committer: Uri Shachar <us...@apache.org>
Committed: Wed Jan 1 01:30:59 2014 +0200

----------------------------------------------------------------------
 CHANGES                           |  2 +
 proxy/http/HttpTransact.cc        |  2 -
 proxy/http/HttpTransactHeaders.cc | 70 ----------------------------------
 proxy/http/HttpTransactHeaders.h  |  6 ---
 4 files changed, 2 insertions(+), 78 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1ef60098/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 603ba4b..8599e7d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 4.2.0
 
+  *) [TS-2464] Remove useless and buggy connection header handling
+
   *) [TS-2457] Protocol.c: change usage of atoi to strtol.
    Author: Radim Kolar <hs...@sendmail.cz>
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1ef60098/proxy/http/HttpTransact.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 0fa2974..14207f0 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -7541,7 +7541,6 @@ HttpTransact::build_request(State* s, HTTPHdr* base_request, HTTPHdr* outgoing_r
 
   HttpTransactHeaders::copy_header_fields(base_request, outgoing_request, s->txn_conf->fwd_proxy_auth_to_parent);
   add_client_ip_to_outgoing_request(s, outgoing_request);
-  HttpTransactHeaders::process_connection_headers(base_request, outgoing_request);
   HttpTransactHeaders::remove_privacy_headers_from_request(s->http_config_param, s->txn_conf, outgoing_request);
   HttpTransactHeaders::add_global_user_agent_header_to_request(s->http_config_param, outgoing_request);
   handle_request_keep_alive_headers(s, outgoing_version, outgoing_request);
@@ -7664,7 +7663,6 @@ HttpTransact::build_response(State* s, HTTPHdr* base_response, HTTPHdr* outgoing
   } else {
     if ((status_code == HTTP_STATUS_NONE) || (status_code == base_response->status_get())) {
       HttpTransactHeaders::copy_header_fields(base_response, outgoing_response, s->txn_conf->fwd_proxy_auth_to_parent);
-      HttpTransactHeaders::process_connection_headers(base_response, outgoing_response);
 
       if (s->txn_conf->insert_age_in_response)
         HttpTransactHeaders::insert_time_and_age_headers_in_response(s->request_sent_time, s->response_received_time,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1ef60098/proxy/http/HttpTransactHeaders.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransactHeaders.cc b/proxy/http/HttpTransactHeaders.cc
index 06cd98f..7c9a3e6 100644
--- a/proxy/http/HttpTransactHeaders.cc
+++ b/proxy/http/HttpTransactHeaders.cc
@@ -971,76 +971,6 @@ HttpTransactHeaders::insert_basic_realm_in_proxy_authenticate(const char *realm,
 }
 
 
-inline void
-HttpTransactHeaders::process_connection_field_in_outgoing_header(HTTPHdr *base, HTTPHdr *header)
-{
-  _process_xxx_connection_field_in_outgoing_header(MIME_FIELD_CONNECTION, MIME_LEN_CONNECTION, base, header);
-}
-
-inline void
-HttpTransactHeaders::process_proxy_connection_field_in_outgoing_header(HTTPHdr *base, HTTPHdr *header)
-{
-  _process_xxx_connection_field_in_outgoing_header(MIME_FIELD_PROXY_CONNECTION, MIME_LEN_PROXY_CONNECTION, base, header);
-}
-
-
-void
-HttpTransactHeaders::process_connection_headers(HTTPHdr *base, HTTPHdr *outgoing)
-{
-  process_connection_field_in_outgoing_header(base, outgoing);
-  process_proxy_connection_field_in_outgoing_header(base, outgoing);
-}
-
-
-void
-HttpTransactHeaders::_process_xxx_connection_field_in_outgoing_header(const char *wks_field_name,
-                                                                      int wks_field_name_len,
-                                                                      HTTPHdr *base, HTTPHdr *header)
-{
-  MIMEField *con_hdr;
-  con_hdr = base->field_find(wks_field_name, wks_field_name_len);
-
-  if (con_hdr) {
-    int val_len;
-    const char *val;
-
-    if (!con_hdr->has_dups()) { // try fastpath first
-      val = con_hdr->value_get(&val_len);
-      if ((ptr_len_casecmp(val, val_len, "keep-alive", 10) == 0) || (ptr_len_casecmp(val, val_len, "close", 5) == 0)) {
-        return;
-      }
-    }
-    {
-      HdrCsvIter iter;
-      val = iter.get_first(con_hdr, &val_len);
-
-      while (val) {
-
-        const char *wks = hdrtoken_string_to_wks(val, val_len);
-        if (wks) {
-          if ((wks != HTTP_VALUE_KEEP_ALIVE) && (wks != HTTP_VALUE_CLOSE) &&
-              (wks != MIME_FIELD_HOST) && (wks != MIME_FIELD_DATE)) {
-            int wks_length = hdrtoken_wks_to_length(wks);
-            header->field_delete(wks, wks_length);
-          }
-        } else {
-          // the following are needed to delete non-standard HTTP headers.
-          MIMEHdrImpl *m_hdr_impl = header->m_http->m_fields_impl;
-          MIMEField *hdr_to_remove;
-
-          // The specified header is not a standard HTTP header.
-          hdr_to_remove = _mime_hdr_field_list_search_by_string(m_hdr_impl, val, val_len);
-          if (hdr_to_remove)
-            header->field_delete(hdr_to_remove);
-        }
-
-        val = iter.get_next(&val_len);
-      }
-    }
-  }
-}
-
-
 void
 HttpTransactHeaders::remove_conditional_headers(HTTPHdr *outgoing)
 {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1ef60098/proxy/http/HttpTransactHeaders.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransactHeaders.h b/proxy/http/HttpTransactHeaders.h
index fd61bf1..8dbbdab 100644
--- a/proxy/http/HttpTransactHeaders.h
+++ b/proxy/http/HttpTransactHeaders.h
@@ -77,12 +77,6 @@ public:
 
   static void insert_basic_realm_in_proxy_authenticate(const char *realm, HTTPHdr * header, bool bRevPrxy);
 
-  static void process_connection_headers(HTTPHdr * base, HTTPHdr * outgoing);
-  static void process_connection_field_in_outgoing_header(HTTPHdr * base, HTTPHdr * header);
-  static void process_proxy_connection_field_in_outgoing_header(HTTPHdr * base, HTTPHdr * header);
-  static void _process_xxx_connection_field_in_outgoing_header(const char *wks_field_name, int wks_field_name_len,
-                                                               HTTPHdr * base, HTTPHdr * header);
-
   static void remove_conditional_headers(HTTPHdr * outgoing);
   static void remove_host_name_from_url(HTTPHdr * outgoing_request);
   static void add_global_user_agent_header_to_request(HttpConfigParams *http_config_param, HTTPHdr * header);