2013-08-29 53 views
0

我希望能夠從https:http://www.ruby.net/ HTTP獲得完整的HTTP跟蹤。目前我在調試器檢查的東西,像這樣:獲取從紅寶石網:: HTTP的跟蹤與https

(rdb:1) response 
#<Net::HTTPFound 302 FOUND readbody=true> 
(rdb:1) response.each_header {|x| puts x} 
content-type 
date 
location 
server 
vary 
content-length 
connection 
{"content-type"=>["text/html; charset=utf-8"], "date"=>["Wed, 28 Aug 2013 16:13:44 GMT"], "location"=>["https://example.com/login?next=/stuff"], "server"=>["nginx/1.1.19"], "vary"=>["Cookie"], "content-length"=>["0"], "connection"=>["keep-alive"]} 

這是真正有用的,但我就是喜歡看到原始的HTTP,例如

HTTP/1.1 200 OK 
Content-Type: text/xml; charset=utf-8 
Content-Length: length 

有什麼辦法,只是轉儲HTTP請求和響應的副本,不用經過中間處理重建呢?

提前

回答

1

非常感謝,我認爲這是不可能得到的Net ::類HTTPResponse的原始HTTP標頭,因爲它解析頭是接收數據的同時。見HTTPResponse#read_new