Код ответа Typhoeus 200, но тело ответа пустое - PullRequest
0 голосов
/ 16 апреля 2020

Я пытаюсь получить вызов, я получаю код ответа 200, но тело ответа пусто

Параметры вызова:

{:accept_encoding=>"gzip", :connecttimeout=>2, :headers=>{"Accept"=>"application/json", 
"Connection"=>"keep-alive", "User-Agent"=>"Harmony Web Frontend v1"}, :ssl_verifypeer=>false, 
:timeout=>30, :params=>{"RESOURCE"=>"/api"}, :ssl_verifyhost=>0, :sslcert=>"cert.pem", 
:method=>:get}

Ответ Typhoeus:

#<Typhoeus::Response:0x00007fd11a5b8720 @options={:httpauth_avail=>0, 
:total_time=>2.2689120000000003, :starttransfer_time=>2.268542, :appconnect_time=>1.122503, 
:pretransfer_time=>1.122671, :connect_time=>0.31255200000000005, :namelookup_time=>0.005072, 
:redirect_time=>0.0, :effective_url=>"<URL>", :primary_ip=>"168.183.37.253", 
:response_code=>200, :request_size=>257, :redirect_count=>0, :return_code=>:ok, 
:response_headers=>"HTTP/1.1 200 OK\r\nDate: Thu, 16 Apr 2020 08:13:56 GMT\r\nServer: 
nginx\r\nX-Frame-Options: SAMEORIGIN, DENY\r\nStrict-Transport-Security: max-age=31536000\r\nX-
XSS-Protection: 1; mode=block\r\nX-Content-Type-Options: nosniff\r\nContent-Type: text/css; 
charset=utf-8\r\nVary: Accept-Encoding\r\nX-Backside-Transport: OK OK,OK OK,OK OK,OK 
OK\r\nCache-Control: private\r\nX-AspNet-Version: 4.0.30319\r\nX-Powered-By: ASP.NET\r\nX-
Global-Transaction-ID: b8911c085e9813c42609bbed\r\nX-Frame-Options: SAMEORIGIN\r\nX-Content-
Type-Options: nosniff\r\nX-XSS-Protection: 1; mode=block\r\nX-UA-Compatible: IE=Edge\r\nStrict-
Transport-Security: max-age=31536000\r\nContent-Security-Policy: default-src 'self' https:; 
font-src https: data:; img-src blob: https: data:; style-src 'self' https: 'unsafe-inline'; 
script-src 'self' https: 'unsafe-inline' 'unsafe-eval'; upgrade-insecure-requests; block-all-
mixed-content; reflected-xss block; referrer no-referrer-when-downgrade\r\nCache-Control: no-
cache, no-store, must-revalidate, private\r\nPragma: no-cache\r\nContent-Encoding: gzip\r\nSet-
Cookie: 65c458abbf792db5ef95b178e80e2a69=d84b667652dc97f51f72a8bc512361b8; path=/; 
HttpOnly\r\nKeep-Alive: timeout=30, max=8000\r\nConnection: Keep-Alive\r\nTransfer-Encoding: 
chunked\r\n\r\n", :response_body=>"", :debug_info=>#<Ethon::Easy::DebugInfo:0x00007fd11a089e20 
@messages=[]>}, @headers={"Date"=>"Thu, 16 Apr 2020 08:13:56 GMT", "Server"=>"nginx", "X-Frame-
Options"=>["SAMEORIGIN, DENY", "SAMEORIGIN"], "Strict-Transport-Security"=>["max-age=31536000", 
"max-age=31536000"], "X-XSS-Protection"=>["1; mode=block", "1; mode=block"], "X-Content-Type-
Options"=>["nosniff", "nosniff"], "Content-Type"=>"text/css; charset=utf-8", "Vary"=>"Accept-
Encoding", "X-Backside-Transport"=>"OK OK,OK OK,OK OK,OK OK", "Cache-Control"=>["private", "no-
cache, no-store, must-revalidate, private"], "X-AspNet-Version"=>"4.0.30319", "X-Powered-
By"=>"ASP.NET", "X-Global-Transaction-ID"=>"b8911c085e9813c42609bbed", "X-UA-
Compatible"=>"IE=Edge", "Content-Security-Policy"=>"default-src 'self' https:; font-src https:
 data:; img-src blob: https: data:; style-src 'self' https: 'unsafe-inline'; script-src 'self' 
https: 'unsafe-inline' 'unsafe-eval'; upgrade-insecure-requests; block-all-mixed-content; 
reflected-xss block; referrer no-referrer-when-downgrade", "Pragma"=>"no-cache", "Content-
Encoding"=>"gzip", "Set-
Cookie"=>"65c458abbf792db5ef95b178e80e2a69=d84b667652dc97f51f72a8bc512361b8; path=/; HttpOnly", 
"Keep-Alive"=>"timeout=30, max=8000", "Connection"=>"Keep-Alive"}, @request=#
<Typhoeus::Request:0x00007fd11a5bb330 @base_url=#<URI::HTTPS URL>, @original_options=
{:accept_encoding=>"gzip", :connecttimeout=>20, :headers=>{"Accept"=>"application/json", 
"Connection"=>"keep-alive", "User-Agent"=>"Harmony Web Frontend v1"}, :ssl_verifypeer=>true,
 :timeout=>30, :params=>{"RESOURCE"=>"API"}, :ssl_verifyhost=>0, :sslcert=>"cert.pem", 
:method=>:get}, @options={:accept_encoding=>"gzip", :connecttimeout=>20, :headers=>{"User-
Agent"=>"Harmony Web Frontend v1", "Accept"=>"application/json", "Connection"=>"keep-alive", 
"Expect"=>""}, :ssl_verifypeer=>true, :timeout=>30, :params=>{"RESOURCE"=>"API"}, 
:ssl_verifyhost=>0, :sslcert=>"cert.pem", :method=>:get, :maxredirs=>50}, @on_body=[#
<Proc:0x00007fd11a5bad40@/test.rb:44>], @on_complete=[#<Proc:0x00007fd11a5bacf0@/test.rb:48>],
 @on_progress=[], @response=#<Typhoeus::Response:0x00007fd11a5b8720 ...>, @on_headers=[], 
@on_success=[]>>

Я получаю ответ, когда не предоставляю параметры, связанные с сертификатом и SSL, и пробую через другой хост

Параметры:

{:accept_encoding=>"gzip", :connecttimeout=>2, :headers=>{"Accept"=>"application/json", 
"Connection"=>"keep-alive", "User-Agent"=>"Harmony Web Frontend v1"}, :ssl_verifypeer=>false, 
:timeout=>20, :params=>{"RESOURCE"=>"API"}, :method=>:get}

Может кто-нибудь помочь с этим?

...