config: make sending the user agent configurable, disable sending the user agent...
authorWilliam Pitcock <nenolod@dereferenced.org>
Fri, 17 May 2019 20:28:58 +0000 (20:28 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Fri, 17 May 2019 20:28:58 +0000 (20:28 +0000)
config/config.exs
config/test.exs
lib/pleroma/http/request_builder.ex

index e82f08e076bfcfbe6adb3f3ad06b06b648b8a281..9a10b0ff783461beca9d83d5463bce8dde4277da 100644 (file)
@@ -192,6 +192,7 @@ config :tesla, adapter: Tesla.Adapter.Hackney
 # Configures http settings, upstream proxy etc.
 config :pleroma, :http,
   proxy_url: nil,
+  send_user_agent: true,
   adapter: [
     ssl_options: [
       # We don't support TLS v1.3 yet
index e1785d10fe27898a9ddb88d8869a9471b3deb180..6100989c42788197a14198dd8a50b86791ee3550 100644 (file)
@@ -63,6 +63,8 @@ config :pleroma, :app_account_creation, max_requests: 5
 
 config :pleroma, :http_security, report_uri: "https://endpoint.com"
 
+config :pleroma, :http, send_user_agent: false
+
 rum_enabled = System.get_env("RUM_ENABLED") == "true"
 config :pleroma, :database, rum_enabled: rum_enabled
 IO.puts("RUM enabled: #{rum_enabled}")
index 522728da194d985f50fa24638a0d3667709feb4b..e2345799932b11cdb462714f67ea59af7166123f 100644 (file)
@@ -46,7 +46,13 @@ defmodule Pleroma.HTTP.RequestBuilder do
   """
   @spec headers(map(), list(tuple)) :: map()
   def headers(request, header_list) do
-    header_list = header_list ++ [{"User-Agent", Pleroma.Application.user_agent()}]
+    header_list =
+      if Pleroma.Config.get([:http, :send_user_agent]) do
+        header_list ++ [{"User-Agent", Pleroma.Application.user_agent()}]
+      else
+        header_list
+      end
+
     Map.put_new(request, :headers, header_list)
   end