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
Http codec #523
Http codec #523
Conversation
Why not http_parser? |
I'm trying to minimize the number of C bindings we depend on. Luvit itself is not allowed to have any C bindings to simplify the build process. All bindings are restricted to the luvi layer and I want luvi to be as minimal as possible. If there was an existing high-quality implementation of tls in lua, I would have used that instead of openssl bindings. Same for zlib stuff. But HTTP is pretty trivial (relatively) to implement in pure lua and still has great performance (I'm getting around 100k reqs/second with this branch on my laptop). Also this new http implementation is platform and stream agnostic so it could be easily adapted into other lua frameworks. |
Also having as much as possible in the luvit layer makes it easier for people to customize their own project. It keeps things on a level playing field and makes it trivial to add http2 as a pure-lua pull-request should someone want to do that. One of the main goals with luvit 2.0 (the luvi-up branch) is to make contribution and customization more approachable. I want people with only experience in scripting languages and no C compiler installed on their system to be able to create their own custom luvit-like binaries with their own custom lua libraries. |
@@ -0,0 +1,44 @@ | |||
local uv = require('uv') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this out of the root directory?
b2e68a7
to
83f299f
Compare
43a23fc
to
ea7de89
Compare
This adds an implementation of the http core protocol for server and client, encoding and decoding. Included is a unit test for the codec, a sample clustering http server and a sample http client.