gulp-remote-src
Advanced tools
Comparing version 0.2.1 to 0.3.0
@@ -78,5 +78,14 @@ var remoteSrc = require('./'); | ||
}) | ||
.pipe(gulp.dest('dist/stream')); | ||
.pipe(gulp.dest('dist/strictSSL')); | ||
}); | ||
// run this task alone to test timeout | ||
gulp.task('timeout', ['clean'], function() { | ||
return remoteSrc(FILES, { | ||
base: URL, | ||
timeout: 1 | ||
}) | ||
.pipe(gulp.dest('dist/timeout')); | ||
}); | ||
gulp.task('test', ['stream', 'nostream', 'self-signed-ssl']); |
17
index.js
@@ -6,2 +6,3 @@ var util = require('util'); | ||
var through2 = require('through2'); | ||
var extend = require('node.extend'); | ||
@@ -25,9 +26,16 @@ module.exports = function(urls, options) { | ||
return es.readArray(urls).pipe(es.map(function(data, cb) { | ||
var url = options.base + data, requestOptions = {url: url}; | ||
var allowedRequestOptions = ['qs', 'headers', 'auth', 'followRedirect', 'followAllRedirects', 'maxRedirects', 'timeout', 'proxy', | ||
'strictSSL', 'aws', 'gzip'] | ||
if (options.strictSSL !== null) { | ||
requestOptions.strictSSL = options.strictSSL; | ||
var requestBaseOptions = {}; | ||
for (var i = allowedRequestOptions.length - 1; i >= 0; i--) { | ||
var k = allowedRequestOptions[i]; | ||
if (k in options) { | ||
requestBaseOptions[k] = options[k]; | ||
} | ||
} | ||
return es.readArray(urls).pipe(es.map(function(data, cb) { | ||
var url = options.base + data, requestOptions = extend({url: url}, requestBaseOptions); | ||
if (!options.buffer) { | ||
@@ -44,2 +52,3 @@ var file = new File({ | ||
} else { | ||
// set encoding to `null` to return the body as buffer | ||
requestOptions.encoding = null; | ||
@@ -46,0 +55,0 @@ |
{ | ||
"name": "gulp-remote-src", | ||
"description": "Remote gulp.src", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"main": "index.js", | ||
@@ -34,3 +34,4 @@ "scripts": { | ||
"request": "~2.36.0", | ||
"through2": "~0.5.1" | ||
"through2": "~0.5.1", | ||
"node.extend": "~1.1.2" | ||
}, | ||
@@ -37,0 +38,0 @@ "keywords": [ |
@@ -40,6 +40,19 @@ # gulp-remote-src | ||
- `strictSSL` (optional) | ||
## Request Options | ||
passed to `request` to allow self signed SSL certificates | ||
`gulp-remote-src` uses [request](https://github.com/mikeal/request) to make HTTP request, you can specify below | ||
options to customize your request: | ||
* `qs` - object containing querystring values to be appended to the `uri` | ||
* `headers` - http headers (default: `{}`) | ||
* `auth` - A hash containing values `user` || `username`, `pass` || `password`, and `sendImmediately` (optional). See documentation above. | ||
* `followRedirect` - follow HTTP 3xx responses as redirects (default: `true`). This property can also be implemented as function which gets `response` object as a single argument and should return `true` if redirects should continue or `false` otherwise. | ||
* `followAllRedirects` - follow non-GET HTTP 3xx responses as redirects (default: `false`) | ||
* `maxRedirects` - the maximum number of redirects to follow (default: `10`) | ||
* `timeout` - Integer containing the number of milliseconds to wait for a request to respond before aborting the request | ||
* `proxy` - An HTTP proxy to be used. Supports proxy Auth with Basic Auth, identical to support for the `url` parameter (by embedding the auth info in the `uri`) | ||
* `strictSSL` - If `true`, requires SSL certificates be valid. **Note:** to use your own certificate authority, you need to specify an agent that was created with that CA as an option. | ||
* `aws` - `object` containing AWS signing information. Should have the properties `key`, `secret`. Also requires the property `bucket`, unless you’re specifying your `bucket` as part of the path, or the request doesn’t use a bucket (i.e. GET Services) | ||
* `gzip` - If `true`, add an `Accept-Encoding` header to request compressed content encodings from the server (if not already present) and decode supported content encodings in the response. | ||
## Changelog | ||
@@ -59,2 +72,6 @@ | ||
Add option `strictSSL` (thank you [@Magomogo](https://github.com/Magomogo)) | ||
Add option `strictSSL` (thank you [@Magomogo](https://github.com/Magomogo)) | ||
### v0.3.0 (2014-09-02) | ||
Pass through [request](https://github.com/mikeal/request) options to make it flexible. |
9339
141
75
5
+ Addednode.extend@~1.1.2
+ Addedhas@1.0.4(transitive)
+ Addedis@3.3.0(transitive)
+ Addednode.extend@1.1.8(transitive)