GithubHelp home page GithubHelp logo

Comments (11)

aacerox avatar aacerox commented on June 20, 2024

Hi

First of all many thanks for your support words, they're very kind ;)

I think I've an easy solution to your problem and most important - at least to me - that won't break compatibility with previous node-rest-client versions.

I'll try to apply it in the next few days (probably on next monday it will be ready), keep an eye.

from node-rest-client.

aacerox avatar aacerox commented on June 20, 2024

Hi as you can see it has not been fixed "on next monday".... :(

I'll try to fix it asap

sorry for the delay.

from node-rest-client.

super132 avatar super132 commented on June 20, 2024

No need to sorry, thanks :)
Actually I can help fix it and send you a pull request if you don't mind

from node-rest-client.

aacerox avatar aacerox commented on June 20, 2024

I'm already fixing the issue, but of course you can do a pull request whenever you want. Surely it will help me.

just one question, the request that works and you mention in your previous comment was done directly with http client for node.js and not using node-rest-client?

Thanks

from node-rest-client.

aacerox avatar aacerox commented on June 20, 2024

Well I think I've fix it. As you can see in the new version of the docs there's a new parameter in proxy options "tunnel:true | false". So if you want to use direct request to proxy instead of tunneling you must instantiate the client with "tunnel:false" (to maintain backward compatibility I couldn't set direct request to proxy as default proxy connection method)

var RestClient = require('node-rest-client').Client, 
    client = new RestClient({
        proxy:{
            host:"proxyDomain",
            port: 8080,
            user:"username",
            password:"password",
            tunnel:false // use direct request to proxy
        }
    });

client.registerMethod("jsonMethod", "http://ogcef.one.gov.hk/event-psi/json/calendar/20140215.json", "GET");

client.methods.jsonMethod(function (data, response) {...});

I've tested and for me it's working, please let me know whether it works for you too.
Bye

from node-rest-client.

super132 avatar super132 commented on June 20, 2024

Thanks. It works like a charm. :)

Would you please release it to NPM repository also? Thanks a lot.

from node-rest-client.

aacerox avatar aacerox commented on June 20, 2024

That's what I'm trying since yesterday, but I'm having unexpected authentication problems with npm registry (?!??).

Hope that it'll be fixed soon

from node-rest-client.

aacerox avatar aacerox commented on June 20, 2024

I've had to reinstall node and npm and now everything seems to work again, but please if you don't mind let me know whether it works for you.

Thanks.

from node-rest-client.

toddzebert avatar toddzebert commented on June 20, 2024

Hey guys, thanks so much for this module - it's made my first forray into Node a lot easier.

But, I was running 0.7.7 and I happened to be combining projects and ran npm install in a new directory, and got version 0.7.9 (had "node-rest-client" : "~0.7.7"), and I noticed the commit associated with this issue.

And I got this error:

$ nodemon server.js
21 Feb 14:50:44 - [nodemon] v1.0.15
21 Feb 14:50:44 - [nodemon] to restart at any time, enter `rs`
21 Feb 14:50:44 - [nodemon] watching: *.*
21 Feb 14:50:44 - [nodemon] starting `node server.js`
connect.multipart() will be removed in connect 3.0
visit https://github.com/senchalabs/connect/wiki/Connect-3.0 for alternatives
connect.limit() will be removed in connect 3.0

...live/node_modules/node-rest-client/lib/node-rest-client.js:14
    self.useProxyTunnel = self.options.proxy.tunnel===undefined?true:self.options
                                            ^
TypeError: Cannot read property 'tunnel' of undefined
    at new exports.Client (.../live/node_modules/node-rest-client/lib/node-rest-client.js:14:42)
    at Object.<anonymous> (.../live/server/routes.js:10:10)
    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 Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (.../live/server.js:39:1)
    at Module._compile (module.js:456:26)
21 Feb 14:50:52 - [nodemon] app crashed - waiting for file changes before starting...

I reverted to 0.7.7 and it worked.

server.js:39 is:

require('./server/routes.js')(app, passport);

routes.js:10 is the client = line below:

var    passport = require('passport'),
       Client   = require('node-rest-client').Client;

var host = "https://my.host";

var options_auth = {user    : "my-user",
                    password: "my-pw"
                    };

client = new Client(options_auth);

Hopefully this is helpful.

Thanks.

from node-rest-client.

super132 avatar super132 commented on June 20, 2024

Yes, direct proxy connection works for me. Thanks.

from node-rest-client.

HarshaJagadish avatar HarshaJagadish commented on June 20, 2024

Hello @aacerox ,
I know its been a long time since this issue was fixes but I am still facing issue. The client is unable to complete the request when inside a proxy. The SSL hand shake fails to connect to the server. below is my set up for the proxy
options_proxy = { proxy: { host: "<My ip>", port: 8888, tunnel: true } }; globalproxySet = true; client = new Client(options_proxy);

I have the client response as follows after the set up

EventEmitter { options: { proxy: { host: '<my local IP>', port: 8888, tunnel: true } }, useProxy: true, useProxyTunnel: true, proxy: { host: '<My IP>', port: 8888, tunnel: true }, connection: {}, mimetypes: {}, requestConfig: {}, responseConfig: {}, methods: {}, parsers: { add: [Function], remove: [Function], find: [Function], getAll: [Function], getDefault: [Function], clean: [Function] }, serializers: { add: [Function], remove: [Function], find: [Function], getAll: [Function], getDefault: [Function], clean: [Function] }, get: [Function], post: [Function], put: [Function], delete: [Function], patch: [Function], registerMethod: [Function], unregisterMethod: [Function], addCustomHttpMethod: [Function] }

I am using Charles for proxy settings. Please let me know what am I doing wrong.

from node-rest-client.

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.