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.
Please submit code snippet with example, also if you can make pull request with a fix that would be great. Thanks, Gevorg
This is a snippet showing a part of my proxy app : https://gist.github.com/AnaelFavre/5081848
I confess my pull is not beautiful but the fix is working on my proxy !
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
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 :)
Thanks for suggesting a patch, I think would be better not to extend http-auth for now.