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 2015/07/08 00:28:29 UTC

trafficserver git commit: TS-3595: Cookie header split into multiple lines with H2

Repository: trafficserver
Updated Branches:
  refs/heads/master bc918476c -> 56160c13a


TS-3595: Cookie header split into multiple lines with H2


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

Branch: refs/heads/master
Commit: 56160c13a9b2dcf995ec6b0747f636b106d4b7b0
Parents: bc91847
Author: Bryan Call <bc...@apache.org>
Authored: Tue Jul 7 15:27:14 2015 -0700
Committer: Bryan Call <bc...@apache.org>
Committed: Tue Jul 7 15:27:14 2015 -0700

----------------------------------------------------------------------
 proxy/hdrs/MIME.h    | 20 ++++++++++++++++++++
 proxy/http2/HTTP2.cc |  6 ++++++
 2 files changed, 26 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/56160c13/proxy/hdrs/MIME.h
----------------------------------------------------------------------
diff --git a/proxy/hdrs/MIME.h b/proxy/hdrs/MIME.h
index 628f013..4d9b2b6 100644
--- a/proxy/hdrs/MIME.h
+++ b/proxy/hdrs/MIME.h
@@ -942,6 +942,7 @@ public:
   // Other separators (e.g. ';' in Set-cookie/Cookie) are also possible
   void field_value_append(MIMEField *field, const char *value, int value_length, bool prepend_comma = false,
                           const char separator = ',');
+  void field_combine_dups(MIMEField *field, bool prepend_comma = false, const char separator = ',');
   time_t get_age();
   int64_t get_content_length() const;
   time_t get_date();
@@ -1328,6 +1329,25 @@ MIMEHdr::field_value_append(MIMEField *field, const char *value_str, int value_l
   field->value_append(m_heap, m_mime, value_str, value_len, prepend_comma, separator);
 }
 
+
+
+inline void
+MIMEHdr::field_combine_dups(MIMEField *field, bool prepend_comma, const char separator)
+{
+  if (field->has_dups()) {
+    MIMEField *duplicate = field->m_next_dup;
+    field_combine_dups(duplicate, prepend_comma, separator);
+
+
+    int value_len = 0;
+    const char *value_str = duplicate->value_get(&value_len);
+    if (value_len > 0) {
+      field->value_append(m_heap, m_mime, value_str, value_len, prepend_comma, separator);
+    }
+    field_delete(duplicate);
+  }
+}
+
 /*-------------------------------------------------------------------------
   -------------------------------------------------------------------------*/
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/56160c13/proxy/http2/HTTP2.cc
----------------------------------------------------------------------
diff --git a/proxy/http2/HTTP2.cc b/proxy/http2/HTTP2.cc
index 9390ed8..5a6637b 100644
--- a/proxy/http2/HTTP2.cc
+++ b/proxy/http2/HTTP2.cc
@@ -495,6 +495,12 @@ convert_from_2_to_1_1_header(HTTPHdr *headers)
       return PARSE_ERROR;
     }
 
+    // 8.1.2.5 Combine Cookie headers
+    field = headers->field_find(MIME_FIELD_COOKIE, MIME_LEN_COOKIE);
+    if (field) {
+      headers->field_combine_dups(field, true, ';');
+    }
+
     // Convert HTTP version to 1.1
     int32_t version = HTTP_VERSION(1, 1);
     http_hdr_version_set(headers->m_http, version);