Documentation ¶
Overview ¶
Package http2 contains a minimal implementation of non-TLS http/2 server and client
Package http2 contains a minimal implementation of non-TLS http/2 server and client
Package http2 contains a minimal implementation of non-TLS http/2 server and client
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LogRequestWithVerbosity ¶
LogRequestWithVerbosity prints out request when the service binary is run with log_verbosity verbosity
func PercentEncode ¶
grpc-message has to be percent-encoded, though space can be kept. If the grpc-message is not properly encoded, the whole message will show up as an empty string in the application layer on the client side. i.e. without encoding, errMsg "Failed gwId: 123" will be "" because ':' has to be replaced with '%3A' read here for more info on how grpc encodes on http/2: https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md read here on percent-encoding: https://developer.mozilla.org/en-US/docs/Glossary/percent-encoding
func WriteErrResponse ¶
func WriteErrResponse(w http.ResponseWriter, err *HTTPGrpcError)
WriteErrResponse writes the HTTPGrpcError err into the http.ResponseWriter w. This is used by http2 server, and the server's handler can return after calling this function.
Types ¶
type H2CServer ¶
H2CServer is a minimal http/2 server supports non-TLS only
func NewH2CServer ¶
func NewH2CServer() *H2CServer
type HTTPGrpcError ¶
HTTPGrpcError is an error wraps a error message, a grpc status code and a http status code. It implements Error interface.
func NewHTTPGrpcError ¶
func NewHTTPGrpcError( msg string, grpcStatusCode int, httpStatusCode int, ) *HTTPGrpcError
NewHTTPGrpcError creates a new HTTPGrpcError.
func (*HTTPGrpcError) Error ¶
func (err *HTTPGrpcError) Error() string
Error returns HTTPGrpcError as a string