aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXe Iaso <me@xeiaso.net>2025-01-24 15:34:10 -0500
committerXe Iaso <me@xeiaso.net>2025-01-24 15:34:15 -0500
commit2eae2a4cf5ed2507f6525e2f3c2e055935eeda0e (patch)
tree90a387184d942333468f4e48c25786ef085d04a8
parent1cab72372520f232a64a37aaebbc42068af6151e (diff)
downloadx-2eae2a4cf5ed2507f6525e2f3c2e055935eeda0e.tar.xz
x-2eae2a4cf5ed2507f6525e2f3c2e055935eeda0e.zip
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 <me@xeiaso.net>
-rw-r--r--cmd/anubis/main.go3
-rw-r--r--cmd/httpdebug/main.go7
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("---")
},
)))
}