aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus@rgdd.se>2025-03-11 18:56:25 +0100
committerRasmus Dahlberg <rasmus@rgdd.se>2025-03-11 18:56:25 +0100
commitc0fad35e1e4a60f0615bd04af052860e386b974b (patch)
tree7468f91fc5ac8be6ae5e8c29953c709dcb98e154
parent0cfc1759e5548dcfb133a6268c5d49976871cd43 (diff)
fix: Attribute OL with the domain we arrived at
-rw-r--r--main.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/main.go b/main.go
index 539e86f..72f6dd1 100644
--- a/main.go
+++ b/main.go
@@ -129,6 +129,15 @@ func work(ctx context.Context, cli *http.Client, timeout time.Duration, question
}
defer rsp.Body.Close()
+ // We're using an HTTP client that follows redirects. Ensure that we're
+ // attributing any found Onion-Location header with the domain name we were
+ // redirected too, rather than the original domain name that we started
+ // from. If there are no redirects this assignment doesn't change anything.
+ //
+ // More details on why this behavior matters:
+ // https://gitlab.torproject.org/tpo/onion-services/onion-grab/-/issues/1
+ answer.Domain = rsp.Request.URL.Host
+
onion, ok := onionloc.HTTP(rsp)
if ok {
answer.HTTP = onion