GithubHelp home page GithubHelp logo

Comments (7)

JCMais avatar JCMais commented on July 22, 2024
  1. Have you implemented NTLM authentication for exchange in this project?

I didn't not tested NTLM auth, it should work the way it's. Take a look into the HTTPAUTH option, the CURLAUTH_* constants are mapped to Curl.auth.* in this binding. Remember that you need a libcurl that was built with OpenSSL or GnuTLS for it to work.

When i am trying to use setOpt as below i am getting error. However it's mentioned here - http://curl.haxx.se/libcurl/c/curl_easy_setopt.html

You need to be more clear on what error it's throwing, but from the code that you posted:

curl.setOpt('ACCEPT_ENCODING', 1);

ACCEPT_ENCONDING must be a string, you are passing a number.

Also, your tittle mentions an error that is not on your description, did you fixed it?

from node-libcurl.

mozammilwy avatar mozammilwy commented on July 22, 2024

Hi

Thanks for your help. Actually i resolved the title error :). But whenever i am trying to use setOpt for the following examples-

curl.setOpt(Curl.option.SSLVERSION, 3);
curl.setOpt(Curl.option.IPRESOLVE, 1); // CURL_IPRESOLVE_V4

I am getting the follwing error-
"Error: Unknown option given. First argument must be the option internal id or the option name. You can use the Curl.option constants.
at Error (native)
at Curl.setOpt (/home/mz/mz-node-modules/node_modules_base/node_modules/node-libcurl/lib/Curl.js:529:23)"

Also when i am doing curl.setOpt(Curl.option.ACCEPT_ENCODING, 'true'), it's working but
Is it actually setting the ACCEPT_ENCODING to true?

from node-libcurl.

JCMais avatar JCMais commented on July 22, 2024

Error: Unknown option given. First argument must be the option internal id or the option name. You can use the Curl.option constants.

You are using SSLVERSION, this option was not added yet. I've just published a new version to npm with it, try version 0.6.2.

Also, don't use numbers directly, since this is error prone. Use the constants:

curl.setOpt(Curl.option.SSLVERSION, Curl.sslversion.SSLv3 );
curl.setOpt(Curl.option.IPRESOLVE, Curl.ipresolve.V4 );

Also when i am doing curl.setOpt(Curl.option.ACCEPT_ENCODING, 'true'), it's working but
Is it actually setting the ACCEPT_ENCODING to true?

Yes, which is wrong. You must pass the encoding that you expect: CURLOPT_ACCEPT_ENCONDING

Sets the contents of the Accept-Encoding: header sent in a HTTP request, and enables decoding of a response when a Content-Encoding: header is received. Three encodings are supported: identity, which does nothing, deflate which requests the server to compress its response using the zlib algorithm, and gzip which requests the gzip algorithm.

If a zero-length string is set like "", then an Accept-Encoding: header containing all built-in supported encodings is sent.

You can also opt to just include the Accept-Encoding: header in your request with CURLOPT_HTTPHEADER but then there will be no automatic decompressing when receiving data.

This is a request, not an order; the server may or may not do it. This option must be set (to any non-NULL value) or else any unsolicited encoding done by the server is ignored. See the special file lib/README.encoding for further details.

from node-libcurl.

mozammilwy avatar mozammilwy commented on July 22, 2024

Hi,

Thanks again for your help. I checked console.log(Curl.option) and found that IPRESOLVE isn't present in Curl.option. However it's mentioned here http://curl.haxx.se/libcurl/c/CURLOPT_IPRESOLVE.html . I also checked console.log(Curl.ipresolve) and found that Curl.ipresolve has all the three possible values. So i concluded that IPRESOLVE isn't present in Curl.option however its corresponding values are present in Curl.ipresolve. Not sure but 'IPRESOLVE' might be missing from Curl.cc

Currently i am getting error on
curl.setOpt(Curl.option.IPRESOLVE, Curl.ipresolve.V4);
and the error is
"/home/mz/mz-node-modules/node_modules_base/node_modules/node-libcurl/lib/Curl.js:847
or the option name. You can use the Curl.option constants.' : Easy.strError(
^
Error: Unknown option given. First argument must be the option internal id or the option name. You can use the Curl.option constants.
at Error (native)
at Curl.setOpt (/home/mz/mz-node-modules/node_modules_base/node_modules/node-libcurl/lib/Curl.js:847:190)
at Object. (/home/mz/mz/programs/dragon/repo/releases/20151001074739/src/test/imap_smtp_connect_check/node-libcurl-test-2.js:23:6)"

from node-libcurl.

JCMais avatar JCMais commented on July 22, 2024

Sorry, forgot again to add this one. It should work now! 😅

Try v0.6.3

from node-libcurl.

mozammilwy avatar mozammilwy commented on July 22, 2024

Thanks a lot for your help. Now everything is working fine my side. One last thing. For one exchange account i set 'HTTPAUTH' as NTLM (8) and it failed then i tried with BASIC(1) and it worked. I was using 9 for NTLM or BASIC authentication in node-curl. Can i use it for node-libcurl also?

Also i am closing curl in our code in on 'end' and on 'error' as below.

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

_curl.close();
// Error: "Cannot read property 'close' of undefined".

and also what is this.close() means in your example code.

from node-libcurl.

JCMais avatar JCMais commented on July 22, 2024

In reality those values are bitmasks, if you want to try more than one auth method, you should OR them together, like this:

curl.setOpt( 'HTTPAUTH', Curl.auth.BASIC | Curl.auth.NTLM );

Note the | (bitwise OR) operator.

Closing this as it's resolved, feel free to ask any questions if you have.

from node-libcurl.

Related Issues (20)

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.