about summary refs log tree commit diff
path: root/app/lib/webfinger.rb
diff options
context:
space:
mode:
authorCecylia Bocovich <cohosh@torproject.org>2021-02-10 22:40:13 -0500
committerGitHub <noreply@github.com>2021-02-11 04:40:13 +0100
commite79f8dd85cb63125185fdf711f470c298a0b5dbc (patch)
treec27f1d0e2cd45262934fd5729e9ae3cd824747b3 /app/lib/webfinger.rb
parentd499bb031f0d20a5f27facfd57cf4e00f89003d7 (diff)
Onion service related changes to HTTPS handling (#15560)
* Enable secure cookie flag for https only

* Disable force_ssl for .onion hosts only

Co-authored-by: Aiden McClelland <me@drbonez.dev>
Diffstat (limited to 'app/lib/webfinger.rb')
-rw-r--r--app/lib/webfinger.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/app/lib/webfinger.rb b/app/lib/webfinger.rb
index 702365939..40795a7aa 100644
--- a/app/lib/webfinger.rb
+++ b/app/lib/webfinger.rb
@@ -88,10 +88,18 @@ class Webfinger
   end
 
   def standard_url
-    "https://#{@domain}/.well-known/webfinger?resource=#{@uri}"
+    if @domain.ends_with? ".onion"
+      "http://#{@domain}/.well-known/webfinger?resource=#{@uri}"
+    else
+      "https://#{@domain}/.well-known/webfinger?resource=#{@uri}"
+    end
   end
 
   def host_meta_url
-    "https://#{@domain}/.well-known/host-meta"
+    if @domain.ends_with? ".onion"
+      "http://#{@domain}/.well-known/host-meta"
+    else
+      "https://#{@domain}/.well-known/host-meta"
+    end
   end
 end