Giter VIP home page Giter VIP logo

jcmais / node-libcurl Goto Github PK

View Code? Open in Web Editor NEW
640.0 27.0 110.0 3.5 MB

libcurl bindings for Node.js

Home Page: https://npmjs.org/package/node-libcurl

License: MIT License

Python 1.07% JavaScript 5.37% C++ 20.13% Shell 6.18% TypeScript 66.93% Dockerfile 0.07% PowerShell 0.11% HTML 0.07% C 0.08%
curl libcurl javascript node-module nodejs libcurl-binding node-addon c-plus-plus node-gyp prebuilt-binaries

node-libcurl's Introduction

node-libcurl

Buy Me A Coffee
Patreon Logo
Discord Logo

NPM version license Dependencies

Travis CI Status AppVeyor CI Status Code Quality

The fastest URL transfer library for Node.js.

libcurl bindings for Node.js. libcurl official description:

libcurl is a free and easy-to-use client-side URL transfer library, supporting DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet and TFTP. libcurl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, Kerberos), file transfer resume, http proxy tunneling and more!

Quick Start

Note:

  • This library cannot be used in a browser, it depends on native code.
  • There is no worker threads support at the moment. See #169

Install

npm i node-libcurl --save

or

yarn add node-libcurl

Simple Request - Async / Await using curly

this API is experimental and is subject to changes without a major version bump

const { curly } = require('node-libcurl');

const { statusCode, data, headers } = await curly.get('http://www.google.com')

Any option can be passed using their FULLNAME or a lowerPascalCase format:

const querystring = require('querystring');
const { curly } = require('node-libcurl');

const { statusCode, data, headers } = await curly.post('http://httpbin.com/post', {
  postFields: querystring.stringify({
    field: 'value',
  }),
  // can use `postFields` or `POSTFIELDS`
})

JSON POST example:

const { curly } = require('node-libcurl')
const { data } = await curly.post('http://httpbin.com/post', {
  postFields: JSON.stringify({ field: 'value' }),
  httpHeader: [
    'Content-Type: application/json',
    'Accept: application/json'
  ],
})

console.log(data)

Simple Request - Using Curl class

const { Curl } = require('node-libcurl');

const curl = new Curl();

curl.setOpt('URL', 'www.google.com');
curl.setOpt('FOLLOWLOCATION', true);

curl.on('end', function (statusCode, data, headers) {
  console.info(statusCode);
  console.info('---');
  console.info(data.length);
  console.info('---');
  console.info(this.getInfo( 'TOTAL_TIME'));
  
  this.close();
});

curl.on('error', curl.close.bind(curl));
curl.perform();

Setting HTTP headers

Pass an array of strings specifying headers

curl.setOpt(Curl.option.HTTPHEADER,
  ['Content-Type: application/x-amz-json-1.1'])

Form Submission (Content-Type: application/x-www-form-urlencoded)

const querystring = require('querystring');
const { Curl } = require('node-libcurl');

const curl = new Curl();
const close = curl.close.bind(curl);

curl.setOpt(Curl.option.URL, '127.0.0.1/upload');
curl.setOpt(Curl.option.POST, true)
curl.setOpt(Curl.option.POSTFIELDS, querystring.stringify({
  field: 'value',
}));

curl.on('end', close);
curl.on('error', close);

MultiPart Upload / HttpPost libcurl Option (Content-Type: multipart/form-data)

const { Curl } = require('node-libcurl');

const curl = new Curl();
const close = curl.close.bind(curl);

curl.setOpt(Curl.option.URL, '127.0.0.1/upload.php');
curl.setOpt(Curl.option.HTTPPOST, [
    { name: 'input-name', file: '/file/path', type: 'text/html' },
    { name: 'input-name2', contents: 'field-contents' }
]);

curl.on('end', close);
curl.on('error', close);

Binary Data

When requesting binary data make sure to do one of these:

curl.setOpt('WRITEFUNCTION', (buffer, size, nmemb) => {
  // something
})
  • Enable one of the following flags:
curl.enable(CurlFeature.NoDataParsing)
// or
curl.enable(CurlFeature.Raw)

The reasoning behind this is that by default, the Curl instance will try to decode the received data and headers to utf8 strings, as can be seen here:

For more examples check the examples folder.

API

API documentation for the latest stable version is available at https://node-libcurl-docs.netlify.app/modules/lib_index.html.

Develop branch documentation is available at https://develop--node-libcurl-docs.netlify.app/modules/lib_index.html.

This library provides Typescript type definitions.

Almost all CURL options are supported, if you pass one that is not, an error will be thrown.

For more usage examples check the examples folder.

Special Notes

READFUNCTION option

The buffer passed as first parameter to the callback set with the READFUNCTION option is initialized with the size libcurl is using in their upload buffer (which can be set with UPLOAD_BUFFERSIZE), this is initialized using node::Buffer::Data(buf); which is basically the same than Buffer#allocUnsafe and therefore, it has all the implications as to its correct usage: https://nodejs.org/pt-br/docs/guides/buffer-constructor-deprecation/#regarding-buffer-allocunsafe

So, be careful, make sure to return exactly the amount of data you have written to the buffer on this callback. Only that specific amount is going to be copied and handed over to libcurl.

Common Issues

See COMMON_ISSUES.md

Benchmarks

See ./benchmark

Security

See SECURITY.md

Supported Libcurl Versions

The addon is only tested against libcurl version 7.50.0 and the latest one available.

The code itself is made to compile with any version greater than 7.32.0, any libcurl version lower than that is not supported.

For Enterprise

node-libcurl is available as part of the Tidelift Subscription.

The maintainers of node-libcurl and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.

Detailed Installation

