Created
July 30, 2010 20:51
-
-
Save sotonin/501297 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
require('utils'); | |
http = require('http'); | |
var http, connection, request; | |
connection = http.createClient(80, "blog.rubynginx.com"); | |
request = connection.request('GET', "/", { | |
'Host': 'blog.rubynginx.com', | |
'User-Agent': 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3', | |
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', | |
'Transfer-Encoding': 'chunked', | |
'Keep-Alive': '100', | |
'Connection': 'keep-alive', | |
'Accept-Language': 'en-us,en;q=0.5', | |
'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', | |
}); | |
request.on('response', function (response) { | |
var output = ''; | |
response.setBodyEncoding("utf8"); | |
response.on("data", function (chunk) { | |
output += chunk; | |
}); | |
response.on("complete", function () { | |
puts("Result = " + output); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment