Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

httpntlm

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

httpntlm - npm Package Compare versions

Comparing version 1.4.1 to 1.5.0

47

httpntlm.js

@@ -7,2 +7,3 @@ 'use strict';

var ntlm = require('./ntlm');
var _ = require('underscore');

@@ -13,2 +14,5 @@ exports.method = function(method, options, callback){

// extract non-ntlm-options:
var httpreqOptions = _.omit(options, 'url', 'username', 'password', 'workstation', 'domain');
// is https?

@@ -34,3 +38,4 @@ var isHttps = false;

httpreq.get(options.url, {
// build type1 request:
var type1options = {
headers:{

@@ -42,3 +47,9 @@ 'Connection' : 'keep-alive',

agent: keepaliveAgent
}, $);
};
// add timeout option:
if(httpreqOptions.timeout) type1options.timeout = httpreqOptions.timeout;
// send type1 message to server:
httpreq.get(options.url, type1options, $);
},

@@ -50,18 +61,24 @@

// parse type2 message from server:
var type2msg = ntlm.parseType2Message(res.headers['www-authenticate']);
// create type3 message:
var type3msg = ntlm.createType3Message(type2msg, options);
var headers = options.headers || {};
var body = options.body || '';
headers.Connection = 'Close';
headers.Authorization = type3msg;
// build type3 request:
var type3options = {
headers: {
'Connection': 'Close',
'Authorization': type3msg
},
allowRedirects: false,
agent: keepaliveAgent
};
httpreq[method](options.url, {
headers: headers,
allowRedirects: false,
agent: keepaliveAgent,
body: body,
timeout: options.timeout || 0,
binary: options.binary || false
}, $);
// pass along other options:
type3options.headers = _.extend(type3options.headers, httpreqOptions.headers);
type3options = _.extend(type3options, _.omit(httpreqOptions, 'headers'));
// send type3 message to server:
httpreq[method](options.url, type3options, $);
}

@@ -71,3 +88,3 @@ ], callback);

['get', 'put', 'post', 'delete', 'head'].forEach(function(method){
['get', 'put', 'post', 'delete'].forEach(function(method){
exports[method] = exports.method.bind(exports, method);

@@ -74,0 +91,0 @@ });

{
"name": "httpntlm",
"description": "httpntlm is a Node.js library to do HTTP NTLM authentication",
"version": "1.4.1",
"version": "1.5.0",
"dependencies": {
"agentkeepalive": "~0.1.5",
"async": "~0.2.9",
"httpreq": "~0.4.2",
"async": "~0.2.9",
"agentkeepalive": "~0.1.5"
"underscore": "~1.7.0"
},

@@ -10,0 +11,0 @@ "author": {

@@ -41,7 +41,5 @@ # httpntlm

- `domain:` _{String}_ Name of domain or `''`.
- `body:` _{String}_ Custom body.
- `headers:` _{Object}_ Custom headers.
- `binary:` _{Boolean}_ If `true` returns a Buffer instead of a String (Default: `false`).
- `timeout:` _{Number}_ Connection timeout in milliseconds (Default: `0` == waits till doomsday).
You can also pass along all other options of [httpreq](https://github.com/SamDecrock/node-httpreq), including custom headers, cookies, body data, ... and use POST, PUT or DELETE instead of GET.
## Advanced

@@ -48,0 +46,0 @@

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