Skip to content

fix: print TLS connection information before HTTP request headers - #36

Open
AdamMagued wants to merge 2 commits into
henvic:mainfrom
AdamMagued:fix-tls-info-print-order
Open

AdamMagued wants to merge 2 commits into
henvic:mainfrom
AdamMagued:fix-tls-info-print-order

Conversation

@AdamMagued

Copy link
Copy Markdown

When logging outgoing HTTP traffic with TLS enabled, TLS connection details and server certificates were printed after the request headers block during the response phase.

This change adjusts RoundTrip logging:

  • When TLS logging is enabled, outgoing request header and body formatting are buffered prior to executing the round trip.
  • Once the round trip completes and TLS connection state is established, TLS connection details and server certificate info are printed before the request header block, matching the chronological order used on incoming server traffic.
  • If a connection error occurs before response receipt, the buffered request headers and error message are emitted as before.
  • Updated golden test fixtures in testdata/log.txtar.
  • Added TestOutgoingTLSPrintOrder to verify the printing order across NoBuffer, OnReady, and OnEnd flush strategies.

Fixes #1

When logging outgoing HTTP traffic with TLS enabled, TLS connection and server certificate details were previously printed after the request headers.

Buffer outgoing request output when TLS logging is enabled so that TLS connection state and server certificate details can be emitted before the request header block once established, matching the chronological order observed on incoming server traffic. Update golden test fixtures and add TestOutgoingTLSPrintOrder to verify order across flush strategies.

Fixes henvic#1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TLS information should print before HTTP request header

1 participant