Cloud not return auth error to http tunnel stream #22

Ifnot opened this Issue Mar 4, 2013 · 5 comments

2 participants


I am working on a proxy witch allow HTTP Tunneling.

The http-auth module return the authentication result using http.ServerResponse.setHeader on the response object (normally given by a http.createServer).

However, using an http tunnel the response object is not a http.ServerResponse but only a stream.

The solution is to write back full headers using stream.write instead of http.ServerResponse.setHeader.

I could make a pull request for implementing the trick if you want.

http-auth member

Hi Anael,

Please submit code snippet with example, also if you can make pull request with a fix that would be great. Thanks, Gevorg


Hi Gevorg,

This is a snippet showing a part of my proxy app :

I confess my pull is not beautiful but the fix is working on my proxy !

http-auth member

Anael, I would suggest to wrap sockResp into new object where you can implement setHeader, writeHead, end methods and then pass it to http-auth lib. Gevorg

@gevorg gevorg closed this Mar 4, 2013

Hum yeah it will be a acceptable method for me.

However I thought that a function for allowing direct http stream will be nice : many examples of proxies snippets implements HTTPS / Tunneling like my app.

Considering you handle proxies responses codes in your module maybe it will be usefull for proxies applications to have a flexible way for writing responses :)

http-auth member

Thanks for suggesting a patch, I think would be better not to extend http-auth for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment