so, For a while I've been wondering, could I make a *really* simple proxy?
Although in http 1.1 multiple requests may be made in the same tcp connection, a well behaved client is not allowed to make requests to different hosts in the same connection, so this begs the question: is it necessary to properly parse http? as long as you can parse the first header, and then connect the tcp stream to the right place... then every thing should just work, including WebSockets. It was marak who originally suggested this idea to me. so, today I actually tried it... and it looks like: IT WORKED!!! https://github.com/dominictarr/badass npm install badass I've implemented just enough to make a load-balancer with sticky sessions. basically it just matches the text before the first empty line. pulls out the headers with a few regexps, and then just sends the rest through as buffers. it also extracts the first header on the response, so you can force a cookie to get sticky sessions. it's only about 100 lines, and it does next to nothing to the tcp stream, so it should be really fast. but I havn't benchmarked it yet. also, I havn't written a detailed test suite that cover all the error paths. (connections unexpectedly closing etc) There are some things that will never do, like, deliver it's own error messages. But thats okay. I'm trying to be ruthlessly simple. If you want a fully featured proxy, use something else. cheers, Dominic -- 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 nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en