GithubHelp home page GithubHelp logo

Comments (6)

JCMais avatar JCMais commented on July 3, 2024

Hi.

Can you post a code sample of what you are trying to accomplish?

from node-libcurl.

nytr0gen avatar nytr0gen commented on July 3, 2024

i've took the proxies from http://proxylist.hidemyass.com/

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

var opts = {
    headers: {
        'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
        'Accept-Encoding': 'gzip, deflate',
        'Accept-Language': 'en-US,en;q=0.8',
        'Connection': 'keep-alive',
        'User-Agent': 'Mozilla/5.0 (Windows NT 6.4; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2225.0 Safari/537.36'
    }
};
// this works https + socks5
// opts.url = 'https://www.yahoo.com';
// opts.proxy = 'socks5h://46.4.88.203:9050';

// this doesn't work. https + proxy. i get a timeout. on this proxy or any other http proxy
opts.url = 'https://www.yahoo.com';
opts.proxy = '220.255.3.170:80';

// but this works. http + proxy
// opts.url = 'http://www.yahoo.com';
// opts.proxy = '220.255.3.170:80';

var curl = new Curl();
var curlOpts = {};
curlOpts['CUSTOMREQUEST'] = 'GET';
curlOpts['URL'] = opts.url;
curlOpts['CONNECTTIMEOUT_MS'] = 30000;
curlOpts['FOLLOWLOCATION'] = false;
curlOpts['ACCEPT_ENCODING'] = 'gzip';
curlOpts['PROXY'] = opts.proxy;
curlOpts['HTTPHEADER'] = [];
for (let key in opts.headers) {
    curlOpts['HTTPHEADER'].push(key + ': ' + opts.headers[key]);
}

for (let key in curlOpts) {
    curl.setOpt(Curl.option[key], curlOpts[key]);
}

curl.on('end', function (statusCode, body, headers) {
    console.log(statusCode, headers);
    curl.close();
});

curl.on('error', function(err, errCode) {
    console.error(err);
    curl.close();
});

curl.perform();

from node-libcurl.

JCMais avatar JCMais commented on July 3, 2024

Still investigating this, but already exhausted the time I had this week, gonna debug more next week.

From what I can see the socket is closed before the connection is made. I'm trying to understand what is going on.

from node-libcurl.

JCMais avatar JCMais commented on July 3, 2024

Ok, looks like the issue was with libcurl itself, it was probably because of this bug http://sourceforge.net/p/curl/bugs/1492/, fixed here curl/curl@852d35b6ea.

If you are wondering why it doesn't happens when using the curl tool, it's probably because the tool itself doesn't uses the multi interface, while this binding does.

Try using a version of libcurl > 7.42

from node-libcurl.

nytr0gen avatar nytr0gen commented on July 3, 2024

thank you :)

from node-libcurl.

hashtafak avatar hashtafak commented on July 3, 2024

I just comment to explain the code using port 80 proxy mean http proxy, not https proxy (port 443)
So the proxy server will not accept https method. Am i right?

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.