From 0dbbca12c099f92981e84418a47aa5887e739d4c Mon Sep 17 00:00:00 2001 From: Z Date: Mon, 25 Nov 2019 22:56:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E5=AD=97=EF=BC=8C?= =?UTF-8?q?=E8=A7=A3=E5=86=B3previewcard=E8=A2=AB=E5=8F=8D=E7=88=AC?= =?UTF-8?q?=E8=99=AB=E7=9A=84=E9=97=AE=E9=A2=98,=E5=A2=9E=E9=95=BFTimeout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/lib/request.rb | 12 +++++++----- config/locales/zh-CN.yml | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/lib/request.rb b/app/lib/request.rb index 42ccc6513..77fc21418 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 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 + # 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 include RoutingHelper @@ -32,7 +32,9 @@ 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 = {} + @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', + } raise Mastodon::HostValidationError, 'Instance does not support hidden service connections' if block_hidden_service? diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml index b1bae25ba..8da3b9550 100644 --- a/config/locales/zh-CN.yml +++ b/config/locales/zh-CN.yml @@ -16,7 +16,7 @@ zh-CN: contact_missing: 未设定 contact_unavailable: 未公开 discover_users: 发现用户 - documentation: 指南 + documentation: 文档 federation_hint_html: 在%{instance} 上拥有账户后,你可以关注其他闭社站点的人。 get_apps: 尝试移动应用 hosted_on: 一个在 %{domain} 上运行的闭社实例