Merge branch 'fix/hackney-global-options' into 'develop'

Merge the default options with custom ones in ReverseProxy and Pleroma.HTTP and workaround for remote server certificate chain issues

See merge request pleroma/pleroma!1409
This commit is contained in:
Haelwenn 2019-07-13 11:55:09 +00:00
commit 9497d14f09
5 changed files with 8 additions and 7 deletions

View File

@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Fixed ### Fixed
- Not being able to pin unlisted posts - Not being able to pin unlisted posts
- Metadata rendering errors resulting in the entire page being inaccessible - Metadata rendering errors resulting in the entire page being inaccessible
- Federation/MediaProxy not working with instances that have wrong certificate order
- Mastodon API: Handling of search timeouts (`/api/v1/search` and `/api/v2/search`) - Mastodon API: Handling of search timeouts (`/api/v1/search` and `/api/v2/search`)
- Mastodon API: Embedded relationships not being properly rendered in the Account entity of Status entity - Mastodon API: Embedded relationships not being properly rendered in the Account entity of Status entity
- Mastodon API: Add `account_id`, `type`, `offset`, and `limit` to search API (`/api/v1/search` and `/api/v2/search`) - Mastodon API: Add `account_id`, `type`, `offset`, and `limit` to search API (`/api/v1/search` and `/api/v2/search`)

View File

@ -194,6 +194,8 @@
send_user_agent: true, send_user_agent: true,
adapter: [ adapter: [
ssl_options: [ ssl_options: [
# Workaround for remote server certificate chain issues
partial_chain: &:hackney_connect.partial_chain/1,
# We don't support TLS v1.3 yet # We don't support TLS v1.3 yet
versions: [:tlsv1, :"tlsv1.1", :"tlsv1.2"] versions: [:tlsv1, :"tlsv1.1", :"tlsv1.2"]
] ]

View File

@ -29,7 +29,7 @@ def new(opts \\ []) do
# fetch Hackney options # fetch Hackney options
# #
defp hackney_options(opts) do def hackney_options(opts) do
options = Keyword.get(opts, :adapter, []) options = Keyword.get(opts, :adapter, [])
adapter_options = Pleroma.Config.get([:http, :adapter], []) adapter_options = Pleroma.Config.get([:http, :adapter], [])
proxy_url = Pleroma.Config.get([:http, :proxy_url], nil) proxy_url = Pleroma.Config.get([:http, :proxy_url], nil)

View File

@ -65,10 +65,7 @@ defp process_sni_options(options, url) do
end end
def process_request_options(options) do def process_request_options(options) do
case Pleroma.Config.get([:http, :proxy_url]) do Keyword.merge(Pleroma.HTTP.Connection.hackney_options([]), options)
nil -> options
proxy -> options ++ [proxy: proxy]
end
end end
@doc """ @doc """

View File

@ -61,7 +61,7 @@ defmodule Pleroma.ReverseProxy do
* `http`: options for [hackney](https://github.com/benoitc/hackney). * `http`: options for [hackney](https://github.com/benoitc/hackney).
""" """
@default_hackney_options [] @default_hackney_options [pool: :media]
@inline_content_types [ @inline_content_types [
"image/gif", "image/gif",
@ -94,7 +94,8 @@ def call(_conn, _url, _opts \\ [])
def call(conn = %{method: method}, url, opts) when method in @methods do def call(conn = %{method: method}, url, opts) when method in @methods do
hackney_opts = hackney_opts =
@default_hackney_options Pleroma.HTTP.Connection.hackney_options([])
|> Keyword.merge(@default_hackney_options)
|> Keyword.merge(Keyword.get(opts, :http, [])) |> Keyword.merge(Keyword.get(opts, :http, []))
|> HTTP.process_request_options() |> HTTP.process_request_options()