Skip to content

Commit

Permalink
Improve log output for HTTP/2.
Browse files Browse the repository at this point in the history
  • Loading branch information
s-ludwig committed Jun 28, 2024
1 parent da4b92b commit 7fbc1f4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
6 changes: 4 additions & 2 deletions source/vibe/http/internal/http2/exchange.d
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,9 @@ bool handleHTTP2Request(UStream)(ref HTTP2ConnectionStream!UStream stream,
parsed = true;
logTrace("persist: %s", req.persistent);
//keep_alive = req.persistent;
logDebug("Received %s request on stream ID %d", req.method, stream.streamId);
logDebug("Received request on stream ID %d: %s %s", stream.streamId, req.method, req.requestPath);
foreach (k, v; req.headers.byKeyValue)
logDebugV("%s: %s", k, v);

// utility to format the status line
auto statusLine = AllocAppender!string(alloc);
Expand Down Expand Up @@ -447,7 +449,7 @@ bool handleHTTP2Request(UStream)(ref HTTP2ConnectionStream!UStream stream,
}

} catch (Exception e) {
logDebug("[DATA] "~e.msg);
logException(e, "Failed to send DATA frame");
return;
}
}
Expand Down
2 changes: 2 additions & 0 deletions source/vibe/http/internal/http2/server.d
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,11 @@ private void handleHTTP2FrameChain(ConnectionStream)(ConnectionStream stream, TC

final switch(st) {
case WaitForDataAsyncStatus.waiting:
logTrace("need to wait for more data asynchronously");
return;

case WaitForDataAsyncStatus.noMoreData:
logTrace("connection closed by remote side");
stream.finalize();
connection.close();
return;
Expand Down
1 change: 1 addition & 0 deletions source/vibe/http/server.d
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ void handleHTTPConnection(TCPConnection connection, HTTPServerContext context)

Nullable!string proto = tls_stream.alpn;
if(!proto.isNull && proto == "h2" && (context.m_virtualHosts[0].settings.options & HTTPServerOption.enableHTTP2)) {
logTrace("Using HTTP/2 as requested per ALPN");
HTTP2Settings settings;
auto h2context = new HTTP2ServerContext(context, settings);
handleHTTP2Connection(tls_stream, connection, h2context);
Expand Down

0 comments on commit 7fbc1f4

Please sign in to comment.