[#534] Federation publish requests status control (enforced 2xx response code check).

This commit is contained in:
Ivan Tashkinov 2019-01-24 11:54:52 +03:00
parent f161a92cb1
commit 20b54366ee
3 changed files with 3 additions and 3 deletions

View File

@ -742,7 +742,7 @@ defp do_publish_one(%{inbox: inbox, json: json, actor: actor, id: id}) do
digest: digest
})
with {:ok, _} <-
with {:ok, %{status: code}} when code in 200..299 <-
result =
@httpoison.post(
inbox,

View File

@ -169,7 +169,7 @@ defp send_to_user(%{info: %{salmon: salmon}}, feed, poster),
defp send_to_user(url, feed, poster) when is_binary(url) do
with {:reachable, true} <- {:reachable, Instances.reachable?(url)},
{:ok, %{status: code}} <-
{:ok, %{status: code}} when code in 200..299 <-
poster.(
url,
feed,

View File

@ -269,7 +269,7 @@ def publish_one(%{xml: xml, topic: topic, callback: callback, secret: secret}) d
Logger.info(fn -> "Pushing #{topic} to #{callback}" end)
with {:reachable, true} <- {:reachable, Instances.reachable?(callback)},
{:ok, %{status: code}} <-
{:ok, %{status: code}} when code in 200..299 <-
@httpoison.post(
callback,
xml,