From b85da8e1d0643918fb5bda9e64ec71aade827021 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Tue, 2 May 2023 14:03:07 +0300 Subject: [PATCH] I stopped using Xombrero --- doc/index.texi | 3 --- rounds/noHead.go | 36 ------------------------------------ rounds/transcodeWebP.go | 7 +------ trip.go | 1 - 4 files changed, 1 insertion(+), 46 deletions(-) delete mode 100644 rounds/noHead.go diff --git a/doc/index.texi b/doc/index.texi index 4df3b7e..b6704a6 100644 --- a/doc/index.texi +++ b/doc/index.texi @@ -83,9 +83,6 @@ And additional personal preferences: @item Various spying domains (advertisement, tracking counters) are denied. -@item -@code{HEAD} method is forbidden. Xombrero likes it too much. - @item @code{www.reddit.com} is redirected to @code{old.reddit.com} (because it works without JavaScript and looks nicer). diff --git a/rounds/noHead.go b/rounds/noHead.go deleted file mode 100644 index ce0d103..0000000 --- a/rounds/noHead.go +++ /dev/null @@ -1,36 +0,0 @@ -/* -tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU - manager, WARC/geminispace browser -Copyright (C) 2021-2023 Sergey Matveev - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 3 of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -package rounds - -import ( - "net/http" -) - -func RoundNoHead( - host string, - resp *http.Response, - w http.ResponseWriter, - req *http.Request, -) (bool, error) { - if req.Method == http.MethodHead { - http.Error(w, "deny HEAD", http.StatusMethodNotAllowed) - return false, nil - } - return true, nil -} diff --git a/rounds/transcodeWebP.go b/rounds/transcodeWebP.go index 016c617..7c4995d 100644 --- a/rounds/transcodeWebP.go +++ b/rounds/transcodeWebP.go @@ -25,24 +25,19 @@ import ( "net/http" "os" "os/exec" - "strings" "go.stargrave.org/tofuproxy/fifos" ) const CmdDWebP = "dwebp" -func isXombrero(req *http.Request) bool { - return strings.Contains(req.Header.Get("User-Agent"), "AppleWebKit/538.15") -} - func RoundTranscodeWebP( host string, resp *http.Response, w http.ResponseWriter, req *http.Request, ) (bool, error) { - if resp.Header.Get("Content-Type") != "image/webp" || isXombrero(req) { + if resp.Header.Get("Content-Type") != "image/webp" { return true, nil } tmpFd, err := os.CreateTemp("", "tofuproxy.*.webp") diff --git a/trip.go b/trip.go index 975776b..4f3e1d6 100644 --- a/trip.go +++ b/trip.go @@ -65,7 +65,6 @@ func roundTrip(w http.ResponseWriter, req *http.Request) { 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, -- 2.44.0