New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

socks5-https-client

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

socks5-https-client - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

.travis.yml

1

index.js

@@ -6,3 +6,2 @@ /**

* @copyright Copyright (c) 2013, Matthew Caruana Galizia
* @preserve
*/

@@ -9,0 +8,0 @@

@@ -6,4 +6,2 @@ /**

* @copyright Copyright (c) 2013, Matthew Caruana Galizia
* @version 0.1.2
* @preserve
*/

@@ -34,2 +32,7 @@

// Add authorization properties to the client object as libraries like 'request' expect them there.
clearText = this.cleartext;
socksSocket.authorized = clearText.authorized;
socksSocket.authorizationError = clearText.authorizationError;
if (err) {

@@ -39,3 +42,2 @@ return socksSocket.emit('error', err);

clearText = this.cleartext;
socksSocket.socket = clearText;

@@ -42,0 +44,0 @@

{
"name": "socks5-https-client",
"description": "SOCKS v5 HTTPS client.",
"version": "0.2.0",
"version": "0.2.1",
"main": "index.js",

@@ -29,3 +29,4 @@ "homepage": "https://github.com/mattcg/socks5-https-client",

"devDependencies": {
"mocha": "1.x"
"mocha": "1.x",
"node-socks": "0.x"
},

@@ -32,0 +33,0 @@ "scripts": {

# SOCKS5 HTTPS Client #
SOCKS v5 HTTPS client implementation in JavaScript for Node.js. See [socks5-http-client](https://github.com/mattcg/socks5-http-client) for a plain HTTP implementation.
[![Build Status](https://travis-ci.org/mattcg/socks5-https-client.png?branch=master)](https://travis-ci.org/mattcg/socks5-https-client)
SOCKS v5 HTTPS client implementation in JavaScript for Node.js.
```js
var shttps = require('socks5-https-client');
shttps.get('https://encrypted.google.com/', function(res) {
res.setEncoding('utf8');
res.on('readable', function() {
console.log(res.read()); // Log response to console.
});
});
```
## Using with Tor ##
Works great for making HTTPS requests through [Tor](https://www.torproject.org/) (see bundled example).
## HTTP ##
This client only provides support for making HTTPS requests. See [socks5-http-client](https://github.com/mattcg/socks5-https-client) for an HTTP implementation.
## License ##
Copyright © 2013 [Matthew Caruana Galizia](http://twitter.com/mcaruanagalizia), licensed under an [MIT license](http://mattcg.mit-license.org/).

@@ -12,27 +12,78 @@ /**

/*jshint node:true*/
/*global test, suite*/
/*global test, suite, setup*/
var assert = require('assert');
var net = require('net');
var socks = require('node-socks/socks.js');
var https = require('../');
var version = process.version.substr(1).split('.');
var readableStreams = version[0] > 0 || version[1] > 8;
suite('socks5-https-client tests', function() {
var server;
this.timeout(5000);
setup(function(done) {
server = socks.createServer(function(socket, port, address, proxyReady) {
var proxy;
proxy = net.createConnection(port, address, proxyReady);
proxy.on('data', function(data) {
socket.write(data);
});
socket.on('data', function(data) {
proxy.write(data);
});
proxy.on('close', function() {
socket.end();
});
socket.on('close', function() {
proxy.removeAllListeners('data');
proxy.end();
});
});
server.listen(1080, 'localhost', 511, function() {
done();
});
server.on('error', function(err) {
throw err;
});
});
test('simple request', function(done) {
https.request({
socksPort: 9050, // Tor
port: 443,
hostname: 'en.wikipedia.org',
protocol: 'https:',
path: '/wiki/SOCKS'
}, function(res) {
var req;
req = https.request({
hostname: 'encrypted.google.com',
path: '/'
}, function(res, err) {
var data = '';
assert.ifError(err);
assert.equal(res.statusCode, 200);
res.setEncoding('utf8');
res.on('readable', function() {
data += res.read();
});
if (readableStreams) {
// The new way, using the readable stream interface (Node >= 0.10.0):
res.on('readable', function() {
data += res.read();
});
} else {
// The old way, using 'data' listeners (Node <= 0.8.22):
res.on('data', function(chunk) {
data += chunk;
});
}
res.on('end', function() {

@@ -44,6 +95,11 @@ assert(-1 !== data.indexOf('<html'));

});
}).on('error', function(err) {
assert.ifError(err);
}).end();
});
req.on('error', function(err) {
assert.fail(err);
});
// GET request, so end without sending any data.
req.end();
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc