Created
October 2, 2014 13:10
-
-
Save progre/854a9f60dd8a40692d8b to your computer and use it in GitHub Desktop.
httpsにhttpproxyでつなぎに行く
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
var https = require('https'); | |
var tunnel = require('tunnel'); | |
var tunnelAg = tunnel.httpsOverHttp({ | |
proxy: { | |
host: 'localhost', | |
port: 8080 | |
} | |
}); | |
var options = { | |
host: 'www.google.co.jp', | |
port: 443, | |
auth: "username:password", | |
path: '/', | |
agent: tunnelAg | |
}; | |
https.get(options, function (res) { | |
res.on('data', function (chunk) { | |
console.log(chunk.toString()); | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment