Skip to content

Commit

Permalink
Support h2
Browse files Browse the repository at this point in the history
  • Loading branch information
mt-inside committed Oct 23, 2023
1 parent f053707 commit 5b74b27
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ run-daemon-image:

run-daemon *ARGS: test
go run {{LD_COMMON}} ./cmd/http-log -K=ecdsa {{ARGS}}
run-daemon-no-tls *ARGS: test
go run {{LD_COMMON}} ./cmd/http-log {{ARGS}}

run-daemon-mtls-jwt *ARGS: test
# FIXME hardcoded path; copy JWT creation stuff from istio-demo-master into mkpki
Expand Down
4 changes: 3 additions & 1 deletion cmd/http-log/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ func main() {
ListenAddr string `short:"a" long:"addr" description:"Listen address eg 127.0.0.1:8080" default:":8080"`
HandleTimeout time.Duration `long:"timeout" description:"Timeout for each of request reading and response writing" default:"60s"`
Timeout time.Duration `long:"handle-timeout" description:"Timeout for network fetches used to encrich the output" default:"10s"`
Http11 bool `long:"http-11" description:"Force http/1.1 (disallow TLS ALPN negotiation of http2)"`

/* Response options */
Status int `short:"s" long:"status" description:"HTTP status code to return" default:"200"`
Expand Down Expand Up @@ -355,7 +356,8 @@ func main() {

// Close over this req/respData
cfg := &tls.Config{
ClientAuth: tls.RequestClientCert, // request but don't require. TODO when we verify them, this should be VerifyClientCertIfGiven
NextProtos: utils.Ternary(opts.Http11, nil, []string{"h2", "http/1.1"}), // Because we're providing our own tls.Config, this is by default empty, so h1.1 will be negotiated. So we manually send this.
ClientAuth: tls.RequestClientCert, // request but don't require. TODO when we verify them, this should be VerifyClientCertIfGiven
GetCertificate: func(hi *tls.ClientHelloInfo) (*tls.Certificate, error) {
log.Info("TLS Asked for serving cert")
if srvData.TlsServingSelfSign {
Expand Down
2 changes: 1 addition & 1 deletion melange.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package:
name: http-log
epoch: 0
version: v0.7.17-dirty
version: v0.7.17-3-gea2a80b-dirty
description: Logs HTTP requests
url: https://github.com/mt-inside/http-log
copyright:
Expand Down

0 comments on commit 5b74b27

Please sign in to comment.