Skip to content

Commit

Permalink
TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
mt-inside committed Mar 27, 2024
1 parent b6f5e92 commit 6855115
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
19 changes: 19 additions & 0 deletions cmd/http-log/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ package main

// TODO: h3 test servers (more for p-c): google, youtube, cloudflare-quic.com

/* TODO: --who-am-i option, for the server startup and the response body to use envbin lib and print (if applicable):
* - cloud provider one-line info
* - k8s info, one line for CP, one for Node, one for Pod (with sidecar info)
* - one line ext IP info
*/

import (
"context"
"crypto/tls"
Expand Down Expand Up @@ -398,6 +404,19 @@ func main() {
// - in the conn_close handler, check the connection number and ignore it if we've already printed it
// - as a backstop, set idle timeout waay shorter (rather than running the timer ourself) - need to check if that actually works, or if h2 keepalives reset it
// - can't be too short, else we'll time out slow clients
// Sketch arch:
// - have a connection_manager class (owns hackStore)
// - gets all the conn state change events, plus calls from eg http handler saying done
// - make these done(stage String) (eg done("http")), err(stage) eg err("tls")
// - just log the events, and print the connection table for now, to see what's going on
// - this is actually a RequestManager
// - we naievly assumed that a request ending is signaled by a connection ending
// - track connections, and requests, and assign reqs to conns
// - conn closing closes all the requests under it
// - req_new is gonna be like the tls hi handler, or http handler for non-tls?
// - req_err is gonna be... all error handling paths?
// - req_done is gonna be end of the http handler? which one? log middle? whatever's given to stdlib. Think can just add to log_moddle, or might wanna wrap again
// - how catch all errors in an http handler?
if cs == http.StateClosed {
srvData := ctxt.SrvDataFromContext(ctx)
reqData := ctxt.ReqDataFromContext(ctx)
Expand Down
4 changes: 4 additions & 0 deletions pkg/output/renderer_tty.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ func NewTtyRenderer(s TtyStyler, opOpts RendererOpts) TtyRenderer {
}

func (o TtyRenderer) Output(srvData *state.DaemonData, reqData *state.RequestData, respData *state.ResponseData) {
// TODO: like print-cert, we need to get an idea of "how far we got" through these stages, and only print the appropriate ones
// - eg if something fails we often end up printing lots of ugly <nones>
// - and sometimes it crashes, eg run -K=ecdsa (self-sign enabled), and hit it with a plaintext request. Something somewhere emits "http: TLS handshake error from 10.244.120.92:48838: tls: first record does not look like a TLS handshake", but then we try to print TLS stuff, and as it happens, blow up on r.TlsNegServerCert being nil

if o.opOpts.ConnectionSummary {
o.TransportSummary(reqData)
} else if o.opOpts.ConnectionFull {
Expand Down
2 changes: 1 addition & 1 deletion pkg/output/styler_tty.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ func (s TtyStyler) verifiedCertChain(
}
b.Linef("Requested SNI (%s) in DNS/IP SANs? %s; in CN? %s",
s.au.Colorize(validateAddr, AddrStyle),
s.YesError(head.VerifyHostname(validateAddr)),
s.YesError(head.VerifyHostname(validateAddr)), // TODO: strip any port, and iff IP wrap in []
s.YesInfo(strings.EqualFold(head.Subject.CommonName, validateAddr)),
)
}
Expand Down

0 comments on commit 6855115

Please sign in to comment.