GithubHelp home page GithubHelp logo

Set header about node-libcurl HOT 7 CLOSED

gerasimvol avatar gerasimvol commented on June 24, 2024
Set header

from node-libcurl.

Comments (7)

JCMais avatar JCMais commented on June 24, 2024

Can you post a example? Also, what is the module and curl version.

from node-libcurl.

gerasimvol avatar gerasimvol commented on June 24, 2024

For example, I have frontend with IP: mail.example.com and backend IP: 192.168.0.15:80

I set curl.setOpt( 'URL', 192.168.0.15:80 ); to check accessibility to this IP, but also I want to set in header: curl.setOpt( 'CURLOPT_HTTPHEADER', ['Host: ' + mail.example.com]);

Host: mail.example.com

(https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html) search for 'host'

from node-libcurl.

JCMais avatar JCMais commented on June 24, 2024

The option is correct, enable verbose mode and see if there is any output: curl.setOpt( 'VERBOSE', true );

from node-libcurl.

JCMais avatar JCMais commented on June 24, 2024

Oh, I missed something about your report.

curl.setOpt( 'CURLOPT_HTTPHEADER', ['Host: ' + frontend]);

This should be:

curl.setOpt( 'HTTPHEADER', ['Host: ' + frontend]);

or

curl.setOpt( Curl.option.HTTPHEADER, ['Host: ' + frontend]);

from node-libcurl.

gerasimvol avatar gerasimvol commented on June 24, 2024

Yes! Such a dump mistake. Thanks!

from node-libcurl.

gerasimvol avatar gerasimvol commented on June 24, 2024

curl.setOpt( 'VERBOSE', true ); log in console. Is it posible to save log in string or file?

from node-libcurl.

JCMais avatar JCMais commented on June 24, 2024

That would be the STDERR option of libcurl, but it's not implemented, you can use the debug callback to get the information as strings. Example: https://github.com/JCMais/node-libcurl/blob/develop/examples/debug-callback.js

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.