The latest version of this package has prebuilt binaries (thanks to node-pre-gyp) available for:

  • Node.js: Latest two versions on active LTS (see https://github.com/nodejs/Release)
  • Electron: Latest 3 major versions
  • NW.js (node-webkit): Latest 3 major (minor for nw.js case) versions

And on the following platforms:

  • Linux 64 bits
  • macOS Intel & ARM64 (M1+)
  • Windows 32 and 64 bits

Installing with yarn add node-libcurl or npm install node-libcurl should download a prebuilt binary and no compilation will be needed. However if you are trying to install on nw.js or electron additional steps will be required, check their corresponding section below.

The prebuilt binary is statically built with the following library versions, features and protocols (library versions may change between Node.js versions):

Version: libcurl/7.73.0 OpenSSL/1.1.1g zlib/1.2.11 brotli/1.0.7 zstd/1.4.9 c-ares/1.16.1 libidn2/2.1.1 libssh2/1.9.0 nghttp2/1.41.0
Protocols: dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, mqtt, pop3, pop3s, rtsp, scp, sftp, smb, smbs, smtp, smtps, telnet, tftp
Features: AsynchDNS, IDN, IPv6, Largefile, NTLM, NTLM_WB, SSL, libz, brotli, TLS-SRP, HTTP2, UnixSockets, HTTPS-proxy

If there is no prebuilt binary available that matches your system, or if the installation fails, then you will need an environment capable of compiling Node.js addons, which means:

If you don't want to use the prebuilt binary even if it works on your system, you can pass a flag when installing:

With npm

npm install node-libcurl --build-from-source

With yarn

npm_config_build_from_source=true yarn add node-libcurl

Important Notes on Prebuilt Binaries / Direct Installation

Those notes are not important when building on Windows

The prebuilt binaries are statically linked with brotli, libidn2, libssh2, openLDAP, OpenSSL nghttp2, zstd and zlib.

The brotli, nghttp2, OpenSSL and zlib versions must match the version Node.js uses, this is necessary to avoid any possible issues by mixing library symbols of different versions, since Node.js also exports some of the symbols of their deps.

In case you are building the addon yourself with the libraries mentioned above, you must make sure their version is ABI compatible with the one Node.js uses, otherwise you are probably going to hit a Segmentation Fault.

If you want to build a statically linked version of the addon yourself, you need to pass the curl_static_build=true flag when calling install.

If using npm:

npm install node-libcurl --build-from-source --curl_static_build=true

If using yarn:

npm_config_build_from_source=true npm_config_curl_static_build=true yarn add node-libcurl

The build process will use curl-config available on path, if you want to overwrite it to your own libcurl installation one, you can set the curl_config_bin variable, like mentioned above for curl_static_build.

And if you don't want to use curl-config, you can pass two extra variables to control the build process:

  • curl_include_dirs Space separated list of directories to search for header files
  • curl_libraries Space separated list of flags to pass to the linker

Missing Packages

The statically linked version currently does not have support for GSS-API, SPNEGO, KERBEROS, RTMP, Metalink, PSL and Alt-svc.

The scripts to build Kerberos exists on the ./scripts/ci folder, but it was removed for two reasons:

  • If built with Heimdal, the addon becomes too big
  • If built with MIT Kerberos, the addon would be bound to their licensing terms.

Electron / NW.js

If building for a Electron or NW.js you need to pass additional parameters to the install command.

If you do not want to use the prebuilt binary, pass the npm_config_build_from_source=true / --build-from-source flag to the install command.

NW.js (aka node-webkit)

For building from source on NW.js you first need to make sure you have nw-gyp installed globally: yarn global add nw-gyp or npm i -g nw-gyp

If on Windows, you also need addition steps, currently the available win_delay_load_hook.cc on nw-gyp is not working with this addon, so it's necessary to apply a patch to it. The patch can be found on ./scripts/ci/patches/win_delay_load_hook.cc.patch, and should be applied to the file on <nw-gyp-folder>/src/win_delay_load_hook.cc.

Then:

yarn

npm_config_runtime=node-webkit npm_config_target=0.38.2 yarn add node-libcurl

npm

npm install node-libcurl --runtime=node-webkit --target=0.38.2 --save

where --target is the current version of NW.js you are using

Electron (aka atom-shell)

yarn

npm_config_runtime=electron npm_config_target=X.Y.Z npm_config_disturl=https://www.electronjs.org/headers yarn add node-libcurl

npm

npm install node-libcurl --runtime=electron --target=X.Y.Z --disturl=https://www.electronjs.org/headers --save

Where --target is the version of electron you are using, in our case, we are just using the version returned by the locally installed electron binary.

You can also put those args in a .npmrc file, like so:

runtime = electron
target = 5.0.1
target_arch = x64
dist_url = https://atom.io/download/atom-shell

Electron >= 11 / NW.js >= 0.50

If you are building for Electron >= 11 or NW.js >= 0.50 you need to set the build process to use the C++17 std, you can do that by passing the variable node_libcurl_cpp_std=c++17. The way you do that depends if you are using npm or yarn:

If using npm:

npm install node-libcurl --node_libcurl_cpp_std=c++17 <...other args...>

If using yarn:

npm_config_node_libcurl_cpp_std=c++17 <...other args...> yarn add node-libcurl

Building on Linux

To build the addon on linux based systems you must have:

  • gcc >= 7
  • libcurl dev files
  • python >= 3
  • OS that is not past their EOL.

If you are on a debian based system, you can get those by running:

sudo apt-get install python libcurl4-openssl-dev build-essential

If you don't want to use the libcurl version shipped with your system, since it's probably very old, you can install libcurl from source, for the addon to use that libcurl version you can use the variable mentioned above, curl_config_bin.

In case you want some examples check the CI configuration files (.travis.yml, .circleci/config.yml) and the scripts/ci/ folder.

Building on macOS

On macOS you must have:

  • macOS >= 11.6 (Big Sur)
  • Xcode Command Line Tools

You can check if you have Xcode Command Line Tools be running:

xcode-select -p

It should return their path, in case it returns nothing, you must install it by running:

xcode-select --install

Xcode >= 10 | macOS >= Mojave

In case you have errors installing the addon from source, and you are using macOS version >= Mojave, check if the error you are receiving is the following one:

  CXX(target) Release/obj.target/node_libcurl/src/node_libcurl.o
  clang: error: no such file or directory: '/usr/include'

If that is the case, it's because newer versions of the Command Line Tools does not add the /usr/include folder by default. Check Xcode 10 release notes for details.

The /usr/include is now available on $(xcrun --show-sdk-path)/usr/include. To correctly build libcurl you then need to pass that path to the npm_config_curl_include_dirs environment variable:

npm_config_curl_include_dirs="$(xcrun --show-sdk-path)/usr/include" yarn add node-libcurl

Building on Windows

If installing using a prebuilt binary you only need to have the visual c++ 2017 runtime library.

If building from source, you must have:

Python 3.x and the Visual Studio compiler can be installed by running:

npm install --global --production windows-build-tools

nasm can be obtained from their website, which is linked above, or using chocolatey:

cinst nasm

Currently there is no support to use other libcurl version than the one provided by the curl-for-windows submodule (help is appreciated on adding this feature).

An important note about building the addon on Windows is that we have to do some "hacks" with the header files included by node-gyp/nw-gyp. The reason for that is because as we are using a standalone version of OpenSSL, we don't want to use the OpenSSL headers provided by Node.js, which are by default added to <nw-gyp-or-node-gyp-folder>/include/node/openssl, so what we do is that before compilation that folder is renamed to openssl.disabled. After a successful installation the folder is renamed back to their original name, however if any error happens during compilation the folder will stay renamed until the addon is compiled successfully. More info on why that was needed and some context can be found on issue #164.

Getting Help

If your question is directly related to the addon or their usage, you can get help the following ways:

  • Post a question on stack-overflow and use the node-libcurl tag.
  • Join our Discord server and send your question there.

Contributing

Read CONTRIBUTING.md

Donations / Patreon

Some people have been asking if there are any means to support my work, I've created a patreon page for that: https://www.patreon.com/jonathancardoso

If you want to donate via PayPal, use the same e-mail that is available on my GitHub profile: https://github.com/JCMais

And thanks for reading till here! 😄

Originally this addon was based on the work from jiangmiao/node-curl, things have changed and most if not all code has been rewritten.

node-libcurl's People

Contributors

0xflotus avatar alaaattyamohamed avatar alex-sherwin avatar baditaflorin avatar codehero avatar danielecr avatar danielteichman avatar dependabot[bot] avatar gitter-badger avatar jcmais avatar jiangmiao avatar johnwchadwick avatar kapouer avatar mart-jansink avatar msjonker avatar nktnet avatar nytr0gen avatar pietermees avatar samuelepilleri avatar sergey-mityukov avatar smart--petea avatar sznowicki avatar vomc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-libcurl's Issues

"Top500" Example error

Hi,

the "top500" example code gives me the following error:

/home/myuser/Projects/MyProject/node_modules/node-libcurl/lib/Curl.js:326
return this._setOpt( optionIdOrName, optionValue );
^
Error: Unknown option given. First argument must be the option internal id or the option name. You can use the Curl.option constants.
at Curl.setOpt (/home/myuser/Projects/MyProject/node_modules/node-libcurl/lib/Curl.js:326:17)
at doRequest (/home/myuser/Projects/MyProject/top500.js:39:10)
at Object. (/home/myuser/Projects/MyProject/top500.js:18:5)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:929:3

The line the gives the error is:

    curl.setOpt( Curl.option.PRIVATE, siteUrl );

Is the PRIVATE option supported? You're writing in http://curl-library.cool.haxx.narkive.com/bFH3TXjM/add-node-js-binding

Here is the current list of options not implemented:

-- Options related to pass data around (Not needed because of the nature of javascript).
PROGRESSDATA, XFERINFODATA, DEBUGDATA, PRIVATE, etc.

Thanks a lot,
Gy.

GLIBC 2.14 issue

Hi

I installed but not working. It throws error saying "/lib64/libc.so.6: version `GLIBC_2.14' not found"

OS: Centos 6.7 Final
glibc 2.12
gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)

Is there any way to make this work on centos 6.7. Because no way to upgrade glibc to 2.14, as we hosted on dedicated server and the data center not support to upgrade to centos 7

node-libcurl not being installed on node 4.x and mac os x

Seems like there's not possible to compile old versions of [email protected] and [email protected]. In node 5, only versions @1.2.1 are working. Here is the output log:

$ npm install [email protected] --save --save-exact
npm WARN prefer global [email protected] should be installed with -g

[email protected] install /Users/aberope/robots/kobol/node_modules/slack-cli/node_modules/bufferutil
node-gyp rebuild

CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
In file included from ../src/bufferutil.cc:16:
../../nan/nan.h:261:25: error: redefinition of '_NanEnsureLocal'
[.....]
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:100:13)
gyp ERR! stack at ChildProcess.emit (events.js:185:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
gyp ERR! System Darwin 15.4.0
gyp ERR! command "/usr/local/Cellar/node/5.8.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/aberope/robots/kobol/node_modules/slack-cli/node_modules/bufferutil
gyp ERR! node -v v5.8.0
gyp ERR! node-gyp -v v3.2.1
gyp ERR! not ok
npm WARN install:[email protected] [email protected] install: node-gyp rebuild
npm WARN install:[email protected] Exit status 1
[...]
npm WARN install:[email protected] [email protected] install: node-gyp rebuild
npm WARN install:[email protected] Exit status 1

Build failed [email protected] node-gyp Exit Status 1

Hi guys, used node-libcurl 0.5.1 in project, there was no problem with it. Then migrated deployment to another server with Debian 7, and it failed to compile there, changed to newer 0.6.3 --> on server Debian now compiles, but on my local machine (Elementary OS (based on Ubuntu Precise 12.04) it now doesn't (although older version 0.5.1 still compiles locally).

I got problem since newer version of node-libcurl 0.6.3 on my local machine:
Linux Elementary OS Luna (Ubuntu Precise 12.04) kernel 3.11.0-26-generic x64 Intel core i5
node -v 0.12.4
npm -v 2.13.3
python -v 2.7
node-gyp -v 3.0.3
gcc -v 4.9.2 g++ 4.9.2
cmake --version 3.3.0-rc3

The output console error:

36 clang            0x000000000058dd39
Stack dump:
0.      Program arguments: /usr/bin/clang -cc1 -triple x86_64-pc-linux-gnu -emit-obj -disable-free -disable-llvm-verifier -main-file-name Multi.cc -pic-level 2 -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version 2.22 -momit-leaf-frame-pointer -ffunction-sections -fdata-sections -coverage-file Release/obj.target/node-libcurl/src/Multi.o -resource-dir /usr/bin/../lib/clang/3.0 -dependency-file ./Release/.deps/Release/obj.target/node-libcurl/src/Multi.o.d.raw -MT Release/obj.target/node-libcurl/src/Multi.o -D NODE_GYP_MODULE_NAME=node-libcurl -D _LARGEFILE_SOURCE -D _FILE_OFFSET_BITS=64 -D BUILDING_NODE_EXTENSION -I /home/musichen/.node-gyp/0.12.4/src -I /home/musichen/.node-gyp/0.12.4/deps/uv/include -I /home/musichen/.node-gyp/0.12.4/deps/v8/include -I ../node_modules/nan -fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem /usr/include/c++/4.6 -internal-isystem /usr/include/c++/4.6/x86_64-linux-gnu -internal-isystem /usr/include/c++/4.6/backward -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/clang/3.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /usr/include -O2 -Wall -Wextra -Wno-unused-parameter -Wno-narrowing -std=c++11 -fdeprecated-macro -ferror-limit 19 -fmessage-length 160 -pthread -fno-rtti -fgnu-runtime -fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-fragile-abi -fdiagnostics-show-option -fcolor-diagnostics -o Release/obj.target/node-libcurl/src/Multi.o -x c++ ../src/Multi.cc 
1.      ../src/Multi.cc:32:180: current parser token ';'
2.      ../src/Multi.cc:25:1: parsing namespace 'NodeLibcurl'
3.      ../src/Multi.cc:30:5: parsing function body 'Multi'
4.      ../src/Multi.cc:30:5: in compound statement ('{}')
clang: error: unable to execute command: Segmentation fault
clang: error: clang frontend command failed due to signal 2 (use -v to see invocation)
clang: note: diagnostic msg: Please submit a bug report to http://llvm.org/bugs/ and include command line arguments and all diagnostic information.
clang: note: diagnostic msg: Preprocessed source(s) are located at:
clang: note: diagnostic msg: /tmp/Multi-9i56WC.ii
make: *** [Release/obj.target/node-libcurl/src/Multi.o] Error 254
make: Leaving directory `/home/musichen/dev/bitbucket/_playground/wng-backend-publisher/node_modules/lib-storage-bindings/node_modules/node-libcurl/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Linux 3.11.0-26-generic
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/musichen/dev/bitbucket/_playground/wng-backend-publisher/node_modules/lib-storage-bindings/node_modules/node-libcurl
gyp ERR! node -v v0.12.4
gyp ERR! node-gyp -v v2.0.2
gyp ERR! not ok 
npm ERR! Linux 3.11.0-26-generic
npm ERR! argv "node" "/usr/local/bin/npm" "install" "node-libcurl"
npm ERR! node v0.12.4
npm ERR! npm  v2.13.3
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node tools/retrieve-win-deps && node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node tools/retrieve-win-deps && node-gyp rebuild'.
npm ERR! This is most likely a problem with the node-libcurl package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node tools/retrieve-win-deps && node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls node-libcurl
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/musichen/dev/bitbucket/_playground/wng-backend-publisher/node_modules/lib-storage-bindings/node_modules/npm-debug.log

Wrong encoding is used for some URLs

this is the code i'm using

var Curl = require('node-libcurl').Curl
var curl = new Curl()
curl.setOpt(Curl.option.URL, "http://www1.bloomingdales.com/shop/product/mac-powder-blush-wash-dry-collection?ID=1371879")
curl.setOpt(Curl.option.FOLLOWLOCATION, true)
curl.setOpt(Curl.option.COOKIEJAR, "cookie.jar")
curl.setOpt(Curl.option.COOKIEFILE, "cookie.jar")
curl.on('end', function(statusCode, body, headers) {
    console.log(body)
})
curl.perform()

here is what I got in the title tag:

M�A�C Powder Blush, Wash & Dry Collection | Bloomingdale's

however when I use curl:

curl -XGET -L http://www1.bloomingdales.com/shop/product/mac-powder-blush-wash-dry-collection?ID=1371879 -c cookie.jar

I get the title with the right encoding:

M·A·C Powder Blush, Wash & Dry Collection | Bloomingdale's

tested on: [email protected] and [email protected]

system libcurl version: curl 7.29.0

Check server availability.

I'm using NodeJS.
I have array of IPs and want to check if every of them is available. I made it just doing simple request and responce.statusCode === 200 ? "Available" : "Not available"

How should I do it with your node-libcurl module?

Install fails on OSX if path has spaces

Hi

If the path has spaces, the installation fails --- at least on OSX. Here's an example:

npm install node-libcurl

Gives this output:

[email protected] install /Users/myusername/installfolder (with spaces)/lambda/examplefolder/node_modules/node-libcurl
node tools/retrieve-win-deps && node tools/generate-stubs && node-gyp rebuild

/bin/sh: -c: line 0: syntax error near unexpected token (' /bin/sh: -c: line 0:node /Users/myusername/installfolder (with spaces)/lambda/examplefolder/node_modules/node-libcurl/tools/curl-config.js'
gyp: Call to 'node /Users/myusername/installfolder (with spaces)/lambda/examplefolder/node_modules/node-libcurl/tools/curl-config.js' returned exit status 2. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:343:16)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Darwin 14.3.0

crashing on timeout

When a curl request times out, the node process crashes within the winsock closesocket() call.
The call stack is as follows:

closesocket()
Curl_closesocket()
conn_free()
Curl_disconnect()
Curl_done()
curl_multi_remove_handle()
Curl::ProcessMessages()
Curl::OnTimeout()
uv_timer_get_repeat()
uv_run()

Any advice on how to resolve?

Can't compile with iojs

The build log is 129kb, but here's the important part

d:\git\mine\curl\node_modules\node-libcurl\node_modules\nan\nan_implementation_12_inl.h(181): error C2660: 'v8::Signature::New' : function does not take 4 arguments (..\src\Curl.cc) [d:\Git\Mine\curl\node_modules\node-libcurl\build\node-libcurl.vcxproj]
d:\git\mine\curl\node_modules\node-libcurl\node_modules\nan\nan_implementation_12_inl.h(181): error C2660: 'v8::Signature::New' : function does not take 4 arguments (..\src\node-libcurl.cc) [d:\Git\Mine\curl\node_modules\node-libcurl\build\node-libcurl.vcxproj]
gyp ERR! build error 
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\iojs\node_modules\npm\node_modules\node-gyp\lib\build.js:269:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:169:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1009:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "C:\\Program Files\\iojs\\node.exe" "C:\\Program Files\\iojs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd d:\Git\Mine\curl\node_modules\node-libcurl
gyp ERR! node -v v2.0.1
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok 
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\iojs\\node.exe" "C:\\Program Files\\iojs\\node_modules\\npm\\bin\\npm-cli.js" "install" "node-libcurl"
npm ERR! node v2.0.1
npm ERR! npm  v2.9.0
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node tools/retrieve-win-deps && node tools/generate-stubs && node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node tools/retrieve-win-deps && node tools/generate-stubs && node-gyp rebuild'.
npm ERR! This is most likely a problem with the node-libcurl package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node tools/retrieve-win-deps && node tools/generate-stubs && node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls node-libcurl
npm ERR! There is likely additional logging output above.

I'm assuming that it's not supported but I thought I'd raise an issue anyway.

Request through proxy on https secured website

Hello,
Making a request to a https website (i tried https://www.google.com, https://yahoo.com) doesn't work while i'm using a http proxy (i tried some from the hidemyass list). The proxy works using curl (curl --proxy $PROXY https://google.com). Also I can use node-libcurl with a proxy on a http website. Also a socks5 proxy works on a https website. I just can't get a http proxy to work.

Let me know if I wasn't clear enough. I'm pretty bad at explaining bugs.

Strange behavior in Node debugger (REPL)

Hello,

first of all, thanks for amazing module!
I pretty enjoy it and everything works awesome until I try to do some things in Node debugger.

Consider the following trivial snippet (test.js):

var Curl = require('node-libcurl').Curl;

var curl = new Curl();

debugger;

Run it in debugger mode:

$ node debug test.js

And after pressing c to continue, get stopped at the breakpoint. Type repl + Enter, get into REPL console.
Type curl and hit Enter, and get the error:

node: ../node_modules/nan/nan_object_wrap.h:33: static T* Nan::ObjectWrap::Unwrap(v8::Local<v8::Object>) [with T = NodeLibcurl::Easy]: Assertion `object->InternalFieldCount() > 0' failed.
program terminated

I guess it happens because debugger tries to obtain some internal structure of the Curl instance.

Also, that does not reproduce if I start in REPL from the very beginning:

$ node
> new (require('node-libcurl').Curl)()
Curl {
  domain: 
   Domain {
     domain: null,
     _events: { error: [Function] },
     _eventsCount: 1,
     _maxListeners: undefined,
     members: [] },
  _events: {},
  _eventsCount: 0,
  _maxListeners: undefined,
  _handle: Easy { onData: [Function: bound ], onHeader: [Function: bound ] },
  _id: 1,
  _chunks: [],
  _headerChunks: [],
  _chunksLength: 0,
  _headerChunksLength: 0,
  _isRunning: false,
  _features: 0,
  onData: null,
  onHeader: null }

Thanks.

npm install node-libcurl problem

Hi,

I'm having a problem when installing the package. Previously this problem not occurred: about 1 month ago. Can you Help me, pls. It's really important and I hurry that works in PRODUCTION.

Tnx and regards.

p.s.: you can see the log below.

npm WARN engine [email protected]: wanted: {"node":">= 0.8.0"} (current: {"node":"0.13.0-pre","npm":"2.7.4"})

[email protected] install /var/www/kinder/microsite/backend/node_modules/node-libcurl
node tools/retrieve-win-deps && node tools/generate-stubs && node-gyp rebuild

Cannot find curl's header file.
npm ERR! Linux 3.13.0-45-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v0.13.0-pre
npm ERR! npm v2.7.4
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node tools/retrieve-win-deps && node tools/generate-stubs && node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node tools/retrieve-win-deps && node tools/generate-stubs && node-gyp rebuild'.
npm ERR! This is most likely a problem with the node-libcurl package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node tools/retrieve-win-deps && node tools/generate-stubs && node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls node-libcurl
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /var/www/kinder/microsite/backend/npm-debug.log
[Exit 1]

Error at install

Hi,
I just installed the latest nodejs, and libcurl, and had this error :

"5869 error Windows_NT 6.1.7601
5870 error argv "D:\programmes\nodejs\node.exe" "D:\programmes\nodejs\node_modules\npm\bin\npm-cli.js" "install" "node-libcurl"
5871 error node v0.12.7
5872 error npm v2.11.3
5873 error code ELIFECYCLE
5874 error [email protected] install: node tools/retrieve-win-deps && node tools/generate-stubs && pangyp rebuild
5874 error Exit status 1
5875 error Failed at the [email protected] install script 'node tools/retrieve-win-deps && node tools/generate-stubs && pangyp rebuild'.
5875 error This is most likely a problem with the node-libcurl package,
5875 error not with npm itself."

The complete log is here http://jpst.it/Ba8O.
Thank you for your help !
Best regards,
Anthony

compile error

Hey there,

Thanks again for this awesome module. I've ran into a quite weird compile error today. Basically the module builds just fine on OSX (10.10.3) with node and npm versions v0.12.4 and 2.10.1 respectively. However, on Linux (Arch, package versions v0.12.4 and 2.11.1) it fails.

The relevant part of the error log:

make: Entering directory '/tmp/node_modules/node-libcurl/build'
  CXX(target) Release/obj.target/node-libcurl/src/node-libcurl.o
  CXX(target) Release/obj.target/node-libcurl/src/Curl.o
In file included from ../src/Curl.cc:18:0:
../src/generated-stubs/curlAuth.h:16:1: error: narrowing conversion of '18446744073709551599ul' from 'long unsigned int' to 'int32_t {aka int}' inside { } [-Wnarrowing]
 };
 ^
../src/generated-stubs/curlAuth.h:16:1: error: narrowing conversion of '18446744073709551598ul' from 'long unsigned int' to 'int32_t {aka int}' inside { } [-Wnarrowing]
../src/generated-stubs/curlAuth.h:16:1: error: narrowing conversion of '2147483648ul' from 'long unsigned int' to 'int32_t {aka int}' inside { } [-Wnarrowing]
node-libcurl.target.mk:94: recipe for target 'Release/obj.target/node-libcurl/src/Curl.o' failed
make: *** [Release/obj.target/node-libcurl/src/Curl.o] Error 1
make: Leaving directory '/tmp/node_modules/node-libcurl/build'

Cheers

Cannot find curl's header file.

$ npm install node-libcurl --save
npm WARN engine [email protected]: wanted: {"node":">= 0.10.0 && <= 0.12","iojs":">= 1.0.0"} (current: {"node":"0.12.6","npm":"2.11.2"})
\
> [email protected] install /home/user/github/docker-mongo-cluster/cluster/node_modules/node-libcurl
> node tools/retrieve-win-deps && node tools/generate-stubs && pangyp rebuild

Cannot find curl's header file.
npm ERR! Linux 3.13.0-32-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "node-libcurl" "--save"
npm ERR! node v0.12.6
npm ERR! npm  v2.11.2
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node tools/retrieve-win-deps && node tools/generate-stubs && pangyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node tools/retrieve-win-deps && node tools/generate-stubs && pangyp rebuild'.
npm ERR! This is most likely a problem with the node-libcurl package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node tools/retrieve-win-deps && node tools/generate-stubs && pangyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls node-libcurl
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/user/github/docker-mongo-cluster/cluster/npm-debug.log

gcc:

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.4-2ubuntu1~14.04' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04)

system - stuff:

$ uname -a
Linux fentaso 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

$ python --version
Python 2.7.6

$ curl --version
curl 7.35.0 (x86_64-pc-linux-gnu) libcurl/7.35.0 OpenSSL/1.0.1f zlib/1.2.8 libidn/1.28 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smtp smtps telnet tftp 
Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP

After some search I found following solution:

$ sudo apt-get install libcurl3-dev

Just wanted to let you know.

Install fails on OSX 10.10.2

When using NPM to install the package, I get this error...

[TheGrisk@Zachery-DeLong-DC] NodeJSCurl $ npm update
[email protected] node_modules/http-server/node_modules/portfinder/node_modules/mkdirp/node_modules/minimist
[email protected] node_modules/http-server/node_modules/optimist/node_modules/minimist
[email protected] node_modules/http-server/node_modules/union/node_modules/qs
[TheGrisk@Zachery-DeLong-DC] NodeJSCurl $ npm install node-libcurl
/
> [email protected] install /Users/TheGrisk/Development/tmp/NodeJSCurl/node_modules/node-libcurl
> node tools/retrieve-win-deps && node tools/generate-stubs && node-gyp rebuild

Cannot find curl's header file.
npm ERR! Darwin 14.1.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "node-libcurl"
npm ERR! node v0.12.0
npm ERR! npm  v2.5.1
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node tools/retrieve-win-deps && node tools/generate-stubs && node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node tools/retrieve-win-deps && node tools/generate-stubs && node-gyp rebuild'.
npm ERR! This is most likely a problem with the node-libcurl package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node tools/retrieve-win-deps && node tools/generate-stubs && node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls node-libcurl
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/TheGrisk/Development/tmp/NodeJSCurl/npm-debug.log

Has anyone else seen this issue?

Unable to install node-libcurl

Hi,

I am also getting a similar error and seriously got strucked here.

npm WARN package.json [email protected] No repository field.
npm WARN engine [email protected]: wanted: {"node":">= 0.8.0 && < 0.11.0"} (current: {"node":"0.10.36","npm":"1.4.28"})

[email protected] install /usr/local/node/ayla/node_modules/node-libcurl
node tools/retrieve-win-deps && node tools/generate-stubs && node-gyp rebuild
Cannot find curl's header file.

npm ERR! [email protected] install: node tools/retrieve-win-deps && node tools/generate-stubs && node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the node-libcurl package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node tools/retrieve-win-deps && node tools/generate-stubs && node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls node-libcurl
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 2.6.32-431.17.1.el6.x86_64
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "node-libcurl"
npm ERR! cwd /usr/local/node/ayla
npm ERR! node -v v0.10.36
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0

Just wanted to check if there is any solution available. Also may be due to this erorr, I am unable to do npm install node-curl.

Here is my curl version details
curl 7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.15.3 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
Protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz

and here is my npm install --loglevel verbose. It appears that I haven't placed any package.json as I dont maintain any specific version dependencies. Does this cause a problem?

npm info it worked if it ends with ok
npm verb cli [ '/usr/bin/node',
npm verb cli '/usr/bin/npm',
npm verb cli 'install',
npm verb cli '--loglevel',
npm verb cli 'verbose' ]
npm info using [email protected]
npm info using [email protected]
npm ERR! install Couldn't read dependencies
npm ERR! package.json ENOENT, open '/usr/local/node/ayla/package.json'
npm ERR! package.json This is most likely not a problem with npm itself.
npm ERR! package.json npm can't find a package.json file in your current directory.

npm ERR! System Linux 2.6.32-431.17.1.el6.x86_64
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "--loglevel" "verbose"
npm ERR! cwd /usr/local/node/ayla
npm ERR! node -v v0.10.36
npm ERR! npm -v 1.4.28
npm ERR! path /usr/local/node/ayla/package.json
npm ERR! code ENOPACKAGEJSON
npm ERR! errno 34
npm verb exit [ 34, true ]
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /usr/local/node/ayla/npm-debug.log
npm ERR! not ok code 0

Can't npm install on Mac osx yosemite

npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No license field.
npm WARN engine [email protected]: wanted: {"node":">= 0.10.0 && <= 0.12","iojs":">= 1.0.0"} (current: {"node":"4.1.0","npm":"2.14.3"})
npm WARN deprecated [email protected]: use node-gyp@3+, it does all the things
\

[email protected] install /Applications/xxx/node_modules/node-libcurl
node tools/retrieve-win-deps && node tools/generate-stubs && pangyp rebuild

gyp: /Users/xxx/.node-gyp/4.1.0/common.gypi not found (cwd: /Applications/MAMP/htdocs/mvc/node_modules/node-libcurl) while reading includes of binding.gyp while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/Applications/MAMP/htdocs/mvc/node_modules/node-libcurl/node_modules/pangyp/lib/configure.js:346:16)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 14.3.0
gyp ERR! command "/usr/local/bin/node" "/Applications/MAMP/htdocs/mvc/node_modules/node-libcurl/node_modules/.bin/pangyp" "rebuild"
gyp ERR! cwd /Applications/MAMP/htdocs/mvc/node_modules/node-libcurl
gyp ERR! node -v v4.1.0
gyp ERR! pangyp -v v2.3.2
gyp ERR! not ok
npm ERR! Darwin 14.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "node-libcurl"
npm ERR! node v4.1.0
npm ERR! npm v2.14.3
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node tools/retrieve-win-deps && node tools/generate-stubs && pangyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node tools/retrieve-win-deps && node tools/generate-stubs && pangyp rebuild'.
npm ERR! This is most likely a problem with the node-libcurl package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node tools/retrieve-win-deps && node tools/generate-stubs && pangyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls node-libcurl
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /Applications/MAMP/htdocs/mvc/npm-debug.log

