Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem behind a Proxy with Tunnel #194

Open
Tim74 opened this issue Jul 20, 2018 · 4 comments
Open

Problem behind a Proxy with Tunnel #194

Tim74 opened this issue Jul 20, 2018 · 4 comments

Comments

@Tim74
Copy link

Tim74 commented Jul 20, 2018

Hi,

We found an issue while using your module behind a proxy.
In your code, in the function proxy, you register proxyTunnel to the connect event.

 // creare a new proxy tunnel, and use to connect to API URL
var proxyTunnel = http.request(options.proxy), self = this;
proxyTunnel.on('connect',function(res, socket, head){
  debug("proxy connected",socket); ...

But in the follow-redirects module, the connect event is not managed:

// Create handlers that pass events from native requests
var eventHandlers = Object.create(null);
["abort", "aborted", "error", "socket", "timeout"].forEach(function (event) {
  eventHandlers[event] = function (arg) {
    this._redirectable.emit(event, arg);
  };
});

Therefore, you never receive the connect event and the code is never triggered.

To fix this, I just added the following lines in the node-modules/follow-redirects/index.js file to manage the connect event.

eventHandlers["connect"] = function (req, cltSocket, head) {
  this._redirectable.emit("connect", req, cltSocket, head);
};

I know the problem is not in your module.
It's just to let you know.

Regards & Thanks for this module !

@RubenVerborgh
Copy link

Fixed in follow-redirects/follow-redirects#118.
In the future, please considering notifying the original projects when such bugs are discovered, then we can fix them sooner 😉

@Tim74
Copy link
Author

Tim74 commented Sep 6, 2019

Hi.
What do you mean by "notifying the original project" ?
I though creating an Issue here was the right place.

Sorry but I'm beginner in using GitHub

@RubenVerborgh
Copy link

RubenVerborgh commented Sep 6, 2019

The bug you have identified above, is—as you write—a problem in the follow-redirects module. Since the bug was not reported with follow-redirects, I could not fix it.

Yesterday I got notified about this issue in follow-redirects/follow-redirects#118, and I fixed it today.

So if in the future you find bugs in other modules, you might want to report them in those other modules so that they can get fixed faster.

@Tim74
Copy link
Author

Tim74 commented Sep 6, 2019

You're right.
I understood now.
I was not aware to be in the wrong place because I don't use your module by myself.
I did correct the issue for one of my colleague and report it to you based on what he gave me.
I will be more attentive to that next time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants