Skip to content
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

Add support for HTTP1 communications to the Networking API #137

Open
14 tasks
rdw-software opened this issue Dec 7, 2022 · 2 comments
Open
14 tasks

Add support for HTTP1 communications to the Networking API #137

rdw-software opened this issue Dec 7, 2022 · 2 comments

Comments

@rdw-software
Copy link
Member

rdw-software commented Dec 7, 2022

Goals:

  • Can perform HTTP requests (via a new HttpClient module) on top of the existing TcpClient implementation
  • Can create HTTP servers (via a new HttpServer module) on top of the existing TcpServer implementation
  • Spec compliance is tested for the latest HTTP/1.1 RFCs

Roadmap:

Non-goals:

  • TLS/HTTPS support (separate issue)
  • Streaming APIs (required for large files): Buffering is easier to use and sufficient for now, the rest can be built on top
  • Caching (RFC 9111): Not really necessary, nginx/apache are likely better solutions where this is needed
@rdw-software
Copy link
Member Author

rdw-software commented Dec 7, 2022

This is just to formalize the requirements after building a couple of different prototypes. Requires #90 (mostly done, needs cleanup).

As for performance, I am using llhttp-native-c and llhttp-ffi as the maximum (both 1 GB/s on my desktop) and luvit (pure Lua, measured at 20-25 MB/s on the same machine) as the minimum. It is clear that the requirement of providing a user-friendly API is directly at odds with reducing overhead, and a streaming API on top of that will also be less user-friendly by default.

For this issue, I will limit the scope to a basic, buffering and somewhat inefficient implementation that is sufficient to proceed with the WebSocket protocol support. Streaming can be performed by simply overriding the event handlers (and then creating async write requests via libuv), while reducing the memory footprint is possible by disabling the FFI layer's event buffering (which comes with other drawbacks). I doubt there's a perfect solution, or even one that fulfills most of the requirements, here.

@rdw-software
Copy link
Member Author

Blocked by #168, since hacking in the URL parsing logic required for some of the RFC specs doesn't seem like a good idea.

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

No branches or pull requests

1 participant