]> granicus.if.org Git - apache/commitdiff
mod_http2: latest h2/state debug draft, fixes in 100-continue response generation
authorStefan Eissing <icing@apache.org>
Wed, 24 Aug 2016 14:44:53 +0000 (14:44 +0000)
committerStefan Eissing <icing@apache.org>
Wed, 24 Aug 2016 14:44:53 +0000 (14:44 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1757534 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/http2/h2_filter.c
modules/http2/h2_response.c
modules/http2/h2_stream.c
modules/http2/h2_stream.h
modules/http2/h2_task.c

diff --git a/CHANGES b/CHANGES
index b646303dad41ba7bf64ae10b0bd885cb66dfa494..e3d29430e1453c8afad943d5f9a818fe5171a6c0 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) mod_http2: h2 status resource follows latest draft, see
+     http://www.ietf.org/id/draft-benfield-http2-debug-state-01.txt
+     [Stefan Eissing]
+     
   *) mod_http2: handling graceful shutdown gracefully, e.g. handling existing
      streams to the end. [Stefan Eissing]
   
index 4a1b33df751ecf71bf674fb4750cd2e06f85c141..ce94b52ed6e0ca229e0d932ca62b8ab863937793 100644 (file)
@@ -258,6 +258,7 @@ static int add_stream(h2_stream *stream, void *ctx)
     flowOut = nghttp2_session_get_stream_remote_window_size(x->s->ngh2, stream->id);
     bbout(x->bb, "%s\n    \"%d\": {\n", (x->idx? "," : ""), stream->id);
     bbout(x->bb, "    \"state\": \"%s\",\n", h2_stream_state_str(stream));
+    bbout(x->bb, "    \"created\": %f,\n", ((double)stream->created)/APR_USEC_PER_SEC);
     bbout(x->bb, "    \"flowIn\": %d,\n", flowIn);
     bbout(x->bb, "    \"flowOut\": %d,\n", flowOut);
     bbout(x->bb, "    \"dataIn\": %"APR_UINT64_T_FMT",\n", stream->in_data_octets);  
@@ -363,6 +364,7 @@ static apr_status_t h2_status_stream_filter(h2_stream *stream)
                    apr_itoa(stream->pool, connFlowOut));
      
     bbout(bb, "{\n");
+    bbout(bb, "  \"version\": \"draft-01\",\n");
     add_settings(bb, s, 0);
     add_peer_settings(bb, s, 0);
     bbout(bb, "  \"connFlowIn\": %d,\n", connFlowIn);
index 80d8b031e6ab779564c86a2784c9d1c94bfdd1ab..792e7e57e0bf192db0e90f7cc8c56ce03a089dc7 100644 (file)
@@ -144,7 +144,7 @@ h2_response *h2_response_rcreate(int stream_id, request_rec *r, int status,
     response->stream_id      = stream_id;
     response->http_status    = status;
     response->content_length = -1;
-    response->headers        = header;
+    response->headers        = header? header : apr_table_make(pool, 5);
     response->sos_filter     = get_sos_filter(r->notes);
 
     check_clen(response, r, pool);
index a3999ae75a63b4a4e1181b3f3f2078d95ba74d4c..9b4c017567726d79d5a69af7c467ee5f7d5eb93c 100644 (file)
@@ -181,6 +181,7 @@ h2_stream *h2_stream_open(int id, apr_pool_t *pool, h2_session *session,
     h2_stream *stream = apr_pcalloc(pool, sizeof(h2_stream));
     
     stream->id        = id;
+    stream->created   = apr_time_now();
     stream->state     = H2_STREAM_ST_IDLE;
     stream->pool      = pool;
     stream->session   = session;
index 663221c8feab18bf272c5e01d49155cbde37489f..7edfae754ab6b3141389ba770ad8fee829af4ebd 100644 (file)
@@ -43,6 +43,7 @@ typedef struct h2_stream h2_stream;
 
 struct h2_stream {
     int id;                     /* http2 stream id */
+    apr_time_t created;         /* when stream was created */
     h2_stream_state_t state;    /* http/2 state of this stream */
     struct h2_session *session; /* the session this stream belongs to */
     
index daca5f18855c077e92a55d83aa33c651d4aa7e05..75f376cf0ff4c6e549f98548a0cdef21d2ea80e0 100644 (file)
@@ -520,11 +520,11 @@ static apr_status_t h2_filter_continue(ap_filter_t* f,
     apr_status_t status;
     
     AP_DEBUG_ASSERT(task);
-    if (f->r->expecting_100) {
+    if (f->r->expecting_100 && ap_is_HTTP_SUCCESS(f->r->status)) {
         h2_response *response;
 
         response = h2_response_rcreate(task->stream_id, f->r, HTTP_CONTINUE, 
-                                       f->r->headers_out, f->r->pool);
+                                       NULL, f->r->pool);
         ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, f->r,
                       "h2_task(%s): send 100 Continue", task->id);
         status = open_response(task, response);