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 2019/12/22 19:55:34 UTC

[trafficserver] branch 9.0.x updated (d692908 -> 0a10b98)

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

zwoop pushed a change to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git.


    from d692908  Updated ChangeLog
     new 9e463b3  Fix sni.yaml fqdn to match complete name string
     new 0a10b98  Set END_STREAM flag when write_vio ntodo is 0

The 2 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:
 iocore/net/SSLSNIConfig.cc                               |  7 +++++--
 proxy/http2/Http2ConnectionState.cc                      | 12 +++++++-----
 proxy/http2/Http2Stream.h                                |  4 ++--
 tests/gold_tests/h2/gold/http2_9_stderr.gold             | 10 ++++++++++
 .../gold/sni-1.gold => h2/gold/http2_9_stdout.gold}      |  0
 tests/gold_tests/h2/http2.test.py                        | 13 +++++++++++++
 tests/gold_tests/tls/tls_client_verify.test.py           | 16 ++++++++++++++++
 7 files changed, 53 insertions(+), 9 deletions(-)
 create mode 100644 tests/gold_tests/h2/gold/http2_9_stderr.gold
 copy tests/gold_tests/{tls_hooks/gold/sni-1.gold => h2/gold/http2_9_stdout.gold} (100%)


[trafficserver] 02/02: Set END_STREAM flag when write_vio ntodo is 0

Posted by zw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 0a10b9854d37033d01d92157bd46483881747d7e
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Tue Nov 19 10:10:16 2019 +0900

    Set END_STREAM flag when write_vio ntodo is 0
    
    (cherry picked from commit 52538c4fe966b5a67f6701a919f7e07fade164a2)
---
 proxy/http2/Http2ConnectionState.cc          | 12 +++++++-----
 proxy/http2/Http2Stream.h                    |  4 ++--
 tests/gold_tests/h2/gold/http2_9_stderr.gold | 10 ++++++++++
 tests/gold_tests/h2/gold/http2_9_stdout.gold |  0
 tests/gold_tests/h2/http2.test.py            | 13 +++++++++++++
 5 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/proxy/http2/Http2ConnectionState.cc b/proxy/http2/Http2ConnectionState.cc
index b23e0a5..3e40f18 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -1416,7 +1416,7 @@ Http2ConnectionState::send_data_frames_depends_on_priority()
   switch (result) {
   case Http2SendDataFrameResult::NO_ERROR: {
     // No response body to send
-    if (len == 0 && !stream->is_body_done()) {
+    if (len == 0 && !stream->is_write_vio_done()) {
       dependency_tree->deactivate(node, len);
     } else {
       dependency_tree->update(node, len);
@@ -1477,12 +1477,12 @@ Http2ConnectionState::send_a_data_frame(Http2Stream *stream, size_t &payload_len
   // Are we at the end?
   // If we return here, we never send the END_STREAM in the case of a early terminating OS.
   // OK if there is no body yet. Otherwise continue on to send a DATA frame and delete the stream
-  if (!stream->is_body_done() && payload_length == 0) {
+  if (!stream->is_write_vio_done() && payload_length == 0) {
     Http2StreamDebug(this->ua_session, stream->get_id(), "No payload");
     return Http2SendDataFrameResult::NO_PAYLOAD;
   }
 
-  if (stream->is_body_done() && !_sm->is_read_avail_more_than(0)) {
+  if (stream->is_write_vio_done() && !_sm->is_read_avail_more_than(0)) {
     flags |= HTTP2_FLAGS_DATA_END_STREAM;
   }
 
@@ -1506,7 +1506,7 @@ Http2ConnectionState::send_a_data_frame(Http2Stream *stream, size_t &payload_len
   this->ua_session->handleEvent(HTTP2_SESSION_EVENT_XMIT, &data);
 
   if (flags & HTTP2_FLAGS_DATA_END_STREAM) {
-    Http2StreamDebug(ua_session, stream->get_id(), "End of DATA frame");
+    Http2StreamDebug(ua_session, stream->get_id(), "END_STREAM");
     stream->send_end_stream = true;
     // Setting to the same state shouldn't be erroneous
     stream->change_state(data.header().type, data.header().flags);
@@ -1584,7 +1584,9 @@ Http2ConnectionState::send_headers_frame(Http2Stream *stream)
   if (header_blocks_size <= static_cast<uint32_t>(BUFFER_SIZE_FOR_INDEX(buffer_size_index[HTTP2_FRAME_TYPE_HEADERS]))) {
     payload_length = header_blocks_size;
     flags |= HTTP2_FLAGS_HEADERS_END_HEADERS;
-    if (h2_hdr.presence(MIME_PRESENCE_CONTENT_LENGTH) && h2_hdr.get_content_length() == 0) {
+    if ((h2_hdr.presence(MIME_PRESENCE_CONTENT_LENGTH) && h2_hdr.get_content_length() == 0) ||
+        (!resp_header->expect_final_response() && stream->is_write_vio_done())) {
+      Http2StreamDebug(ua_session, stream->get_id(), "END_STREAM");
       flags |= HTTP2_FLAGS_HEADERS_END_STREAM;
       stream->send_end_stream = true;
     }
diff --git a/proxy/http2/Http2Stream.h b/proxy/http2/Http2Stream.h
index 6a522a8..87ea36b 100644
--- a/proxy/http2/Http2Stream.h
+++ b/proxy/http2/Http2Stream.h
@@ -112,7 +112,7 @@ public:
 
   void increment_data_length(uint64_t length);
   bool payload_length_is_valid() const;
-  bool is_body_done() const;
+  bool is_write_vio_done() const;
   void update_sent_count(unsigned num_bytes);
   Http2StreamId get_id() const;
   Http2StreamState get_state() const;
@@ -230,7 +230,7 @@ Http2Stream::mark_milestone(Http2StreamMilestone type)
 }
 
 inline bool
-Http2Stream::is_body_done() const
+Http2Stream::is_write_vio_done() const
 {
   return this->write_vio.ntodo() == 0;
 }
diff --git a/tests/gold_tests/h2/gold/http2_9_stderr.gold b/tests/gold_tests/h2/gold/http2_9_stderr.gold
new file mode 100644
index 0000000..ea2f129
--- /dev/null
+++ b/tests/gold_tests/h2/gold/http2_9_stderr.gold
@@ -0,0 +1,10 @@
+``
+> GET /status/204 HTTP/2
+> Host: ``
+> User-Agent: curl/``
+> Accept: */*
+``
+< HTTP/2 204``
+< server: ATS/``
+< date: ``
+``
diff --git a/tests/gold_tests/h2/gold/http2_9_stdout.gold b/tests/gold_tests/h2/gold/http2_9_stdout.gold
new file mode 100644
index 0000000..e69de29
diff --git a/tests/gold_tests/h2/http2.test.py b/tests/gold_tests/h2/http2.test.py
index 5484272..c0ff4b3 100644
--- a/tests/gold_tests/h2/http2.test.py
+++ b/tests/gold_tests/h2/http2.test.py
@@ -69,6 +69,11 @@ server.addResponse("sessionlog.json",
                    {"headers": "GET /huge_resp_hdrs HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""},
                    {"headers": "HTTP/1.1 200 OK\r\nServer: microserver\r\nConnection: close\r\nContent-Length: 6\r\n\r\n", "timestamp": "1469733493.993", "body": "200 OK"})
 
+# For Test Case 9 - /status/204
+server.addResponse("sessionlog.json",
+                   {"headers": "GET /status/204 HTTP/1.1\r\nHost: www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""},
+                   {"headers": "HTTP/1.1 204 No Content\r\nServer: microserver\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""})
+
 # ----
 # Setup ATS
 # ----
@@ -177,3 +182,11 @@ tr.Processes.Default.ReturnCode = 0
 tr.Processes.Default.Streams.stdout = "gold/http2_8_stdout.gold"
 tr.Processes.Default.Streams.stderr = "gold/http2_8_stderr.gold"
 tr.StillRunningAfter = server
+
+# Test Case 9: Header Only Response - e.g. 204
+tr = Test.AddTestRun()
+tr.Processes.Default.Command = 'curl -vs -k --http2 https://127.0.0.1:{0}/status/204'.format(ts.Variables.ssl_port)
+tr.Processes.Default.ReturnCode = 0
+tr.Processes.Default.Streams.stdout = "gold/http2_9_stdout.gold"
+tr.Processes.Default.Streams.stderr = "gold/http2_9_stderr.gold"
+tr.StillRunningAfter = server


[trafficserver] 01/02: Fix sni.yaml fqdn to match complete name string

Posted by zw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 9e463b33ef891632cf67d8e00c72ebc32a35987b
Author: Susan Hinrichs <sh...@oath.com>
AuthorDate: Fri Nov 22 19:58:38 2019 +0000

    Fix sni.yaml fqdn to match complete name string
    
    (cherry picked from commit 0cbe04cfbd903e266ab7ae8f194bc75459a35008)
---
 iocore/net/SSLSNIConfig.cc                     |  7 +++++--
 tests/gold_tests/tls/tls_client_verify.test.py | 16 ++++++++++++++++
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/iocore/net/SSLSNIConfig.cc b/iocore/net/SSLSNIConfig.cc
index aa3246a..1dc2f4e 100644
--- a/iocore/net/SSLSNIConfig.cc
+++ b/iocore/net/SSLSNIConfig.cc
@@ -108,10 +108,13 @@ SNIConfigParams::SNIConfigParams() {}
 const actionVector *
 SNIConfigParams::get(const std::string &servername) const
 {
+  int ovector[2];
   for (const auto &retval : sni_action_list) {
-    if (retval.match == nullptr && servername.length() == 0) {
+    int length = servername.length();
+    if (retval.match == nullptr && length == 0) {
       return &retval.actions;
-    } else if (pcre_exec(retval.match, nullptr, servername.c_str(), servername.length(), 0, 0, nullptr, 0) >= 0) {
+    } else if (pcre_exec(retval.match, nullptr, servername.c_str(), length, 0, 0, ovector, 2) == 1 && ovector[0] == 0 &&
+               ovector[1] == length) {
       return &retval.actions;
     }
   }
diff --git a/tests/gold_tests/tls/tls_client_verify.test.py b/tests/gold_tests/tls/tls_client_verify.test.py
index e7480a7..7663015 100644
--- a/tests/gold_tests/tls/tls_client_verify.test.py
+++ b/tests/gold_tests/tls/tls_client_verify.test.py
@@ -63,6 +63,8 @@ ts.Disk.sni_yaml.AddLines([
     'sni:',
     '- fqdn: bob.bar.com',
     '  verify_client: NONE',
+    '- fqdn: "bob.com"',
+    '  verify_client: STRICT',
     '- fqdn: bob.*.com',
     '  verify_client: NONE',
     '- fqdn: "*bar.com"',
@@ -168,3 +170,17 @@ tr.StillRunningAfter = ts
 tr.StillRunningAfter = server
 tr.Processes.Default.Command = "curl --tls-max 1.2 -k --cert ./server.pem --key ./server.key --resolve 'bar.com:{0}:127.0.0.1' https://bar.com:{0}/case1".format(ts.Variables.ssl_port)
 tr.Processes.Default.ReturnCode = 35
+
+
+# Test that the fqdn's match completely.  bob.com should require client certificate. bob.com.com should not
+tr = Test.AddTestRun("Connect to bob.com without cert, should fail")
+tr.StillRunningAfter = ts
+tr.StillRunningAfter = server
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --resolve 'bob.com:{0}:127.0.0.1' https://bob.com:{0}/case1".format(ts.Variables.ssl_port)
+tr.Processes.Default.ReturnCode = 35
+
+tr = Test.AddTestRun("Connect to bob.com.com without cert, should succeed")
+tr.StillRunningAfter = ts
+tr.StillRunningAfter = server
+tr.Processes.Default.Command = "curl --tls-max 1.2 -k --resolve 'bob.com.com:{0}:127.0.0.1' https://bob.com.com:{0}/case1".format(ts.Variables.ssl_port)
+tr.Processes.Default.ReturnCode = 0