how could i hide the debug message

node example.js
* Hostname was NOT found in DNS cache
* Trying xxx.xxx.xxx.x...
* Connected to www.domain.com (xxx.xxx.xxx.x) port 80 (#0)
> POST /path/to/page.php HTTP/1.1
Host: www.example.com
Accept: */*
Cookie: ASPSESSIONIDCQBTDBAA=KOELADHAIBAICMIIDMLGKCDP;ASPSESSIONIDSQCBQRRC=KBDPDOFAELNEAJKENCEGEEPM; TS0161f2e5=0141259276d9526d53def50bf1529ea5da027d962f7bfa3536fd0959bbe83f5a90d940a647
content-type: application/x-www-form-urlencoded
Content-Length: 341

everytime i run this program would display a debug message in my terminal, is there any option to hide it?

Getting error while using Node v4.2.4

Hello~

Could you help me diagnose my error? Everything was working fine when I was using Node v 0.12.7.

return process.dlopen(module, path._makeLong(filename));
                 ^

Error: dlopen(/Users/angie/projects/node-projects/search-api/node_modules/node-libcurl/lib/binding/node_libcurl.node, 1): Library not loaded: /Users/travis/lib/libcurl.4.dylib
  Referenced from: /Users/angie/projects/node-projects/search-api/node_modules/node-libcurl/lib/binding/node_libcurl.node
  Reason: Incompatible library version: node_libcurl.node requires version 9.0.0 or later, but libcurl.4.dylib provides version 7.0.0

OS: OSX 10.10.5
xcode: 7.2
libcurl: 7.43.0

Thanks!

Using NTLM causes half the requests to fail

I'm working on a little project and I'm trying to authenticate with NTLM.

This is what I'm using to make the request:

var Promise = require('bluebird');
var express = require('express');
var Curl = require( 'node-libcurl' ).Curl;

function createAPIRequest(url) {
  return new Promise(function(resolve, reject) {
    var curl = new Curl();
    curl.setOpt('URL', 'http://chum:8048/Sandbox/OData/' + url);
    curl.setOpt('HTTPAUTH', Curl.auth.NTLM);
    curl.setOpt('USERPWD', ''); //stuff goes in here
    curl.setOpt('HTTPHEADER', ['Content-Type: application/json', 'Accept: application/json']);

    curl
      .on('end', function(code, body, headers) {
        console.log(code);
        console.log(headers);

        resolve(JSON.parse(body || '{}'));
        this.close();
      })
      .on('error', function(e) {
        reject(e);
        this.close();
      })
      .perform();
  });
}

The thing is, it alternates between working and not working. Not sure if there's like some cache that needs to be cleared between requests and it's not or something. Like, it'll work and the server will return a 200, then the next request, it'll be a 401, then it'll go back to 200 and keep repeating.

The server is Microsoft Dynamics NAV 2013 R2. This only occurs in Linux using libcurl 7.40.0 or 7.32.0, but works fine under Windows using libcurl 7.40.0.

Provide cli via -g install flag

Have you considered providing this as a cli utility that basically works like curl? (could install with two names, say ncurl and curl to avoid conflicts). I was thinking about this because installing curl on windows isn't the best experience, but you'd need it to run nodejs/node core tests.

Care for a PR? Alternatively I'd just write some module for it.

POSTFIELDSIZE possible bug?

Hi there, thanks for this awesome library. It is really cool!
I am currently sending a very large binary string in the POSTFIELD and when I don't set a POSTFIELDSIZE it truncates my binary string. So I set the POSTFIELDSIZE as my data.length and it sends a lot more of the binary string but it is still truncating the data.

Error on install

My system:
Linux 3.16.0-4-586 #1 Debian 3.16.7-ckt25-2 (2016-04-08) i686 GNU/Linux

I'm having the following problem when I try to install node-libcurl
Can someone help me?
Thank you!

root@Homologacao-telemetria:/var/www/html/socket-server# npm install node-libcurl --safe

[email protected] install /var/www/html/socket-server/node_modules/node-libcurl
node-pre-gyp install --fallback-to-build

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/5.11.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/var/www/html/socket-server/node_modules/node-libcurl/.node-gyp"
make: Entering directory '/var/www/html/socket-server/node_modules/node-libcurl/build'
make: *** No rule to make target '../.node-gyp/5.11.0/include/node/common.gypi', needed by 'Makefile'. Pare.
make: Leaving directory '/var/www/html/socket-server/node_modules/node-libcurl/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/var/www/html/socket-server/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:100:13)
gyp ERR! stack at ChildProcess.emit (events.js:185:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
gyp ERR! System Linux 3.16.0-4-586
gyp ERR! command "/opt/node/bin/node" "/var/www/html/socket-server/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/var/www/html/socket-server/node_modules/node-libcurl/lib/binding/node_libcurl.node" "--module_name=node_libcurl" "--module_path=/var/www/html/socket-server/node_modules/node-libcurl/lib/binding"
gyp ERR! cwd /var/www/html/socket-server/node_modules/node-libcurl
gyp ERR! node -v v5.11.0
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/opt/node/bin/node /var/www/html/socket-server/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/var/www/html/socket-server/node_modules/node-libcurl/lib/binding/node_libcurl.node --module_name=node_libcurl --module_path=/var/www/html/socket-server/node_modules/node-libcurl/lib/binding' (1)
node-pre-gyp ERR! stack at ChildProcess. (/var/www/html/socket-server/node_modules/node-libcurl/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:100:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:185:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:850:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
node-pre-gyp ERR! System Linux 3.16.0-4-586
node-pre-gyp ERR! command "/opt/node/bin/node" "/var/www/html/socket-server/node_modules/node-libcurl/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /var/www/html/socket-server/node_modules/node-libcurl
node-pre-gyp ERR! node -v v5.11.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.13
node-pre-gyp ERR! not ok
Failed to execute '/opt/node/bin/node /var/www/html/socket-server/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/var/www/html/socket-server/node_modules/node-libcurl/lib/binding/node_libcurl.node --module_name=node_libcurl --module_path=/var/www/html/socket-server/node_modules/node-libcurl/lib/binding' (1)
/var/www/html/socket-server
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

npm WARN enoent ENOENT: no such file or directory, open '/var/www/html/socket-server/package.json'
npm WARN socket-server No description
npm WARN socket-server No repository field.
npm WARN socket-server No README data
npm WARN socket-server No license field.
npm ERR! Linux 3.16.0-4-586
npm ERR! argv "/opt/node/bin/node" "/opt/node/bin/npm" "install" "node-libcurl" "--safe"
npm ERR! node v5.11.0
npm ERR! npm v3.8.6
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node-pre-gyp install --fallback-to-build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the node-libcurl package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs node-libcurl
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls node-libcurl
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /var/www/html/socket-server/npm-debug.log
root@Homologacao-telemetria:/var/www/html/socket-server#

Set header

Hi, I'm trying to set option curl.setOpt( 'CURLOPT_HTTPHEADER', ['Host: ' + frontend]);, where frontend is front end IP. But 'end' or 'error' handlers are not invoked. Any thoughts how to set host in header?

Put file upload support

I'm trying to figure out a list of all the options available. In your examples for uploading a file, you use curl.option.HTTPPOST. HTTPPOST is not a listed valid curl option in any documentation that I can see. I see POST but not HTTPPOST. So anyways, according to your doc's, the curl.option is an Object with all the valid options in it. So in an attempt to learn more, I did this:

var Curl = require('node-libcurl').Curl;
var curl = new Curl();
console.log(curl.option);

I get undefined. Am I missing something here? How do I see the list of all available options? I need to upload a file using http PUT, but I have no idea what option name to use for this in your library...

Segfault in 0.6.3 version

Here is what i got:

PID 2493 received SIGSEGV for address: 0x10
/srv/gdeposylka/tracker/release/543/node_modules/segfault-handler/build/Release/segfault-handler.node(+0x1cab)[0x2b6fc4001cab]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xf0a0)[0x2b6fbf20c0a0]
/srv/gdeposylka/tracker/release/543/node_modules/node-libcurl/build/Release/node-libcurl.node(_ZN11NodeLibcurl5Multi21CallOnMessageCallbackEPv8CURLcode+0x96)[0x2b6fc4c31576]
/srv/gdeposylka/tracker/release/543/node_modules/node-libcurl/build/Release/node-libcurl.node(_ZN11NodeLibcurl5Multi15ProcessMessagesEv+0x4f)[0x2b6fc4c317af]
/srv/gdeposylka/tracker/release/543/node_modules/node-libcurl/build/Release/node-libcurl.node(_ZN11NodeLibcurl5Multi13HandleTimeoutEPvlS1_+0x4d)[0x2b6fc4c3186d]
/usr/lib/x86_64-linux-gnu/libcurl.so.4(+0x37ce5)[0x2b6fc4e7ace5]
/usr/lib/x86_64-linux-gnu/libcurl.so.4(curl_multi_socket_action+0x48)[0x2b6fc4e7cbb8]
/srv/gdeposylka/tracker/release/543/node_modules/node-libcurl/build/Release/node-libcurl.node(_ZN11NodeLibcurl5Multi9OnTimeoutEP10uv_timer_s+0x20)[0x2b6fc4c317e0]
/srv/gdeposylka/tracker/release/543/node_modules/node-libcurl/build/Release/node-libcurl.node(_ZN11NodeLibcurl5Multi13HandleTimeoutEPvlS1_+0x4d)[0x2b6fc4c3186d]
/usr/lib/x86_64-linux-gnu/libcurl.so.4(+0x37ce5)[0x2b6fc4e7ace5]
/usr/lib/x86_64-linux-gnu/libcurl.so.4(curl_multi_add_handle+0x21e)[0x2b6fc4e7d34e]
/srv/gdeposylka/tracker/release/543/node_modules/node-libcurl/build/Release/node-libcurl.node(_ZN11NodeLibcurl5Multi9AddHandleERKN3Nan20FunctionCallbackInfoIN2v85ValueEEE+0x1e6)[0x2b6fc4c30fb6]
/srv/gdeposylka/tracker/release/543/node_modules/node-libcurl/build/Release/node-libcurl.node(+0x137bf)[0x2b6fc4c2e7bf]

Installation does not work after installing libcurl-devel

I am in the process of downloading the node-libcurl module onto an offline CentOS server. Using npmbox (https://github.com/arei/npmbox), I've packaged node-libcurl and downloaded it onto the server. I have also downloaded the libcurl devel package and gotten the following result.

$ sudo yum install libcurl-devel
http://yum0002.svc.eng.wd5.wd//repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package libcurl-devel.x86_64 0:7.19.7-37.el6_5.3 will be installed
--> Processing Dependency: libidn-devel for package: libcurl-devel-7.19.7-37.el6_5.3.x86_64
--> Processing Dependency: automake for package: libcurl-devel-7.19.7-37.el6_5.3.x86_64
--> Running transaction check
---> Package automake.noarch 0:1.11.1-4.el6 will be installed
--> Processing Dependency: autoconf >= 2.62 for package: automake-1.11.1-4.el6.noarch
---> Package libidn-devel.x86_64 0:1.18-2.el6 will be installed
--> Running transaction check
---> Package autoconf.noarch 0:2.63-5.1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================
 Package                           Arch                       Version                                 Repository                       Size
============================================================================================================================================
Installing:
 libcurl-devel                     x86_64                     7.19.7-37.el6_5.3                       C65-Updates                     244 k
Installing for dependencies:
 autoconf                          noarch                     2.63-5.1.el6                            C65-DVD                         781 k
 automake                          noarch                     1.11.1-4.el6                            C65-DVD                         550 k
 libidn-devel                      x86_64                     1.18-2.el6                              C65-DVD                         137 k

Transaction Summary
============================================================================================================================================
Install       4 Package(s)

Total download size: 1.7 M
Installed size: 4.8 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): autoconf-2.63-5.1.el6.noarch.rpm                                                                              | 781 kB     00:00
(2/4): automake-1.11.1-4.el6.noarch.rpm                                                                              | 550 kB     00:00
(3/4): libcurl-devel-7.19.7-37.el6_5.3.x86_64.rpm                                                                    | 244 kB     00:00
(4/4): libidn-devel-1.18-2.el6.x86_64.rpm                                                                            | 137 kB     00:00
--------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                        21 MB/s | 1.7 MB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : autoconf-2.63-5.1.el6.noarch                                                                                             1/4
  Installing : automake-1.11.1-4.el6.noarch                                                                                             2/4
  Installing : libidn-devel-1.18-2.el6.x86_64                                                                                           3/4
  Installing : libcurl-devel-7.19.7-37.el6_5.3.x86_64                                                                                   4/4
  Verifying  : libidn-devel-1.18-2.el6.x86_64                                                                                           1/4
  Verifying  : libcurl-devel-7.19.7-37.el6_5.3.x86_64                                                                                   2/4
  Verifying  : autoconf-2.63-5.1.el6.noarch                                                                                             3/4
  Verifying  : automake-1.11.1-4.el6.noarch                                                                                             4/4

Installed:
  libcurl-devel.x86_64 0:7.19.7-37.el6_5.3

Dependency Installed:
  autoconf.noarch 0:2.63-5.1.el6               automake.noarch 0:1.11.1-4.el6               libidn-devel.x86_64 0:1.18-2.el6

Complete!

Attempting to unpackage the node-libcurl npmbox results in the following error:

$ npmunbox node-libcurl.npmbox

Unboxing node-libcurl.npmbox...
Unpacking node-libcurl...
Installing node-libcurl...
  { [Error: [email protected] install: `node tools/retrieve-win-deps && node tools/generate-stubs && pangyp rebuild`
Exit status 1]
  code: 'ELIFECYCLE',
  pkgid: '[email protected]',
  stage: 'install',
  script: 'node tools/retrieve-win-deps && node tools/generate-stubs && pangyp rebuild',
  pkgname: 'node-libcurl' }

"Cloning" a curl request for multiple execution

I would like to be able to "retry" a curl request (with exactly the same options), without having to redefine all opts manually. Is they a way to do this ?

For example :

var curl=new Curl();
curl.setOpt('URL',url);
curl.setOpt('FOLLOWLOCATION',true);
curl.setOpt('SSL_VERIFYPEER', false);

var curlRetry = curl.clone()
curl.on('end', function(statusCode) {
  if (statusCode===404) {
    curlRetry.perform();
  }
})

curl.perform();

Using libcurl while iterating an object has odd behavior.

_.each({
  "Node.js": {
    filename: somefilenamehere,
    url: someurlhere
  },
  "Electron Shell": {
    filename: somefilenamehere
    url: someurlhere
  }
}, function (requirement, name) {
  // pretty much a carbon copy of the progress bar example.
});

The output doesn't seem to work as expected.

This is probably something I'm doing wrong, but what's the fix for this?

Error building for nwjs

WIN7 X64
Node 0.12.13 X32

Python 2.7 - OK
Visual Studio 2013 - OK
git - OK

npm install nw-gyp -g - OK
npm install node-libcurl --runtime=node-webkit --target=0.12.3 --arch=ia32 --msvs_version=2013 --build-from-source --save

console error:
gyp: conditions target_arch=="arm" must be length 2 or 3, not 17

debug-log error:
14804 error Windows_NT 6.1.7601
14805 error argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "node-libcurl" "--runtime=node-webkit" "--target=0.12.3" "--arch=ia32" "--msvs_version=2013" "--build-from-source" "--save"
14806 error node v0.12.13
14807 error npm v2.15.0
14808 error code ELIFECYCLE

Editing file deps\curl-for-windows\openssl\openssl.gyp
removes mentioned error, goes further with building but fails with many errors.

Error: Command failed: C:\Windows\system32\cmd.exe /s /c "git init -q && git submodule add https://github.com/JCMais/curl-for-windows.git deps/curl-for-windows"
'deps/curl-for-windows' already exists and is not a valid git repo


When using:
npm install node-libcurl
builds OK, work OK in node, not working in nwjs (Module version mismatch. Expected 43, got 14)

On Mac & Linux (Debian Ubuntu) same command builds and work OK for nwjs.

Can anybody compile and upload node_libcurl-v0.9.0-node-v43-win32-ia32.tar.gz

Build fail OSX

Cannot find curl's header file.
npm ERR! [email protected] install: `node tools/retrieve-win-deps && node tools/generate-stubs && node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the node-libcurl package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node tools/retrieve-win-deps && node tools/generate-stubs && node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls node-libcurl
npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 14.0.0
npm ERR! command "/Users/newscred/.nvm/v0.10.26/bin/node" "/Users/newscred/.nvm/v0.10.26/bin/npm" "install" "node-libcurl" "--save"
npm ERR! cwd /Users/newscred/Desktop/instagram_node
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/newscred/Desktop/instagram_node/npm-debug.log
npm ERR! not ok code 0

Getting error in rebuilding with node v0.12.7

Hi,
I am getting error on rebuilding with node v0.12.7 and npm v2.11.3. The logs are as -

npm install node-libcurl
npm WARN engine [email protected]: wanted: {"node":">= 0.10.0 && <= 0.12","iojs":">= 1.0.0"} (current: {"node":"0.12.7","npm":"2.11.3"})

npm WARN deprecated [email protected]: use node-gyp@3+, it does all the things

[email protected] install /home/mz/temp_moz/node_modules/node-libcurl
node tools/retrieve-win-deps && node tools/generate-stubs && pangyp rebuild

Cannot find curl's header file.
npm ERR! Linux 3.13.0-24-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "node-libcurl"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node tools/retrieve-win-deps && node tools/generate-stubs && pangyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node tools/retrieve-win-deps && node tools/generate-stubs && pangyp rebuild'.
npm ERR! This is most likely a problem with the node-libcurl package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node tools/retrieve-win-deps && node tools/generate-stubs && pangyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls node-libcurl
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/mz/temp_moz/node_modules/npm-debug.log

Curl.option.SSH_AUTH_TYPES is missing?

Hi,
It could be wrong but it looks like the CURLOPT for SSH_AUTH_TYPES is missing.
I can see that you have provided the relevant settings in Curl.ssh_auth here but when I try to implement it, I get

Error: Unknown option given. First argument must be the option internal id or the option name.

The following should reproduce the error:

var Curl = require('node-libcurl').Curl

curl = new Curl()
curl.setOpt(Curl.option.VERBOSE, true)
curl.setOpt(Curl.option.URL, "sftp://user:[email protected]")
curl.setOpt(Curl.option.SSH_AUTH_TYPES, Curl.ssh_auth.PASSWORD)
curl.perform()

NodeJS 0.12 compilation error

Got this error while doing npm update on nodejs 0.12.1 and 0.12.7

/
> [email protected] install /home/druidvav/tracker/node_modules/curl-browser/node_modules/node-libcurl
> node tools/retrieve-win-deps && node-gyp rebuild

child_process: customFds option is deprecated, use stdio instead.
make: Entering directory `/home/druidvav/tracker/node_modules/curl-browser/node_modules/node-libcurl/build'
  CXX(target) Release/obj.target/node-libcurl/src/node_libcurl.o
  CXX(target) Release/obj.target/node-libcurl/src/Easy.o
  CXX(target) Release/obj.target/node-libcurl/src/Share.o
  CXX(target) Release/obj.target/node-libcurl/src/Multi.o
../src/Multi.cc: In lambda function:
../src/Multi.cc:32:160: error: ‘this’ was not captured for this lambda function
make: *** [Release/obj.target/node-libcurl/src/Multi.o] Error 1
make: Leaving directory `/home/druidvav/tracker/node_modules/curl-browser/node_modules/node-libcurl/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2

Segfault with ftp get

Hi, I'm just trying to do a simple FTP get and hitting a segfault on Ubuntu 14.04.3 LTS with Node 0.10.40 and libcurl 7.35.0.

It works locally on my macbook (osx 10.10.5 / node 0.10.40 / libcurl 7.43.0)

From poking around other segfault issues reported here, it's clear they are very hard to reproduce.

Here's what I use to trigger the error. The ftp host and credentials have been swapped out for dummy credentials.

var Curl, curl;

Curl = require('node-libcurl').Curl;

curl = new Curl;

curl.setOpt(Curl.option.URL, "ftp://dummyuser:[email protected]/feed.csv");

curl.setOpt(Curl.option.VERBOSE, 1);

curl.setOpt(Curl.option.DEBUGFUNCTION, require('./debug')); // returns the debug function from node-libcurl examples

curl.on('end', function() {
  return console.log(arguments, curl.getInfo(Curl.info.SIZE_DOWNLOAD));
});

curl.perform();

Which results in a segfault just as the transfer is about to begin.

Hostname was NOT found in DNS cache

  Trying x.x.x.x...

Connected to inbound.acme.com (x.x.x.x) port 21 (#0)

-- RECEIVING HEADER:
220 Acme LLC

-- SENDING HEADER:
USER dummyuser

-- RECEIVING HEADER:
331 Please specify the password.

-- SENDING HEADER:
PASS dummypass

-- RECEIVING HEADER:
230 Login successful.

-- SENDING HEADER:
PWD

-- RECEIVING HEADER:
257 "/"

Entry path is '/'

-- SENDING HEADER:
PASV

Connect data stream passively

ftp_perform ends with SECONDARY: 0

-- RECEIVING HEADER:
227 Entering Passive Mode (x,x,x,x,159,192).

Hostname was NOT found in DNS cache

  Trying x.x.x.x...

Connecting to x.x.x.x (x.x.x.x) port 40000

PID 14645 received SIGSEGV for address: 0x1c81
/home/dev/workspace/myapp/node_modules/segfault-handler/build/Release/segfault-handler.node(+0x1973)[0x7f0a0c176973]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10340)[0x7f0a15665340]
/usr/lib/x86_64-linux-gnu/libcurl.so.4(+0x3042c)[0x7f0a14e3a42c]
/usr/lib/x86_64-linux-gnu/libcurl.so.4(+0x30cca)[0x7f0a14e3acca]
/usr/lib/x86_64-linux-gnu/libcurl.so.4(+0x335be)[0x7f0a14e3d5be]
/usr/lib/x86_64-linux-gnu/libcurl.so.4(curl_multi_socket_action+0x17)[0x7f0a14e3d627]
/home/dev/workspace/myapp/node_modules/node-libcurl/lib/binding/node_libcurl.node(_ZN11NodeLibcurl5Multi8OnSocketEP9uv_poll_sii+0x4d)[0x7f0a1508755d]
/home/dev/.nvm/v0.10.40/bin/node(uv__io_poll+0x300)[0x9e5a40]
/home/dev/.nvm/v0.10.40/bin/node(uv_run+0xd8)[0x9d9398]
/home/dev/.nvm/v0.10.40/bin/node(_ZN4node5StartEiPPc+0x16c)[0x9853ec]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)[0x7f0a152b1ec5]
/home/dev/.nvm/v0.10.40/bin/node(cos+0x129)[0x5a54a9]

So whatever is going wrong is happening in NodeLibcurl::Multi::OnSocket(uv_poll_s*, int, int) I guess but I'm not sure how to debug any further than that.

Any help anyone could offer would be greatly appreciated. Let me know if I need to provide any more information for context.

Build failing on OS X Yosemite

Attempting to install with node v0.10.35 I get the following errors:

> [email protected] install /Users/james/path-to-my-project/node_modules/node-libcurl
> node tools/retrieve-win-deps && node tools/generate-stubs && node-gyp rebuild

  CXX(target) Release/obj.target/node-libcurl/src/node-libcurl.o
  CXX(target) Release/obj.target/node-libcurl/src/Curl.o
In file included from ../src/Curl.cc:11:
../src/generated-stubs/curlAuth.h:5:10: warning: implicit conversion from 'unsigned long' to 'int32_t' (aka 'int') changes value from 18446744073709551599 to -17
      [-Wconstant-conversion]
        {"ANY", CURLAUTH_ANY},
        ~       ^~~~~~~~~~~~
/usr/include/curl/curl.h:640:32: note: expanded from macro 'CURLAUTH_ANY'
#define CURLAUTH_ANY          (~CURLAUTH_DIGEST_IE)
                               ^~~~~~~~~~~~~~~~~~~
In file included from ../src/Curl.cc:11:
../src/generated-stubs/curlAuth.h:6:14: warning: implicit conversion from 'unsigned long' to 'int32_t' (aka 'int') changes value from 18446744073709551598 to -18
      [-Wconstant-conversion]
        {"ANYSAFE", CURLAUTH_ANYSAFE},
        ~           ^~~~~~~~~~~~~~~~
/usr/include/curl/curl.h:641:32: note: expanded from macro 'CURLAUTH_ANYSAFE'
#define CURLAUTH_ANYSAFE      (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE))
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/Curl.cc:188:68: error: use of undeclared identifier 'nullptr'
    Curl::ExportConstants( &authObj, curlAuth, sizeof( curlAuth ), nullptr, nullptr );
                                                                   ^
../src/Curl.cc:189:68: error: use of undeclared identifier 'nullptr'
    Curl::ExportConstants( &httpObj, curlHttp, sizeof( curlHttp ), nullptr, nullptr );
                                                                   ^
../src/Curl.cc:190:71: error: use of undeclared identifier 'nullptr'
    Curl::ExportConstants( &pauseObj, curlPause, sizeof( curlPause ), nullptr, nullptr );
                                                                      ^
../src/Curl.cc:191:83: error: use of undeclared identifier 'nullptr'
    Curl::ExportConstants( &protocolsObj, curlProtocols, sizeof( curlProtocols ), nullptr, nullptr );
                                                                                  ^
../src/Curl.cc:605:51: error: unknown class name 'false_type'; did you mean '__false_type'?
template <typename> struct ResultCanBeNull : std::false_type {};
                                                  ^~~~~~~~~~
                                                  __false_type
/usr/include/c++/4.2.1/bits/cpp_type_traits.h:98:10: note: '__false_type' declared here
  struct __false_type { };
         ^
../src/Curl.cc:606:50: error: unknown class name 'true_type'; did you mean '__true_type'?
template <> struct ResultCanBeNull<char*> : std::true_type {};
                                                 ^~~~~~~~~
                                                 __true_type
/usr/include/c++/4.2.1/bits/cpp_type_traits.h:97:10: note: '__true_type' declared here
  struct __true_type { };
         ^
../src/Curl.cc:623:40: error: no member named 'value' in 'ResultCanBeNull<char *>'
    if ( ResultCanBeNull<TResultType>::value && !result ) //null pointer
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
../src/Curl.cc:1057:24: note: in instantiation of function template specialization 'Curl::GetInfoTmpl<char *, v8::String>' requested here
        retVal = Curl::GetInfoTmpl<char*, v8::String>( *(obj), infoId );
                       ^
../src/Curl.cc:623:40: error: no member named 'value' in 'ResultCanBeNull<long>'
    if ( ResultCanBeNull<TResultType>::value && !result ) //null pointer
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
../src/Curl.cc:1062:24: note: in instantiation of function template specialization 'Curl::GetInfoTmpl<long, v8::Integer>' requested here
        retVal = Curl::GetInfoTmpl<long, v8::Integer>(  *(obj), infoId );
                       ^
../src/Curl.cc:623:40: error: no member named 'value' in 'ResultCanBeNull<double>'
    if ( ResultCanBeNull<TResultType>::value && !result ) //null pointer
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
../src/Curl.cc:1067:24: note: in instantiation of function template specialization 'Curl::GetInfoTmpl<double, v8::Number>' requested here
        retVal = Curl::GetInfoTmpl<double, v8::Number>( *(obj), infoId );
                       ^
2 warnings and 9 errors generated.
make: *** [Release/obj.target/node-libcurl/src/Curl.o] Error 1

Build failed

During build I've got an error described bellow

string_format.cc
..\src\string_format.cc(11): error C2220: warning treated as error - no 'object' file generated [\node_modules\node-libcurl\build\node-libcurl.vcxproj]
..\src\string_format.cc(11): warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data [\node_modules\node-libcurl\build\node-libcurl.vcxpro
j]
..\src\Curl.cc(474): error C2220: warning treated as error - no 'object' file generated [\node_modules\node-libcurl\build\node-libcurl.vcxproj]
..\src\Curl.cc(474): warning C4267: '+=' : conversion from 'size_t' to 'int', possible loss of data [\node_modules\node-libcurl\build\node-libcurl.vcxproj]
..\src\Curl.cc(483): warning C4267: '+=' : conversion from 'size_t' to 'int', possible loss of data [\node_modules\node-libcurl\build\node-libcurl.vcxproj]
..\src\Curl.cc(740): warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data [\node_modules\node-libcurl\build\node-libcurl.vcxproj]

Env: Win 7 x64, VS 2013 update 4, python 2.7.9, node 0.10.34, npm 1.4.28

It's strange because i don't have any issues on Win 8.1 32bit, VS 2013 update 4. I have no idea how to fix this issue.

why use EventEmitter for "data" and "header" messages?

The original intent of the cURL callbacks CURLOPT_HEADERFUNCTION and CURLOPT_WRITEFUNCTION was to give the user the option to return an integer indicating an error status. Thus, one could terminate a transfer early if an unexpected header appeared from the server or some bad data appeared. This is one thing that the original node-curl actually got right.

What you have done is used the EventEmitter API instead, which does not allow the user to give this feedback back to the cURL API. I respect "nodifying" cURL and using these standard classes, it but you are losing part of the original API in the process. And unfortunately that breaks my existing code.

Is it really your intention to just return chunk.length in Curl.prototype._onHeader no matter what?

Installation error Cannot find curl's header file.

Hi,

Using Node version v0.10.23
When i run this command:
npm install node-libcurl

i get the following error:
Cannot find curl's header file.
npm ERR! [email protected] install: node tools/retrieve-win-deps && node tools/generate-stubs && node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the node-libcurl package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node tools/retrieve-win-deps && node tools/generate-stubs && node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls node-libcurl
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.8.0-34-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! cwd /var/www/piggybaq
npm ERR! node -v v0.10.23
npm ERR! npm -v 1.3.17
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /var/www/piggybaq/npm-debug.log
npm ERR! not ok code 0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.