From 747ac9029490a1cadbb7abc4f0b6556556764a84 Mon Sep 17 00:00:00 2001 From: Z Date: Fri, 10 Jul 2020 14:46:39 +0800 Subject: [PATCH] =?UTF-8?q?fix=20bug=20&&=20=E5=8F=96=E6=B6=88=E4=B8=8D?= =?UTF-8?q?=E5=BF=85=E8=A6=81=E7=9A=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/v1/timelines/tag_controller.rb | 1 - app/lib/request.rb | 12 +++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/app/controllers/api/v1/timelines/tag_controller.rb b/app/controllers/api/v1/timelines/tag_controller.rb index db551b2f82..2d6ad5a80c 100644 --- a/app/controllers/api/v1/timelines/tag_controller.rb +++ b/app/controllers/api/v1/timelines/tag_controller.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true class Api::V1::Timelines::TagController < Api::BaseController - before_action :require_user! before_action :load_tag after_action :insert_pagination_headers, unless: -> { @statuses.empty? } diff --git a/app/lib/request.rb b/app/lib/request.rb index 2693dd734e..247c32958a 100644 --- a/app/lib/request.rb +++ b/app/lib/request.rb @@ -17,10 +17,10 @@ end class Request REQUEST_TARGET = '(request-target)' - # We enforce a 15s timeout on DNS resolving, 15s timeout on socket opening - # and 15s timeout on the TLS handshake, meaning the worst case should take - # about 45s in total - TIMEOUT = { connect: 15, read: 30, write: 30 }.freeze + # We enforce a 5s timeout on DNS resolving, 5s timeout on socket opening + # and 5s timeout on the TLS handshake, meaning the worst case should take + # about 15s in total + TIMEOUT = { connect: 5, read: 10, write: 10 }.freeze include RoutingHelper @@ -32,9 +32,7 @@ class Request @http_client = options.delete(:http_client) @options = options.merge(socket_class: use_proxy? ? ProxySocket : Socket) @options = @options.merge(Rails.configuration.x.http_client_proxy) if use_proxy? - @headers = { - 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36', - } + @headers = {} raise Mastodon::HostValidationError, 'Instance does not support hidden service connections' if block_hidden_service?