request-libcurl
Advanced tools
Comparing version 2.0.4 to 2.0.5
60
index.js
@@ -88,17 +88,39 @@ 'use strict'; | ||
curl.setOpt(Curl.option.NOPROGRESS, true); | ||
curl.setOpt(Curl.option.TIMEOUT_MS, opts.timeout); | ||
curl.setOpt(Curl.option.MAXREDIRS, opts.maxRedirects); | ||
curl.setOpt(Curl.option.CUSTOMREQUEST, opts.method); | ||
curl.setOpt(Curl.option.FOLLOWLOCATION, opts.followRedirect); | ||
curl.setOpt(Curl.option.SSL_VERIFYPEER, opts.rejectUnauthorized ? 1 : 0); | ||
curl.setOpt(Curl.option.PROXY_SSL_VERIFYPEER, opts.rejectUnauthorizedProxy ? 1 : 0); | ||
curl.setOpt(Curl.option.SSL_VERIFYHOST, opts.rejectUnauthorized ? 2 : 0); | ||
curl.setOpt(Curl.option.PROXY_SSL_VERIFYHOST, opts.rejectUnauthorizedProxy ? 2 : 0); | ||
curl.setOpt(Curl.option.CONNECTTIMEOUT_MS, opts.timeout); | ||
if (Curl.option.NOPROGRESS !== undefined) { | ||
curl.setOpt(Curl.option.NOPROGRESS, true); | ||
} | ||
if (Curl.option.TIMEOUT_MS !== undefined) { | ||
curl.setOpt(Curl.option.TIMEOUT_MS, opts.timeout); | ||
} | ||
if (Curl.option.MAXREDIRS !== undefined) { | ||
curl.setOpt(Curl.option.MAXREDIRS, opts.maxRedirects); | ||
} | ||
if (Curl.option.CUSTOMREQUEST !== undefined) { | ||
curl.setOpt(Curl.option.CUSTOMREQUEST, opts.method); | ||
} | ||
if (Curl.option.FOLLOWLOCATION !== undefined) { | ||
curl.setOpt(Curl.option.FOLLOWLOCATION, opts.followRedirect); | ||
} | ||
if (Curl.option.SSL_VERIFYPEER !== undefined) { | ||
curl.setOpt(Curl.option.SSL_VERIFYPEER, opts.rejectUnauthorized ? 1 : 0); | ||
} | ||
if (Curl.option.PROXY_SSL_VERIFYPEER !== undefined) { | ||
curl.setOpt(Curl.option.PROXY_SSL_VERIFYPEER, opts.rejectUnauthorizedProxy ? 1 : 0); | ||
} | ||
if (Curl.option.SSL_VERIFYHOST !== undefined) { | ||
curl.setOpt(Curl.option.SSL_VERIFYHOST, opts.rejectUnauthorized ? 2 : 0); | ||
} | ||
if (Curl.option.PROXY_SSL_VERIFYHOST !== undefined) { | ||
curl.setOpt(Curl.option.PROXY_SSL_VERIFYHOST, opts.rejectUnauthorizedProxy ? 2 : 0); | ||
} | ||
if (Curl.option.CONNECTTIMEOUT_MS !== undefined) { | ||
curl.setOpt(Curl.option.CONNECTTIMEOUT_MS, opts.timeout); | ||
} | ||
if (opts.keepAlive === true) { | ||
curl.setOpt(Curl.option.TCP_KEEPALIVE, 1); | ||
} else { | ||
curl.setOpt(Curl.option.TCP_KEEPALIVE, 0); | ||
if (Curl.option.TCP_KEEPALIVE !== undefined) { | ||
if (opts.keepAlive === true) { | ||
curl.setOpt(Curl.option.TCP_KEEPALIVE, 1); | ||
} else { | ||
curl.setOpt(Curl.option.TCP_KEEPALIVE, 0); | ||
} | ||
} | ||
@@ -126,6 +148,8 @@ | ||
if (!hasAcceptEncoding) { | ||
curl.setOpt(Curl.option.ACCEPT_ENCODING, ''); | ||
} else { | ||
curl.setOpt(Curl.option.ACCEPT_ENCODING, hasAcceptEncoding); | ||
if (Curl.option.ACCEPT_ENCODING !== undefined) { | ||
if (!hasAcceptEncoding) { | ||
curl.setOpt(Curl.option.ACCEPT_ENCODING, ''); | ||
} else { | ||
curl.setOpt(Curl.option.ACCEPT_ENCODING, hasAcceptEncoding); | ||
} | ||
} | ||
@@ -132,0 +156,0 @@ |
{ | ||
"name": "request-libcurl", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"description": "Extremely stable HTTP request module built on top of libcurl", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -42,2 +42,3 @@ # Request-libcurl | ||
- [File upload (*multipart*)](https://github.com/VeliovGroup/request-extra#file-upload-multipartform-data) | ||
- [Known Issues](https://github.com/VeliovGroup/request-extra#known-issues) | ||
- [Running tests](https://github.com/VeliovGroup/request-extra#running-tests) | ||
@@ -393,2 +394,20 @@ - [Tests](https://github.com/VeliovGroup/request-extra/blob/master/test/npm.js) | ||
## Known Issues | ||
Due to single dependency on `node-libcurl` which shipped with statically built binaries, you may encounter `This module was compiled against a different Node.js version using NODE_MODULE_VERSION` error. This may happen on edge cases, like running the very latest release of node.js (*while bundled builds aren't shipped yet*), then you may want to build this package locally, use one of next commands: | ||
```shell | ||
# Build library | ||
npm install --save request-libcurl --build-from-source | ||
# Build library and curl executables: | ||
npm install --save request-libcurl --build-from-source --curl_static_build=true | ||
# In case if you encounter errors during building package locally: | ||
# 1. Execute same command as "sudo" (e.g. administrator), and try again | ||
# 2. Install globally node-gyp and node-pre-gyp NPM packages, and try again | ||
``` | ||
For more details and instructions for different platforms read `node-libcurl` [official docs](https://github.com/JCMais/node-libcurl#important-notes-on-prebuilt-binaries--direct-installation). __Note__: It's highly recommended to [run tests](https://github.com/VeliovGroup/request-extra#running-tests) after building package locally. | ||
## Running Tests | ||
@@ -395,0 +414,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33348
380
436