Created
February 7, 2012 22:30
-
-
Save anonymous/1762587 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
header_str = %{OK | |
Date: Tue, 07 Feb 2012 22:22:07 GMT | |
Expires: -1 | |
Cache-Control: private, max-age=0 | |
Content-Type: text/html; charset=ISO-8859-1 | |
Set-Cookie: PREF=ID=bab1543250b91b27:FF=0:TM=1328653327:LM=1328653327:S=K3aQc6lscb42U2hG; expires=Thu, 06-Feb-2014 22:22:07 GMT; path=/; domain=.google.com | |
Set-Cookie: NID=56=chSUHRqwS4ZVjTWYsUitM7la_WatmdW7Oke3DNqIWJE1s8AMl4QxEr2MSnklJPuRdPM6yrmTm7m-MB5cgEZn0yU1ntDSgWn2VMksu4iK3AvMpkqwMu9vOGXCiuawyTDr; expires=Wed, 08-Aug-2 | |
012 22:22:07 GMT; path=/; domain=.google.com; HttpOnly P3P: CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 for more info." | |
Server: gws | |
X-XSS-Protection: 1; mode=block | |
X-Frame-Options: SAMEORIGIN | |
Transfer-Encoding: chunked} | |
headers = {} | |
header_str.split("\n").each do |h| | |
k, v = h.split(': ') | |
headers[k] << v rescue headers[k] = [v] if v | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment