7
與開放:URI,我可以做到以下幾點:使用Open :: URI顯示HTTP標頭?
require 'open-uri'
#check status
open('http://google.com').status
#get entire html
open('http://google.com').read
是否有可能得到一個請求的HTTP頭這樣的事情可以調試,像捲髮curl -I http://google.com
?
$ curl -I google.com
HTTP/1.1 301 Moved Permanently
Location: http://www.google.com/
Content-Type: text/html; charset=UTF-8
Date: Mon, 17 Dec 2012 14:28:17 GMT
Expires: Wed, 16 Jan 2013 14:28:17 GMT
Cache-Control: public, max-age=2592000
Server: gws
Content-Length: 219
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
這可能嗎?