[#534] Federation publish requests status control (enforced 2xx response code check).
authorIvan Tashkinov <ivantashkinov@gmail.com>
Thu, 24 Jan 2019 08:54:52 +0000 (11:54 +0300)
committerIvan Tashkinov <ivantashkinov@gmail.com>
Thu, 24 Jan 2019 08:54:52 +0000 (11:54 +0300)
lib/pleroma/web/activity_pub/activity_pub.ex
lib/pleroma/web/salmon/salmon.ex
lib/pleroma/web/websub/websub.ex

index b14c91c1848bdb9fdb1e9ed38d181dfd7d0bff48..10155ff5a3c2cc72a527bd2fa3fedbd7afd1c174 100644 (file)
@@ -742,7 +742,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
         digest: digest
       })
 
-    with {:ok, _} <-
+    with {:ok, %{status: code}} when code in 200..299 <-
            result =
              @httpoison.post(
                inbox,
index 0a0b9143386febaf1d5ec02e111e0e4563332816..0423ccee07314edf2c5552aed6d55bdaeecc26a5 100644 (file)
@@ -169,7 +169,7 @@ defmodule Pleroma.Web.Salmon do
 
   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,
index a6bbaef37f690a3c0dbd97d7a8d73e77261ab395..9ceb5fbf7dcf431f6063530e8b2d986661c3e310 100644 (file)
@@ -269,7 +269,7 @@ defmodule Pleroma.Web.Websub do
     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,