Oh, and don't forget the semi-colons : ) On Tuesday, June 4, 2013 5:24:04 AM UTC, Tim Oxley wrote: > > Hey simon :D So I have my own 'bouncy', but I think you're on the right > track, I should just figure out how bouncy works, or just use bouncy. > > > On Monday, 3 June 2013 16:04:20 UTC+8, Simon wrote: >> >> Hey Tim! >> >> Sounds like what you're after is Substack's Bouncy: >> https://github.com/substack/bouncy >> >> I believe it will extract the HTTP headers from the raw TCP stream (which >> you can use for authentication), then "bounce" the raw stream to another >> TCP socket or remote endpoint. >> >> From the docs: >> "`bounce(stream, opts={})` Call this function when you're ready to bounce >> the request to a stream. The exact request that was received will be >> written to stream and future incoming data will be piped to and from it." >> >> I would inspect the headers and then either bounce to a local HTTP server >> that sends 401/403 or else bounce to the "actual" HTTP servers if >> authenticated. >> >> Cheers, >> Simon >> >> >> On Sunday, June 2, 2013 4:57:40 AM UTC, Tim Oxley wrote: >>> >>> I'm trying to use a module like >>> http-auth<https://github.com/gevorg/http-auth/> to >>> centrally auth HTTP traffic before piping it along to "actual" HTTP servers >>> via TCP stream. >>> >>> Ideally, I could do something like: >>> >>> net.createServer(function(sock) { >>> sock.pipe(httpAuth).pipe(remoteHTTP) *// thus remoteHTTP's traffic is >>> always authenticated* >>> }).listen(9798) >>> >>> var remoteHTTP = net.connect(6788)* // some HTTP service* >>> >>> But the problem is http-auth expects to be passed a req, res: >>> >>> var auth = require('http-auth')var basic = auth({ >>> authRealm : "Private area.", >>> authList : ['mia:{SHA}x511ncXd+4fOnYAotcGPFD0peYo=']}); >>> http.createServer(function(req, res) { >>> // Apply authentication to server. >>> basic.apply(req, res, function(username) { >>> // Your request handling logic goes there >>> res.end("Welcome to private area - " + username + "!"); >>> });}).listen(1337); >>> >>> Is there any way to convert a net stream into a format that could be >>> handled by something like http-auth? Or another way to do http digest auth >>> without interrupting the streams? >>> >>
-- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
