Add support for ports other than 80 so it can work with things like servedir, for instance :)

This commit is contained in:
Chris Jaure 2011-05-14 17:45:05 -07:00
parent 245541fd01
commit e8dda224a2

View File

@ -7,7 +7,7 @@ var URL = require('url'),
function get(url, callback) {
var oURL = URL.parse(url),
http = require('http'),
client = http.createClient(80, oURL.hostname),
client = http.createClient(oURL.port || 80, oURL.hostname),
request = client.request('GET', oURL.pathname, {'host': oURL.hostname});
request.end();
@ -27,7 +27,7 @@ function get(url, callback) {
function img2base64(url, callback) {
var oURL = URL.parse(url),
http = require('http'),
client = http.createClient(80, oURL.hostname),
client = http.createClient(oURL.port || 80, oURL.hostname),
request = client.request('GET', oURL.pathname, {'host': oURL.hostname});
request.end();