You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2015/10/28 03:15:36 UTC

[1/3] trafficserver git commit: TS-3827: Cleanup comments related to HTTP/2

Repository: trafficserver
Updated Branches:
  refs/heads/master 09acc0b81 -> 6a111c1e6


TS-3827: Cleanup comments related to HTTP/2

This closes #315


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

Branch: refs/heads/master
Commit: 16821eed48a3343cf522501f272950e30b07aa4a
Parents: c498d7e
Author: Masaori Koshiba <mk...@yahoo-corp.jp>
Authored: Tue Oct 20 16:56:41 2015 +0900
Committer: James Peach <jp...@apache.org>
Committed: Tue Oct 27 19:15:17 2015 -0700

----------------------------------------------------------------------
 proxy/http2/HTTP2.cc                | 62 +------------------------------
 proxy/http2/HTTP2.h                 | 49 ++++++++++++-------------
 proxy/http2/Http2ConnectionState.cc | 63 +++++++-------------------------
 3 files changed, 39 insertions(+), 135 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/16821eed/proxy/http2/HTTP2.cc
----------------------------------------------------------------------
diff --git a/proxy/http2/HTTP2.cc b/proxy/http2/HTTP2.cc
index e5d3b94..82b1657 100644
--- a/proxy/http2/HTTP2.cc
+++ b/proxy/http2/HTTP2.cc
@@ -285,18 +285,6 @@ http2_write_ping(const uint8_t *opaque_data, IOVec iov)
   return true;
 }
 
-// 6.8. GOAWAY
-//
-// 0                   1                   2                   3
-// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
-// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-// |R|                  Last-Stream-ID (31)                        |
-// +-+-------------------------------------------------------------+
-// |                      Error Code (32)                          |
-// +---------------------------------------------------------------+
-// |                  Additional Debug Data (*)                    |
-// +---------------------------------------------------------------+
-
 bool
 http2_write_goaway(const Http2Goaway &goaway, IOVec iov)
 {
@@ -330,16 +318,6 @@ http2_parse_headers_parameter(IOVec iov, Http2HeadersParameter &params)
   return true;
 }
 
-// 6.3.  PRIORITY
-//
-// 0                   1                   2                   3
-// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
-// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-// |E|                  Stream Dependency (31)                     |
-// +-+-------------+-----------------------------------------------+
-// |   Weight (8)  |
-// +-+-------------+
-
 bool
 http2_parse_priority_parameter(IOVec iov, Http2Priority &params)
 {
@@ -354,14 +332,6 @@ http2_parse_priority_parameter(IOVec iov, Http2Priority &params)
   return true;
 }
 
-// 6.4.  RST_STREAM
-//
-// 0                   1                   2                   3
-// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
-// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-// |                        Error Code (32)                        |
-// +---------------------------------------------------------------+
-
 bool
 http2_parse_rst_stream(IOVec iov, Http2RstStream &rst_stream)
 {
@@ -375,16 +345,6 @@ http2_parse_rst_stream(IOVec iov, Http2RstStream &rst_stream)
   return true;
 }
 
-// 6.5.1.  SETTINGS Format
-//
-// 0                   1                   2                   3
-// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
-// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-// |       Identifier (16)         |
-// +-------------------------------+-------------------------------+
-// |                        Value (32)                             |
-// +---------------------------------------------------------------+
-
 bool
 http2_parse_settings_parameter(IOVec iov, Http2SettingsParameter &param)
 {
@@ -405,18 +365,6 @@ http2_parse_settings_parameter(IOVec iov, Http2SettingsParameter &param)
   return true;
 }
 
-// 6.8.  GOAWAY
-//
-// 0                   1                   2                   3
-// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
-// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-// |R|                  Last-Stream-ID (31)                        |
-// +-+-------------------------------------------------------------+
-// |                      Error Code (32)                          |
-// +---------------------------------------------------------------+
-// |                  Additional Debug Data (*)                    |
-// +---------------------------------------------------------------+
-
 bool
 http2_parse_goaway(IOVec iov, Http2Goaway &goaway)
 {
@@ -432,14 +380,6 @@ http2_parse_goaway(IOVec iov, Http2Goaway &goaway)
   return true;
 }
 
-// 6.9.  WINDOW_UPDATE
-//
-// 0                   1                   2                   3
-// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
-// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-// |R|              Window Size Increment (31)                     |
-// +-+-------------------------------------------------------------+
-
 bool
 http2_parse_window_update(IOVec iov, uint32_t &size)
 {
@@ -506,7 +446,7 @@ convert_from_2_to_1_1_header(HTTPHdr *headers)
       return PARSE_ERROR;
     }
 
-    // 8.1.2.5 Combine Cookie headers
+    // Combine Cookie headers ([RFC 7540] 8.1.2.5.)
     field = headers->field_find(MIME_FIELD_COOKIE, MIME_LEN_COOKIE);
     if (field) {
       headers->field_combine_dups(field, true, ';');

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/16821eed/proxy/http2/HTTP2.h
----------------------------------------------------------------------
diff --git a/proxy/http2/HTTP2.h b/proxy/http2/HTTP2.h
index d0278d6..9120d7c 100644
--- a/proxy/http2/HTTP2.h
+++ b/proxy/http2/HTTP2.h
@@ -34,9 +34,8 @@ class HTTPHdr;
 
 typedef unsigned Http2StreamId;
 
-// 6.9.2 Initial Flow Control Window Size - the flow control window can be come
-// negative
-// so we need to track it with a signed type.
+// [RFC 7540] 6.9.2. Initial Flow Control Window Size
+// the flow control window can be come negative so we need to track it with a signed type.
 typedef int32_t Http2WindowSize;
 
 extern const char *const HTTP2_CONNECTION_PREFACE;
@@ -79,17 +78,17 @@ enum {
 #define HTTP2_SUM_THREAD_DYN_STAT(_s, _t, _v) RecIncrRawStat(http2_rsb, _t, (int)_s, _v);
 extern RecRawStatBlock *http2_rsb; // Container for statistics.
 
-// 6.9.1 The Flow Control Window
+// [RFC 7540] 6.9.1. The Flow Control Window
 static const Http2WindowSize HTTP2_MAX_WINDOW_SIZE = 0x7FFFFFFF;
 
-// 5.4.  Error Handling
+// [RFC 7540] 5.4. Error Handling
 enum Http2ErrorClass {
   HTTP2_ERROR_CLASS_NONE,
   HTTP2_ERROR_CLASS_CONNECTION,
   HTTP2_ERROR_CLASS_STREAM,
 };
 
-// 7.  Error Codes
+// [RFC 7540] 7. Error Codes
 enum Http2ErrorCode {
   HTTP2_ERROR_NO_ERROR = 0,
   HTTP2_ERROR_PROTOCOL_ERROR = 1,
@@ -109,7 +108,7 @@ enum Http2ErrorCode {
   HTTP2_ERROR_MAX,
 };
 
-// 5.1. Stream States
+// [RFC 7540] 5.1. Stream States
 enum Http2StreamState {
   HTTP2_STREAM_STATE_IDLE,
   HTTP2_STREAM_STATE_RESERVED_LOCAL,
@@ -135,7 +134,7 @@ enum Http2FrameType {
   HTTP2_FRAME_TYPE_MAX,
 };
 
-// 6.1 Data
+// [RFC 7540] 6.1. Data
 enum Http2FrameFlagsData {
   HTTP2_FLAGS_DATA_END_STREAM = 0x01,
   HTTP2_FLAGS_DATA_PADDED = 0x08,
@@ -143,7 +142,7 @@ enum Http2FrameFlagsData {
   HTTP2_FLAGS_DATA_MASK = 0x09,
 };
 
-// 6.2 Headers
+// [RFC 7540] 6.2. Headers
 enum Http2FrameFlagsHeaders {
   HTTP2_FLAGS_HEADERS_END_STREAM = 0x01,
   HTTP2_FLAGS_HEADERS_END_HEADERS = 0x04,
@@ -153,24 +152,24 @@ enum Http2FrameFlagsHeaders {
   HTTP2_FLAGS_HEADERS_MASK = 0x2D,
 };
 
-// 6.3 Priority
+// [RFC 7540] 6.3. Priority
 enum Http2FrameFlagsPriority {
   HTTP2_FLAGS_PRIORITY_MASK = 0x00,
 };
 
-// 6.3 Rst Stream
+// [RFC 7540] 6.4. Rst Stream
 enum Http2FrameFlagsRstStream {
   HTTP2_FLAGS_RST_STREAM_MASK = 0x00,
 };
 
-// 6.4 Settings
+// [RFC 7540] 6.5. Settings
 enum Http2FrameFlagsSettings {
   HTTP2_FLAGS_SETTINGS_ACK = 0x01,
 
   HTTP2_FLAGS_SETTINGS_MASK = 0x01
 };
 
-// 6.6 Push Promise
+// [RFC 7540] 6.6. Push Promise
 enum Http2FrameFlagsPushPromise {
   HTTP2_FLAGS_PUSH_PROMISE_END_HEADERS = 0x04,
   HTTP2_FLAGS_PUSH_PROMISE_PADDED = 0x08,
@@ -178,31 +177,31 @@ enum Http2FrameFlagsPushPromise {
   HTTP2_FLAGS_PUSH_PROMISE_MASK = 0x0C,
 };
 
-// 6.7 Ping
+// [RFC 7540] 6.7. Ping
 enum Http2FrameFlagsPing {
   HTTP2_FLAGS_PING_ACK = 0x01,
 
   HTTP2_FLAGS_PING_MASK = 0x01
 };
 
-// 6.8 Goaway
+// [RFC 7540] 6.8. Goaway
 enum Http2FrameFlagsGoaway {
   HTTP2_FLAGS_GOAWAY_MASK = 0x00,
 };
 
-// 6.9 Window Update
+// [RFC 7540] 6.9. Window Update
 enum Http2FrameFlagsWindowUpdate {
   HTTP2_FLAGS_WINDOW_UPDATE_MASK = 0x00,
 };
 
-// 6.10 Continuation
+// [RFC 7540] 6.10. Continuation
 enum Http2FrameFlagsContinuation {
   HTTP2_FLAGS_CONTINUATION_END_HEADERS = 0x04,
 
   HTTP2_FLAGS_CONTINUATION_MASK = 0x04,
 };
 
-// 6.5.2 Defined SETTINGS Parameters
+// [RFC 7540] 6.5.2. Defined SETTINGS Parameters
 enum Http2SettingsIdentifier {
   HTTP2_SETTINGS_HEADER_TABLE_SIZE = 1,
   HTTP2_SETTINGS_ENABLE_PUSH = 2,
@@ -214,7 +213,7 @@ enum Http2SettingsIdentifier {
   HTTP2_SETTINGS_MAX
 };
 
-// 4.1. Frame Format
+// [RFC 7540] 4.1. Frame Format
 struct Http2FrameHeader {
   uint32_t length;
   uint8_t type;
@@ -222,7 +221,7 @@ struct Http2FrameHeader {
   Http2StreamId streamid;
 };
 
-// 5.4.  Error Handling
+// [RFC 7540] 5.4. Error Handling
 struct Http2Error {
   Http2Error(const Http2ErrorClass error_class = HTTP2_ERROR_CLASS_NONE, const Http2ErrorCode error_code = HTTP2_ERROR_NO_ERROR)
   {
@@ -234,13 +233,13 @@ struct Http2Error {
   Http2ErrorCode code;
 };
 
-// 6.5.1. SETTINGS Format
+// [RFC 7540] 6.5.1. SETTINGS Format
 struct Http2SettingsParameter {
   uint16_t id;
   uint32_t value;
 };
 
-// 6.3 PRIORITY
+// [RFC 7540] 6.3 PRIORITY Format
 struct Http2Priority {
   Http2Priority() : stream_dependency(0), weight(15) {}
 
@@ -248,7 +247,7 @@ struct Http2Priority {
   uint8_t weight;
 };
 
-// 6.2 HEADERS Format
+// [RFC 7540] 6.2 HEADERS Format
 struct Http2HeadersParameter {
   Http2HeadersParameter() : pad_length(0) {}
 
@@ -256,7 +255,7 @@ struct Http2HeadersParameter {
   Http2Priority priority;
 };
 
-// 6.8 GOAWAY Format
+// [RFC 7540] 6.8 GOAWAY Format
 struct Http2Goaway {
   Http2Goaway() : last_streamid(0), error_code(0) {}
 
@@ -270,7 +269,7 @@ struct Http2Goaway {
   // just complicates memory management.
 };
 
-// 6.4 RST_STREAM Format
+// [RFC 7540] 6.4 RST_STREAM Format
 struct Http2RstStream {
   uint32_t error_code;
 };

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/16821eed/proxy/http2/Http2ConnectionState.cc
----------------------------------------------------------------------
diff --git a/proxy/http2/Http2ConnectionState.cc b/proxy/http2/Http2ConnectionState.cc
index a0fff63..ce89046 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -165,9 +165,9 @@ rcv_data_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const Http2
  *
  * NOTE: HEADERS Frame and CONTINUATION Frame
  *   1. A HEADERS frame with the END_STREAM flag set can be followed by
- *CONTINUATION frames on the same stream.
+ *      CONTINUATION frames on the same stream.
  *   2. A HEADERS frame without the END_HEADERS flag set MUST be followed by a
- *CONTINUATION frame
+ *      CONTINUATION frame
  */
 static Http2Error
 rcv_headers_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const Http2Frame &frame)
@@ -360,7 +360,7 @@ rcv_settings_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const H
 
   DebugSsn(&cs, "http2_cs", "[%" PRId64 "] Received SETTINGS frame.", cs.connection_id());
 
-  // 6.5 The stream identifier for a SETTINGS frame MUST be zero.
+  // [RFC 7540] 6.5. The stream identifier for a SETTINGS frame MUST be zero.
   // If an endpoint receives a SETTINGS frame whose stream identifier field is
   // anything other than 0x0, the endpoint MUST respond with a connection
   // error (Section 5.4.1) of type PROTOCOL_ERROR.
@@ -368,7 +368,7 @@ rcv_settings_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const H
     return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR);
   }
 
-  // 6.5 Receipt of a SETTINGS frame with the ACK flag set and a
+  // [RFC 7540] 6.5. Receipt of a SETTINGS frame with the ACK flag set and a
   // length field value other than 0 MUST be treated as a connection
   // error of type FRAME_SIZE_ERROR.
   if (frame.header().flags & HTTP2_FLAGS_SETTINGS_ACK) {
@@ -403,7 +403,7 @@ rcv_settings_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const H
 
     DebugSsn(&cs, "http2_cs", "[%" PRId64 "] setting param=%d value=%u", cs.connection_id(), param.id, param.value);
 
-    // 6.9.2. When the value of SETTINGS_INITIAL_WINDOW_SIZE
+    // [RFC 7540] 6.9.2. When the value of SETTINGS_INITIAL_WINDOW_SIZE
     // changes, a receiver MUST adjust the size of all stream flow control
     // windows that it maintains by the difference between the new value and
     // the old value.
@@ -414,9 +414,8 @@ rcv_settings_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const H
     cstate.client_settings.set((Http2SettingsIdentifier)param.id, param.value);
   }
 
-  // 6.5 Once all values have been applied, the recipient MUST immediately emit
-  // a
-  // SETTINGS frame with the ACK flag set.
+  // [RFC 7540] 6.5. Once all values have been applied, the recipient MUST
+  // immediately emit a SETTINGS frame with the ACK flag set.
   Http2Frame ackFrame(HTTP2_FRAME_TYPE_SETTINGS, 0, HTTP2_FLAGS_SETTINGS_ACK);
   cstate.ua_session->handleEvent(HTTP2_SESSION_EVENT_XMIT, &ackFrame);
 
@@ -428,12 +427,11 @@ rcv_push_promise_frame(Http2ClientSession &cs, Http2ConnectionState & /*cstate*/
 {
   DebugSsn(&cs, "http2_cs", "[%" PRId64 "] received PUSH_PROMISE frame", cs.connection_id());
 
-  // 8.2. A client cannot push.  Thus, servers MUST treat the receipt of a
+  // [RFC 7540] 8.2. A client cannot push. Thus, servers MUST treat the receipt of a
   // PUSH_PROMISE frame as a connection error of type PROTOCOL_ERROR.
   return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR);
 }
 
-// 6.7.  PING
 static Http2Error
 rcv_ping_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const Http2Frame &frame)
 {
@@ -442,8 +440,7 @@ rcv_ping_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const Http2
   DebugSsn(&cs, "http2_cs", "[%" PRId64 "] Received PING frame.", cs.connection_id());
 
   //  If a PING frame is received with a stream identifier field value other
-  //  than
-  //  0x0, the recipient MUST respond with a connection error of type
+  //  than 0x0, the recipient MUST respond with a connection error of type
   //  PROTOCOL_ERROR.
   if (frame.header().streamid != 0x0) {
     return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR);
@@ -607,8 +604,7 @@ rcv_continuation_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, con
   // CONTINUATION frames MUST be associated with a stream.  If a
   // CONTINUATION frame is received whose stream identifier field is 0x0,
   // the recipient MUST respond with a connection error ([RFC 7540] Section
-  // 5.4.1) of
-  // type PROTOCOL_ERROR.
+  // 5.4.1) of type PROTOCOL_ERROR.
   Http2Stream *stream = cstate.find_stream(stream_id);
   if (stream == NULL) {
     if (stream_id <= cstate.get_latest_stream_id()) {
@@ -691,7 +687,7 @@ Http2ConnectionState::main_event_handler(int event, void *edata)
     ink_assert(this->ua_session == NULL);
     this->ua_session = (Http2ClientSession *)edata;
 
-    // 3.5 HTTP/2 Connection Preface. Upon establishment of a TCP connection and
+    // [RFC 7540] 3.5. HTTP/2 Connection Preface. Upon establishment of a TCP connection and
     // determination that HTTP/2 will be used by both peers, each endpoint MUST
     // send a connection preface as a final confirmation ... The server
     // connection
@@ -724,9 +720,8 @@ Http2ConnectionState::main_event_handler(int event, void *edata)
     Http2StreamId last_streamid = frame->header().streamid;
     Http2Error error;
 
-    // 5.5 Extending HTTP/2
-    //   Implementations MUST discard frames that have unknown or unsupported
-    //   types.
+    // [RFC 7540] 5.5. Extending HTTP/2
+    //   Implementations MUST discard frames that have unknown or unsupported types.
     if (frame->header().type >= HTTP2_FRAME_TYPE_MAX) {
       DebugSsn(this->ua_session, "http2_cs", "[%" PRId64 "] Discard a frame which has unknown type, type=%x",
                this->ua_session->connection_id(), frame->header().type);
@@ -946,8 +941,7 @@ Http2ConnectionState::send_data_frame(FetchSM *fetch_sm)
       // Delete a stream immediately
       // TODO its should not be deleted for a several time to handling
       // RST_STREAM and WINDOW_UPDATE.
-      // See 'closed' state written at
-      // https://tools.ietf.org/html/draft-ietf-httpbis-http2-16#section-5.1
+      // See 'closed' state written at [RFC 7540] 5.1.
       this->delete_stream(stream);
       break;
     }
@@ -1164,35 +1158,6 @@ Http2Stream::set_body_to_fetcher(const void *data, size_t len)
   _fetch_sm->ext_write_data(data, len);
 }
 
-/*
- * 5.1. Stream States
- *
- *                       +--------+
- *                 PP    |        |    PP
- *              ,--------|  idle  |--------.
- *             /         |        |         \
- *            v          +--------+          v
- *     +----------+          |           +----------+
- *     |          |          | H         |          |
- * ,---| reserved |          |           | reserved |---.
- * |   | (local)  |          v           | (remote) |   |
- * |   +----------+      +--------+      +----------+   |
- * |      |          ES  |        |  ES          |      |
- * |      | H    ,-------|  open  |-------.      | H    |
- * |      |     /        |        |        \     |      |
- * |      v    v         +--------+         v    v      |
- * |   +----------+          |           +----------+   |
- * |   |   half   |          |           |   half   |   |
- * |   |  closed  |          | R         |  closed  |   |
- * |   | (remote) |          |           | (local)  |   |
- * |   +----------+          |           +----------+   |
- * |        |                v                 |        |
- * |        |  ES / R    +--------+  ES / R    |        |
- * |        `----------->|        |<-----------'        |
- * |  R                  | closed |                  R  |
- * `-------------------->|        |<--------------------'
- *                       +--------+
- */
 bool
 Http2Stream::change_state(uint8_t type, uint8_t flags)
 {


[2/3] trafficserver git commit: s/traffic_line/traffic_ctl/

Posted by jp...@apache.org.
s/traffic_line/traffic_ctl/


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

Branch: refs/heads/master
Commit: c498d7e66d75f0504aa0b0e8dcc5080a7fbaab1f
Parents: 09acc0b
Author: James Peach <jp...@apache.org>
Authored: Mon Oct 26 16:05:59 2015 -0700
Committer: James Peach <jp...@apache.org>
Committed: Tue Oct 27 19:15:17 2015 -0700

----------------------------------------------------------------------
 lib/records/I_RecDefs.h                          | 2 +-
 plugins/experimental/healthchecks/healthchecks.c | 2 +-
 plugins/experimental/url_sig/README              | 8 ++++----
 plugins/experimental/url_sig/url_sig.c           | 2 +-
 plugins/gzip/README                              | 4 ++--
 plugins/regex_remap/README                       | 2 +-
 rc/trafficserver.service.in                      | 2 +-
 7 files changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c498d7e6/lib/records/I_RecDefs.h
----------------------------------------------------------------------
diff --git a/lib/records/I_RecDefs.h b/lib/records/I_RecDefs.h
index c0317dd..8f9084d 100644
--- a/lib/records/I_RecDefs.h
+++ b/lib/records/I_RecDefs.h
@@ -108,7 +108,7 @@ namespace detail
 
 enum RecUpdateT {
   RECU_NULL,       // default: don't know the behavior
-  RECU_DYNAMIC,    // config can be updated dynamically w/ traffic_line -x
+  RECU_DYNAMIC,    // config can be updated dynamically w/ "traffic_ctl config reload"
   RECU_RESTART_TS, // config requires TS to be restarted to take effect
   RECU_RESTART_TM, // config requires TM/TS to be restarted to take effect
   RECU_RESTART_TC  // config requires TC/TM/TS to be restarted to take effect

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c498d7e6/plugins/experimental/healthchecks/healthchecks.c
----------------------------------------------------------------------
diff --git a/plugins/experimental/healthchecks/healthchecks.c b/plugins/experimental/healthchecks/healthchecks.c
index e83518c..b6f262f 100644
--- a/plugins/experimental/healthchecks/healthchecks.c
+++ b/plugins/experimental/healthchecks/healthchecks.c
@@ -553,7 +553,7 @@ TSPluginInit(int argc, const char *argv[])
   }
 
   /* This will update the global configuration file, and is not reloaded at run time */
-  /* ToDo: Support reloading with traffic_line -x  ? */
+  /* ToDo: Support reloading with traffic_ctl config reload ? */
   if (NULL == (g_config = parse_configs(argv[1]))) {
     TSError("[healthchecks] Unable to read / parse %s config file", argv[1]);
     return;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c498d7e6/plugins/experimental/url_sig/README
----------------------------------------------------------------------
diff --git a/plugins/experimental/url_sig/README b/plugins/experimental/url_sig/README
index d2a4ce0..aa9a650 100644
--- a/plugins/experimental/url_sig/README
+++ b/plugins/experimental/url_sig/README
@@ -37,9 +37,9 @@ Edge cache debugging
 		CONFIG proxy.config.diags.debug.enabled INT 1
 		CONFIG proxy.config.diags.debug.tags STRING url_sig
 
-	and do a traffic_line -x; Debug output will go to traffic.out.
-	Failed transactions (signature check fails that is) will be logged
-	in to error.log.
+	and do a traffic_ctl config reload; Debug output will go
+	to traffic.out.  Failed transactions (signature check fails
+	that is) will be logged in to error.log.
 
 Signing a URL
 	At the signing portal take the full URL, without any query string, and
@@ -110,7 +110,7 @@ Example
 
 		map http://test-remap.domain.com http://google.com @plugin=url_sig.so @pparam=sign_test.config
 
-	Restart traffic server or traffic_line -x - verify there are no errors in diags.log
+	Restart traffic server or "traffic_ctl config reload" - verify there are no errors in diags.log
 
 	Try the path unsigned:
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c498d7e6/plugins/experimental/url_sig/url_sig.c
----------------------------------------------------------------------
diff --git a/plugins/experimental/url_sig/url_sig.c b/plugins/experimental/url_sig/url_sig.c
index fe90ee7..96a5521 100644
--- a/plugins/experimental/url_sig/url_sig.c
+++ b/plugins/experimental/url_sig/url_sig.c
@@ -88,7 +88,7 @@ TSRemapInit(TSRemapInterface *api_info, char *errbuf, int errbuf_size)
   return TS_SUCCESS;
 }
 
-// To force a config file reload touch remap.config and do a "traffic_line -x"
+// To force a config file reload touch remap.config and do a "traffic_ctl config reload"
 TSReturnCode
 TSRemapNewInstance(int argc, char *argv[], void **ih, char *errbuf, int errbuf_size)
 {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c498d7e6/plugins/gzip/README
----------------------------------------------------------------------
diff --git a/plugins/gzip/README b/plugins/gzip/README
index 34b4ef6..4872369 100644
--- a/plugins/gzip/README
+++ b/plugins/gzip/README
@@ -24,8 +24,8 @@ in this case, the plugin will use a default behaviour:
 alternatively, a configuration can also be specified:
 gzip.so <path-to-plugin>/sample.gzip.config
 
-after modifying plugin.config, restart traffic server (sudo traffic_line -L)
-the configuration is re-read when a management update is given (sudo traffic_line -x)
+after modifying plugin.config, restart traffic server (sudo traffic_ctl server restart)
+the configuration is re-read when a management update is given (sudo traffic_ctl config reload)
 
 a sample configuration (sample.gzip.config):
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c498d7e6/plugins/regex_remap/README
----------------------------------------------------------------------
diff --git a/plugins/regex_remap/README b/plugins/regex_remap/README
index 99e9a52..9b5b7a9 100644
--- a/plugins/regex_remap/README
+++ b/plugins/regex_remap/README
@@ -19,7 +19,7 @@ traffic.out, typically in /usr/local/var/logs/trafficserver/traffic.out.
 In order to force a profile dump, you can do
 
     $ sudo touch /usr/local/etc/trafficserver/remap.config
-    $ sudo traffic_line -x
+    $ sudo traffic_ctl config reload
 
 
 By default, only the path and query string of the URL is

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c498d7e6/rc/trafficserver.service.in
----------------------------------------------------------------------
diff --git a/rc/trafficserver.service.in b/rc/trafficserver.service.in
index 9026680..d200111 100644
--- a/rc/trafficserver.service.in
+++ b/rc/trafficserver.service.in
@@ -24,7 +24,7 @@ Type=simple
 EnvironmentFile=-/etc/sysconfig/trafficserver
 PIDFile=@exp_runtimedir@/cop.pid
 ExecStart=@exp_bindir@/traffic_cop $TC_DAEMON_ARGS
-ExecReload=@exp_bindir@/traffic_line -x
+ExecReload=@exp_bindir@/traffic_ctl config reload
 
 [Install]
 WantedBy=multi-user.target


[3/3] trafficserver git commit: TS-3827: Cleanup comments related to HPACK

Posted by jp...@apache.org.
TS-3827: Cleanup comments related to HPACK

This closes #314


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

Branch: refs/heads/master
Commit: 6a111c1e69e8ef6ecc063fe0257b57eb86eb04f1
Parents: 16821ee
Author: Masaori Koshiba <mk...@yahoo-corp.jp>
Authored: Tue Oct 20 15:50:07 2015 +0900
Committer: James Peach <jp...@apache.org>
Committed: Tue Oct 27 19:15:26 2015 -0700

----------------------------------------------------------------------
 proxy/http2/HPACK.cc | 84 ++++++++++++++++++++---------------------------
 proxy/http2/HPACK.h  | 14 ++++----
 proxy/http2/HTTP2.cc | 17 +++++-----
 3 files changed, 50 insertions(+), 65 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6a111c1e/proxy/http2/HPACK.cc
----------------------------------------------------------------------
diff --git a/proxy/http2/HPACK.cc b/proxy/http2/HPACK.cc
index cdf5640..6421a37 100644
--- a/proxy/http2/HPACK.cc
+++ b/proxy/http2/HPACK.cc
@@ -1,6 +1,6 @@
 /** @file
 
-  A brief file description
+  [RFC 7541] HPACK: Header Compression for HTTP/2
 
   @section license License
 
@@ -37,10 +37,9 @@ const unsigned HPACK_LEN_AUTHORITY = countof(":authority") - 1;
 const unsigned HPACK_LEN_PATH = countof(":path") - 1;
 const unsigned HPACK_LEN_STATUS = countof(":status") - 1;
 
-// 5.1.  Maximum Table Size
-// The size of an entry is the sum of its name's length in octets (as
-// defined in Section 6.2), its value's length in octets (see
-// Section 6.2), plus 32.
+// [RFC 7541] 4.1. Calculating Table Size
+// The size of an entry is the sum of its name's length in octets (as defined in Section 5.2),
+// its value's length in octets, and 32.
 const static unsigned ADDITIONAL_OCTETS = 32;
 
 typedef enum {
@@ -195,7 +194,7 @@ Http2DynamicTable::get_header_from_indexing_tables(uint32_t index, MIMEFieldWrap
     field.name_set(name, name_len);
     field.value_set(value, value_len);
   } else {
-    // 3.3.3.  Index Address Space
+    // [RFC 7541] 2.3.3. Index Address Space
     // Indices strictly greater than the sum of the lengths of both tables
     // MUST be treated as a decoding error.
     return HPACK_ERROR_COMPRESSION_ERROR;
@@ -204,10 +203,13 @@ Http2DynamicTable::get_header_from_indexing_tables(uint32_t index, MIMEFieldWrap
   return 0;
 }
 
-// 5.2.  Entry Eviction when Header Table Size Changes
+//
+// [RFC 7541] 4.3. Entry Eviction when Header Table Size Changes
+//
 // Whenever the maximum size for the header table is reduced, entries
 // are evicted from the end of the header table until the size of the
 // header table is less than or equal to the maximum size.
+//
 bool
 Http2DynamicTable::set_dynamic_table_size(uint32_t new_size)
 {
@@ -239,10 +241,10 @@ Http2DynamicTable::add_header_field(const MIMEField *field)
   uint32_t header_size = ADDITIONAL_OCTETS + name_len + value_len;
 
   if (header_size > _settings_dynamic_table_size) {
-    // 5.3. It is not an error to attempt to add an entry that is larger than
-    // the maximum size; an
-    // attempt to add an entry larger than the entire table causes the table to
-    // be emptied of all existing entries.
+    // [RFC 7541] 4.4. Entry Eviction When Adding New Entries
+    // It is not an error to attempt to add an entry that is larger than
+    // the maximum size; an attempt to add an entry larger than the entire
+    // table causes the table to be emptied of all existing entries.
     _headers.clear();
     _mhdr->fields_clear();
     _current_size = 0;
@@ -267,9 +269,11 @@ Http2DynamicTable::add_header_field(const MIMEField *field)
   }
 }
 
+//
 // The first byte of an HPACK field unambiguously tells us what
 // kind of field it is. Field types are specified in the high 4 bits
 // and all bits are defined, so there's no way to get an invalid field type.
+//
 HpackFieldType
 hpack_parse_field_type(uint8_t ftype)
 {
@@ -293,18 +297,9 @@ hpack_parse_field_type(uint8_t ftype)
   return HPACK_FIELD_NOINDEX_LITERAL;
 }
 
-/*
- * Pseudo code
- *
- * if I < 2^N - 1, encode I on N bits
- * else
- *   encode (2^N - 1) on N bits
- *   I = I - (2^N - 1)
- *   while I >= 128
- *     encode (I % 128 + 128) on 8 bits
- *     I = I / 128
- *   encode I on 8 bits
- */
+//
+// [RFC 7541] 5.1. Integer representation
+//
 int64_t
 encode_integer(uint8_t *buf_start, const uint8_t *buf_end, uint32_t value, uint8_t n)
 {
@@ -481,23 +476,9 @@ encode_literal_header_field(uint8_t *buf_start, const uint8_t *buf_end, const MI
   return p - buf_start;
 }
 
-/*
- * 6.1.  Integer representation
- *
- * Pseudo code
- *
- * decode I from the next N bits
- *    if I < 2^N - 1, return I
- *    else
- *        M = 0
- *        repeat
- *            B = next octet
- *            I = I + (B & 127) * 2^M
- *            M = M + 7
- *        while B & 128 == 128
- *        return I
- *
- */
+//
+// [RFC 7541] 5.1. Integer representation
+//
 int64_t
 decode_integer(uint32_t &dst, const uint8_t *buf_start, const uint8_t *buf_end, uint8_t n)
 {
@@ -528,8 +509,10 @@ decode_integer(uint32_t &dst, const uint8_t *buf_start, const uint8_t *buf_end,
   return p - buf_start + 1;
 }
 
-// 6.2 return content from String Data (Length octets)
-// with huffman decoding if it is encoded
+//
+// [RFC 7541] 5.2. String Literal Representation
+// return content from String Data (Length octets) with huffman decoding if it is encoded
+//
 int64_t
 decode_string(Arena &arena, char **str, uint32_t &str_length, const uint8_t *buf_start, const uint8_t *buf_end)
 {
@@ -570,7 +553,9 @@ decode_string(Arena &arena, char **str, uint32_t &str_length, const uint8_t *buf
   return p + encoded_string_len - buf_start;
 }
 
-// 7.1. Indexed Header Field Representation
+//
+// [RFC 7541] 6.1. Indexed Header Field Representation
+//
 int64_t
 decode_indexed_header_field(MIMEFieldWrapper &header, const uint8_t *buf_start, const uint8_t *buf_end,
                             Http2DynamicTable &dynamic_table)
@@ -600,7 +585,10 @@ decode_indexed_header_field(MIMEFieldWrapper &header, const uint8_t *buf_start,
   return len;
 }
 
-// 7.2.  Literal Header Field Representation
+//
+// [RFC 7541] 6.2. Literal Header Field Representation
+// Decode Literal Header Field Representation based on HpackFieldType
+//
 int64_t
 decode_literal_header_field(MIMEFieldWrapper &header, const uint8_t *buf_start, const uint8_t *buf_end,
                             Http2DynamicTable &dynamic_table)
@@ -612,15 +600,11 @@ decode_literal_header_field(MIMEFieldWrapper &header, const uint8_t *buf_start,
   HpackFieldType ftype = hpack_parse_field_type(*p);
 
   if (ftype == HPACK_FIELD_INDEXED_LITERAL) {
-    // 7.2.1. index extraction based on Literal Header Field with Incremental
-    // Indexing
     len = decode_integer(index, p, buf_end, 6);
     isIncremental = true;
   } else if (ftype == HPACK_FIELD_NEVERINDEX_LITERAL) {
-    // 7.2.3. index extraction Literal Header Field Never Indexed
     len = decode_integer(index, p, buf_end, 4);
   } else {
-    // 7.2.2. index extraction Literal Header Field without Indexing
     ink_assert(ftype == HPACK_FIELD_NOINDEX_LITERAL);
     len = decode_integer(index, p, buf_end, 4);
   }
@@ -684,7 +668,9 @@ decode_literal_header_field(MIMEFieldWrapper &header, const uint8_t *buf_start,
   return p - buf_start;
 }
 
-// 7.3. Header Table Size Update
+//
+// [RFC 7541] 6.3. Dynamic Table Size Update
+//
 int64_t
 update_dynamic_table_size(const uint8_t *buf_start, const uint8_t *buf_end, Http2DynamicTable &dynamic_table)
 {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6a111c1e/proxy/http2/HPACK.h
----------------------------------------------------------------------
diff --git a/proxy/http2/HPACK.h b/proxy/http2/HPACK.h
index e1bf430..ebe9a5d 100644
--- a/proxy/http2/HPACK.h
+++ b/proxy/http2/HPACK.h
@@ -1,6 +1,6 @@
 /** @file
 
-  A brief file description
+  [RFC 7541] HPACK: Header Compression for HTTP/2
 
   @section license License
 
@@ -48,11 +48,11 @@ const static int HPACK_ERROR_COMPRESSION_ERROR = -1;
 const static int HPACK_ERROR_HTTP2_PROTOCOL_ERROR = -2;
 
 enum HpackFieldType {
-  HPACK_FIELD_INDEX,              // HPACK 7.1 Indexed Header Field Representation
-  HPACK_FIELD_INDEXED_LITERAL,    // HPACK 7.2.1 Literal Header Field with Incremental Indexing
-  HPACK_FIELD_NOINDEX_LITERAL,    // HPACK 7.2.2 Literal Header Field without Indexing
-  HPACK_FIELD_NEVERINDEX_LITERAL, // HPACK 7.2.3 Literal Header Field never Indexed
-  HPACK_FIELD_TABLESIZE_UPDATE,   // HPACK 7.3 Header Table Size Update
+  HPACK_FIELD_INDEX,              // [RFC 7541] 6.1. Indexed Header Field Representation
+  HPACK_FIELD_INDEXED_LITERAL,    // [RFC 7541] 6.2.1. Literal Header Field with Incremental Indexing
+  HPACK_FIELD_NOINDEX_LITERAL,    // [RFC 7541] 6.2.2. Literal Header Field without Indexing
+  HPACK_FIELD_NEVERINDEX_LITERAL, // [RFC 7541] 6.2.3. Literal Header Field never Indexed
+  HPACK_FIELD_TABLESIZE_UPDATE,   // [RFC 7541] 6.3. Dynamic Table Size Update
 };
 
 class MIMEFieldWrapper
@@ -96,7 +96,7 @@ private:
   MIMEHdrImpl *_mh;
 };
 
-// 2.3.2. Dynamic Table
+// [RFC 7541] 2.3.2. Dynamic Table
 class Http2DynamicTable
 {
 public:

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6a111c1e/proxy/http2/HTTP2.cc
----------------------------------------------------------------------
diff --git a/proxy/http2/HTTP2.cc b/proxy/http2/HTTP2.cc
index 82b1657..79cd212 100644
--- a/proxy/http2/HTTP2.cc
+++ b/proxy/http2/HTTP2.cc
@@ -733,15 +733,14 @@ const static int MAX_TEST_FIELD_NUM = 8;
 
 /***********************************************************************************
  *                                                                                 *
- *                   Test cases for regression test *
+ *                       Regression test for HPACK                                 *
  *                                                                                 *
- * Some test cases are based on examples of specification. *
- * http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-09#appendix-D
- **
+ *  Some test cases are based on examples of specification.                        *
+ *  - https://tools.ietf.org/html/rfc7541#appendix-C                               *
  *                                                                                 *
  ***********************************************************************************/
 
-// D.1.  Integer Representation Examples
+// [RFC 7541] C.1. Integer Representation Examples
 const static struct {
   uint32_t raw_integer;
   uint8_t *encoded_field;
@@ -762,7 +761,7 @@ const static struct {
                                                                "\x25\xa8\x49\xe9\x5b\xa9\x7d\x7f",
                          9}};
 
-// D.2.4.  Indexed Header Field
+// [RFC 7541] C.2.4. Indexed Header Field
 const static struct {
   int index;
   char *raw_name;
@@ -771,7 +770,7 @@ const static struct {
   int encoded_field_len;
 } indexed_test_case[] = {{2, (char *) ":method", (char *) "GET", (uint8_t *) "\x82", 1}};
 
-// D.2.  Header Field Representation Examples
+// [RFC 7541] C.2. Header Field Representation Examples
 const static struct {
   char *raw_name;
   char *raw_value;
@@ -814,7 +813,7 @@ const static struct {
                                                                                          "secret",
    17}};
 
-// D.3.  Request Examples without Huffman Coding - D.3.1.  First Request
+// [RFC 7541] C.3. Request Examples without Huffman Coding - C.3.1. First Request
 const static struct {
   char *raw_name;
   char *raw_value;
@@ -844,7 +843,7 @@ const static struct {
 
 /***********************************************************************************
  *                                                                                 *
- *                                Regression test codes *
+ *                                Regression test codes                            *
  *                                                                                 *
  ***********************************************************************************/