@item TLS connection between client and @command{tofuproxy} has the
proper hostname set in ephemeral on-the-fly generated certificate.
-@item @code{HEAD} method for Xombrero is forbidden, as it loves it too much.
+@item @code{HEAD} method is forbidden, as Xombrero loves it too much and
+ it does not send User-Agent to differentiate it from others.
@item @code{www.reddit.com} is redirected to @code{old.reddit.com}.
import (
"net/http"
- "strings"
)
-func isXombrero(req *http.Request) bool {
- return strings.Contains(req.Header.Get("User-Agent"), "AppleWebKit/538.15")
-}
-
func RoundNoHead(
host string,
resp *http.Response,
w http.ResponseWriter,
req *http.Request,
) (bool, error) {
- if req.Method == http.MethodHead && isXombrero(req) {
+ if req.Method == http.MethodHead {
http.Error(w, "deny HEAD", http.StatusMethodNotAllowed)
return false, nil
}
"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,