From 2eae2a4cf5ed2507f6525e2f3c2e055935eeda0e Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Fri, 24 Jan 2025 15:34:10 -0500 Subject: cmd/anubis: don't include Accept-Encoding in challenge Browsers are known to change the Accept-Encoding header based on what media type is being accepted. I kinda hate this too, but such is life. Signed-off-by: Xe Iaso --- cmd/anubis/main.go | 3 +-- cmd/httpdebug/main.go | 7 ++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/anubis/main.go b/cmd/anubis/main.go index bda4892..4de13ed 100644 --- a/cmd/anubis/main.go +++ b/cmd/anubis/main.go @@ -131,8 +131,7 @@ func (s *Server) challengeFor(r *http.Request) string { fp := sha256.Sum256(s.priv.Seed()) data := fmt.Sprintf( - "Accept-Encoding=%s,Accept-Language=%s,X-Real-IP=%s,User-Agent=%s,WeekTime=%s,Fingerprint=%x", - r.Header.Get("Accept-Encoding"), + "Accept-Language=%s,X-Real-IP=%s,User-Agent=%s,WeekTime=%s,Fingerprint=%x", r.Header.Get("Accept-Language"), r.Header.Get("X-Real-Ip"), r.UserAgent(), diff --git a/cmd/httpdebug/main.go b/cmd/httpdebug/main.go index 8d61c03..1f7a042 100644 --- a/cmd/httpdebug/main.go +++ b/cmd/httpdebug/main.go @@ -2,9 +2,12 @@ package main import ( "flag" + "fmt" + "io" "log" "log/slog" "net/http" + "os" "within.website/x/internal" ) @@ -19,7 +22,9 @@ func main() { slog.Info("listening", "url", "http://localhost"+*bind) log.Fatal(http.ListenAndServe(*bind, http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { - r.Write(w) + fmt.Println("---") + r.Write(io.MultiWriter(w, os.Stdout)) + fmt.Println("---") }, ))) } -- cgit v1.2.3