Przeglądaj źródła

Flush body when POST requests (#5128)

master
abcang 6 lat temu
committed by Eugen Rochko
rodzic
commit
3d9b8847d2
5 zmienionych plików z 5 dodań i 5 usunięć
  1. +1
    -1
      app/services/send_interaction_service.rb
  2. +1
    -1
      app/services/subscribe_service.rb
  3. +1
    -1
      app/services/unsubscribe_service.rb
  4. +1
    -1
      app/workers/activitypub/delivery_worker.rb
  5. +1
    -1
      app/workers/pubsubhubbub/delivery_worker.rb

+ 1
- 1
app/services/send_interaction_service.rb Wyświetl plik

@@ -12,7 +12,7 @@ class SendInteractionService < BaseService


return if !target_account.ostatus? || block_notification? return if !target_account.ostatus? || block_notification?


delivery = build_request.perform
delivery = build_request.perform.flush


raise Mastodon::UnexpectedResponseError, delivery unless delivery.code > 199 && delivery.code < 300 raise Mastodon::UnexpectedResponseError, delivery unless delivery.code > 199 && delivery.code < 300
end end


+ 1
- 1
app/services/subscribe_service.rb Wyświetl plik

@@ -6,7 +6,7 @@ class SubscribeService < BaseService


@account = account @account = account
@account.secret = SecureRandom.hex @account.secret = SecureRandom.hex
@response = build_request.perform
@response = build_request.perform.flush


if response_failed_permanently? if response_failed_permanently?
# We're not allowed to subscribe. Fail and move on. # We're not allowed to subscribe. Fail and move on.


+ 1
- 1
app/services/unsubscribe_service.rb Wyświetl plik

@@ -7,7 +7,7 @@ class UnsubscribeService < BaseService
@account = account @account = account


begin begin
@response = build_request.perform
@response = build_request.perform.flush


Rails.logger.debug "PuSH unsubscribe for #{@account.acct} failed: #{@response.status}" unless @response.status.success? Rails.logger.debug "PuSH unsubscribe for #{@account.acct} failed: #{@response.status}" unless @response.status.success?
rescue HTTP::Error, OpenSSL::SSL::SSLError => e rescue HTTP::Error, OpenSSL::SSL::SSLError => e


+ 1
- 1
app/workers/activitypub/delivery_worker.rb Wyświetl plik

@@ -28,7 +28,7 @@ class ActivityPub::DeliveryWorker
end end


def perform_request def perform_request
@response = build_request.perform
@response = build_request.perform.flush
end end


def response_successful? def response_successful?


+ 1
- 1
app/workers/pubsubhubbub/delivery_worker.rb Wyświetl plik

@@ -37,7 +37,7 @@ class Pubsubhubbub::DeliveryWorker
def callback_post_payload def callback_post_payload
request = Request.new(:post, subscription.callback_url, body: payload) request = Request.new(:post, subscription.callback_url, body: payload)
request.add_headers(headers) request.add_headers(headers)
request.perform
request.perform.flush
end end


def blocked_domain? def blocked_domain?


Ładowanie…
Anuluj
Zapisz