Skip to content

Add HTTP2 and Allow Custom Handlers #7

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

michaelg100
Copy link

@michaelg100 michaelg100 commented Jul 14, 2024

Was curious about integrating gRPC with the service this is just a few changes to make possible and then the example:

https://github.com/michaelg100/caesar-start-kit-gprc/tree/main

for actual testing checked by replacing with local in the start kit.

replace github.com/caesar-rocks/core => /../local/core

One note for the http2:

If a request is an h2c connection, it's hijacked and redirected to s.ServeConn. Otherwise the returned Handler just forwards requests to h. This works because h2c is designed to be parseable as valid HTTP/1, but ignored by any HTTP server that does not handle h2c. Therefore we leverage the HTTP/1 compatible parts of the Go http library to parse and recognize h2c requests. Once a request is recognized as h2c, we hijack the connection and convert it to an HTTP/2 connection which is understandable to s.ServeConn. (s.ServeConn understands HTTP/2 except for the h2c part of it.)

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

Successfully merging this pull request may close these issues.

1 participant