gpt4 book ai didi

ruby-on-rails - Rails 服务器错误,在 requests.accepts : "[\"\\xE2\\x80\\x8B/\\xE2\\x80\\x8B\"]" 中有奇怪的符号

转载 作者:行者123 更新时间:2023-12-03 14:04:45 28 4
gpt4 key购买 nike

我经常喜欢清理通过 Airbrake 出现的 500 个错误。我正在生产中运行 Rails 4.2.4 站点,但我发现一个反复出现的错误令人费解。

错误是:

Missing partial shared/_rhs with {:locale=>[:en], :formats=>["\xE2\x80\x8B/\xE2\x80\x8B"], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :haml, :jbuilder]}.

查看 Airbrake 的 env 部分是否有错误,相关部分似乎是:

"action_dispatch.request.accepts": "[\"\\xE2\\x80\\x8B/\\xE2\\x80\\x8B\"]",
"action_dispatch.request.content_type": "",
"action_dispatch.request.flash_hash": "",
"action_dispatch.request.formats": "[\"\\xE2\\x80\\x8B/\\xE2\\x80\\x8B\"]",

看起来浏览器(自我识别为 Chrome)要求使用无法识别的格式,但我不知道为什么会这样做。它似乎也只要求头部。

我可以忽略它,但如果有人对它首先发生的原因有任何想法,我会感兴趣。

完整的 env(删除了标识内容项)是:

{
"DOCUMENT_ROOT": "[******]",
"HTTPS": "on",
"HTTP_ACCEPT": "​/​",
"HTTP_ACCEPT_ENCODING": "gzip,deflate,sdch",
"HTTP_ACCEPT_LANGUAGE": "en-US,en;q=0.8",
"HTTP_CACHE_CONTROL": "no-cache",
"HTTP_CONNECTION": "keep-alive",
"HTTP_HOST": "[******]",
"HTTP_PRAGMA": "no-cache",
"HTTP_USER_AGENT": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.49 Safari/537.36",
"ORIGINAL_FULLPATH": "[******]",
"ORIGINAL_SCRIPT_NAME": "",
"PASSENGER_APP_ENV": "live",
"PASSENGER_APP_TYPE": "rack",
"PASSENGER_SHOW_VERSION_IN_HEADER": "false",
"PATH_INFO": "[******]",
"QUERY_STRING": "",
"REMOTE_ADDR": "[******]",
"REMOTE_PORT": "47888",
"REQUEST_METHOD": "HEAD",
"REQUEST_URI": "[******]",
"ROUTES_40753200_SCRIPT_NAME": "",
"ROUTES_48254480_SCRIPT_NAME": "",
"SCGI": "1",
"SCRIPT_NAME": "",
"SERVER_ADDR": "[******]",
"SERVER_NAME": "[******]",
"SERVER_PORT": "443",
"SERVER_PROTOCOL": "HTTP/1.1",
"SERVER_SOFTWARE": "nginx/1.6.0",
"action_dispatch.cookies_digest": "",
"action_dispatch.cookies_serializer": "",
"action_dispatch.parameter_filter": "[\"password\"]",
"action_dispatch.redirect_filter": "[]",
"action_dispatch.remote_ip": "[******]",
"action_dispatch.request.accepts": "[\"\\xE2\\x80\\x8B/\\xE2\\x80\\x8B\"]",
"action_dispatch.request.content_type": "",
"action_dispatch.request.flash_hash": "",
"action_dispatch.request.formats": "[\"\\xE2\\x80\\x8B/\\xE2\\x80\\x8B\"]",
"action_dispatch.request.parameters": {
"action": "show_by_tag_and_slug",
"controller": "[******]",
"slug": "[******]",
"tag": "[******]"
},
"action_dispatch.request.path_parameters": {
"action": "show_by_tag_and_slug",
"controller": "[******]",
"slug": "[******]",
"tag": "[******]"
},
"action_dispatch.request.query_parameters": "",
"action_dispatch.request.request_parameters": "",
"action_dispatch.request_id": "f120141c-58e6-4429-ad98-1ab352f1c7ce",
"action_dispatch.show_detailed_exceptions": "false",
"action_dispatch.show_exceptions": "true",
"newrelic.transaction_started": "true",
"preview_manager": "#<Preview::Manager:0x007fa334e8eca0>",
"rack.hijack": "#<Proc:0x007fa34ee79020@/home/release/.rvm/gems/ruby-2.2.2/gems/passenger-4.0.53/lib/phusion_passenger/rack/thread_handler_extension.rb:69 (lambda)>",
"rack.hijack?": "true",
"rack.multiprocess": "true",
"rack.multithread": "false",
"rack.request.query_hash": "",
"rack.request.query_string": "",
"rack.run_once": "false",
"rack.url_scheme": "https",
"rack.version": "[\"1\", \"2\"]",
"warden": "Warden::Proxy:70169690063580 @config={:default_scope=>:user, :scope_defaults=>{}, :default_strategies=>{:user=>[:rememberable, :database_authenticatable]}, :intercept_401=>false, :failure_app=>#<Devise::Delegator:0x00000004e859a0>}"
}

最佳答案

人物\xE2\x80\x8B好像是 zero-width space character在 Unicode .这就是为什么,如果您将字符串粘贴到 ruby​​ 控制台,您将获得以下信息:

"\xE2\x80\x8B/\xE2\x80\x8B"
# => "​/​"

IE。似乎只是斜线 /但实际上被两个零宽度空间包围。我不知道为什么浏览器会在 Accepts 中发送这样的字符 header ,它可能是浏览器中的错误,甚至是某种攻击......

关于ruby-on-rails - Rails 服务器错误,在 requests.accepts : "[\"\\xE2\\x80\\x8B/\\xE2\\x80\\x8B\"]" 中有奇怪的符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36744793/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com