7
mit Öffnen :: URI kann ich folgendes tun:HTTP-Header mit Open :: URI anzeigen?
require 'open-uri'
#check status
open('http://google.com').status
#get entire html
open('http://google.com').read
Ist es möglich, den HTTP-Header einer Anfrage zu bekommen, damit die Dinge ausgetestet werden können, so etwas wie Curls' 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
Ist das möglich?