Allow fetching over IPv6
Mint/Finch disable IPv6 by default preventing us from fetching anything from IPv6-only hosts without this.
This commit is contained in:
parent
889b57df82
commit
fc95519dbf
3 changed files with 28 additions and 5 deletions
|
@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
|
|||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
|
||||
## Unreleased
|
||||
|
||||
## Added
|
||||
|
||||
## Changed
|
||||
|
||||
## Fixed
|
||||
- Issue preventing fetching anything from IPv6-only instances
|
||||
|
||||
## 2024.02
|
||||
|
||||
## Added
|
||||
|
|
|
@ -288,6 +288,7 @@ defmodule Pleroma.Application do
|
|||
|> Config.get([])
|
||||
|> Pleroma.HTTP.AdapterHelper.add_pool_size(pool_size)
|
||||
|> Pleroma.HTTP.AdapterHelper.maybe_add_proxy_pool(proxy)
|
||||
|> Pleroma.HTTP.AdapterHelper.ensure_ipv6()
|
||||
|> Keyword.put(:name, MyFinch)
|
||||
|
||||
[{Finch, config}]
|
||||
|
|
|
@ -65,6 +65,15 @@ defmodule Pleroma.HTTP.AdapterHelper do
|
|||
|> put_in([:pools, :default, :size], pool_size)
|
||||
end
|
||||
|
||||
def ensure_ipv6(opts) do
|
||||
# Default transport opts already enable IPv6, so just ensure they're loaded
|
||||
opts
|
||||
|> maybe_add_pools()
|
||||
|> maybe_add_default_pool()
|
||||
|> maybe_add_conn_opts()
|
||||
|> maybe_add_transport_opts()
|
||||
end
|
||||
|
||||
defp maybe_add_pools(opts) do
|
||||
if Keyword.has_key?(opts, :pools) do
|
||||
opts
|
||||
|
@ -96,11 +105,15 @@ defmodule Pleroma.HTTP.AdapterHelper do
|
|||
defp maybe_add_transport_opts(opts) do
|
||||
transport_opts = get_in(opts, [:pools, :default, :conn_opts, :transport_opts])
|
||||
|
||||
unless is_nil(transport_opts) do
|
||||
opts
|
||||
else
|
||||
put_in(opts, [:pools, :default, :conn_opts, :transport_opts], [])
|
||||
end
|
||||
opts =
|
||||
unless is_nil(transport_opts) do
|
||||
opts
|
||||
else
|
||||
put_in(opts, [:pools, :default, :conn_opts, :transport_opts], [])
|
||||
end
|
||||
|
||||
# IPv6 is disabled and IPv4 enabled by default; ensure we can use both
|
||||
put_in(opts, [:pools, :default, :conn_opts, :transport_opts, :inet6], true)
|
||||
end
|
||||
|
||||
@doc """
|
||||
|
|
Loading…
Reference in a new issue