X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=trip.go;h=73807a7967b418499fd38839559efa470170ddcc;hb=aca0f719ffa95e51420a625813f2f4cbf1d5397c;hp=d4ed57205bbd8d184320dc8412ed0f9be395dce4;hpb=df97583cd82601875eab45e250e08966f2529a7a;p=tofuproxy.git diff --git a/trip.go b/trip.go index d4ed572..73807a7 100644 --- a/trip.go +++ b/trip.go @@ -1,5 +1,6 @@ /* -tofuproxy -- HTTP proxy with TLS certificates management +tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU + manager, WARC/geminispace browser Copyright (C) 2021 Sergey Matveev This program is free software: you can redistribute it and/or modify @@ -30,6 +31,7 @@ import ( "go.stargrave.org/tofuproxy/caches" "go.stargrave.org/tofuproxy/fifos" "go.stargrave.org/tofuproxy/rounds" + ttls "go.stargrave.org/tofuproxy/tls" ) var ( @@ -41,7 +43,7 @@ var ( MaxIdleConns: http.DefaultTransport.(*http.Transport).MaxIdleConns, IdleConnTimeout: http.DefaultTransport.(*http.Transport).IdleConnTimeout * 2, TLSHandshakeTimeout: time.Minute, - DialTLSContext: dialTLS, + DialTLSContext: ttls.DialTLS, ForceAttemptHTTP2: true, } proxyHeaders = map[string]struct{}{ @@ -59,10 +61,13 @@ type Round func( ) (bool, error) func roundTrip(w http.ResponseWriter, req *http.Request) { + defer req.Body.Close() fifos.LogReq <- fmt.Sprintf("%s %s", req.Method, req.URL) host := strings.TrimSuffix(req.URL.Host, ":443") for _, round := range []Round{ rounds.RoundNoHead, + rounds.RoundGemini, + rounds.RoundWARC, rounds.RoundDenySpy, rounds.RoundRedditOld, rounds.RoundHabrImage,