dlang / project-ideas

Collection of impactful projects in the D ecosystem
36 stars 12 forks source link

Resuming the progress on native HTTP/2 support #64

Closed hatf0 closed 3 years ago

hatf0 commented 4 years ago

Description

HTTP/2-compliant libraries are everywhere (several libraries already exist for Rust, Haskell, Ruby, hell, even Lisp)... however, D does not have a single production-ready & user friendly library that can be used.

Indeed, the Hunt framework does have a full implementation (and hats off to those guys), but.. from my personal experience, there's several gaping flaws with it:

vibe.d hasn't had much progress on that front either. The pull request for merging HTTP/2 into mainline vibe.d (vibe-d/vibe-d#1160) has all but stagnated in progress and has been open for 5 years now with the last activity occurring nearly a year ago.

What are rough milestones of this project?

How does this project help the D community?

HTTP/2 is vastly more efficient then the textual-based HTTP/1. This would allow for more widespread adoption of vibe.d (as vibe.d is already incredibly user-friendly and has tons of features to offer) while reducing the overhead associated with such, and providing incredible performance gains (real-world applications have seen reductions of page load times ranging from 20-80%), and would pull the web-developer segment of the community into the present. As well, with a native HTTP/2 implementation, a full native implementation of gRPC would finally be possible (as it stands, the only two are hunt-grpc and mine), allowing for better interop between languages and web services.

Recommended skills

Familiarity with the vibe.d code-base, familiarity with HTTP, grit :P

References

HTTP/2 spec libhttp2

GallaFrancesco commented 4 years ago

tl;dr: The vibe-http module supports HTTP/2 server side and can be used by pulling its dub package. The implementation lacks some features and introduces some (possibly breaking) changes with respect to the vibe-d:http codebase. This is why development has been excessively slow in the last year, yet the plan to include vibe-http as a complete replacement of the current module still holds.


During SAoC 2019 we (@s-ludwig and I) worked on a new implementation of the whole vibe-http module, which includes support for HTTP/2 server-side:

https://github.com/vibe-d/vibe-http

The codebase is compliant with the HTTP/2 RFC you are referring to. Unfortunately I currently lack the time to implement the missing features:

Moreover, the reason behind vibe-http was to improve some aspects of the current vibe-d:http codebase. For this reason, the underlying data structures implementing the HTTP server / client have been modified. This means that, for the current implementation to be included in vibe.d, a significant amount of changes must be ported from the vibe-d:http module to vibe-http.

Anyway, if you are interested in using / improving / experimenting with the library, there's a separate dub package and a fair amount of documentation (see resources).

Resources:

zoujiaqing commented 3 years ago

HTTP/2 project already exists.

hunt-http already complete support HTTP 1.1 and HTTP/2 protocols. grpc-dlang is a gRPC framework implemented entirely in D.

Resource:

dub package: https://code.dlang.org/packages/hunt-http dub package: https://code.dlang.org/packages/grpc