This is the code: 
https://github.com/JCMais/node-libcurl/blob/develop/src/Curl.cc#L938

It's a binding for Node.js.

I cannot put the whole code here in context. But the binding for the reset 
method is basically just:

    curl_easy_reset( obj->curl );

Where obj->curl is a pointer to the curl handler in question.


However, looks like it's not resetting the handler, I tested it doing a 
request, resetting it, and calling perform immediately after (the perform 
method adds the handler to the internal multi curl instance).

Expected result: An error is thrown, because there is no url set for given 
handler.
Current result: It does another request to the url set previously.

Code to test if anyone is willing to do so (need to have node.js installed, and 
node-libcurl, npm install node-libcurl):

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

var curl = new Curl(),
    url = process.argv[2] || 'http://www.google.com',
    firstRun = true;

//you can use a string as option
curl.setOpt( 'URL', url );
curl.setOpt( Curl.option.VERBOSE, true );

curl.on( 'end', function ( statusCode, body, headers ) {

    if ( !firstRun )
        throw Error( "Reset didn't worked." );

    firstRun = false;

    this.reset();

    this.perform();

});

curl.on( 'error', function ( err, curlErrCode ) {

    console.error( 'Err: ', err );
    this.close();
});

curl.perform();


Jonathan Cardoso Machado [JCM]
Full-stack Web Developer 
                                          
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to