-
Notifications
You must be signed in to change notification settings - Fork 2
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
dhttp: A simple production-ready HTTP server library for the 2020s #6
Conversation
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.
This looks really good, thanks!! My comments are pretty much entirely about docs and comments (shocking, I know) so let me preface the whole review by saying that I look forward to seeing Ambassador switch to using it. 🙂
Approving since everything I have can easily be addressed later.
@@ -73,9 +73,9 @@ func ListenAndServeHTTPSWithContext(ctx context.Context, server *http.Server, ce | |||
// server.Shutdown() when the soft Context is canceled, and the hard Context being canceled causes | |||
// the .Shutdown() to hurry along and kill any live requests and return, instead of waiting for them | |||
// to be completed gracefully. | |||
func ServeHTTPWithContext(ctx context.Context, server *http.Server, listener net.Listener) error { | |||
func ServeHTTPWithContext(ctx context.Context, server *http.Server, ln net.Listener) error { |
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.
It makes me sad that the code switched from listener
to ln
for the variable name, instead of the docs changing from ln
to listener
. 😂
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.
Looks really good to me.
A while back, because of a test flake that @thallgren noticed, I became aware of a bug in the
x/net/http2/h2c
library, which I subsequently submitted a fix for. However, while figuring out that bug, I became aware of a growing amount of things that were "wrong", in deep-seated architectural ways I couldn't just file a PR for. It became apparent to me that using*http.Server
was simply unacceptable if you're doing h2c (cleartext HTTP/2... every one of our products does h2c all over the place), in a way that couldn't be fixed without changing the API.So, I introduce
*github.com/datawire/dlib/dhttp.ServerConfig
, a replacement for*net/http.Server
(it still ultimately uses an*http.Server
internally, but that's an implementation detail).The godoc has a lot better introduction/rationale.
Each of the
TextXXX
functions that I added corresponds to an actual bug in either Telepresence or AES or both.To review
I suggest first reading the final godocs, to get the big picture. Then review the implementation commit-by-commit (if you even want to review the implementation).
Because of import-cycle reasons, I created
derror
, and movedPanicToError
to there fromdutil
. This means thatdutil
now only exists for backward compatibility with older versions of dlib.