mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-04 05:58:40 +00:00
node, cmd/clef, graphql: disable gzip on engine API (#35057)
Add a disableGzip parameter to NewHTTPHandlerStack and httpConfig. initAuth sets it true so compression is disabled in the engine api. Public HTTP RPC behavior is unchanged.
This commit is contained in:
parent
ab20d50dba
commit
b0df33967c
4 changed files with 9 additions and 4 deletions
|
|
@ -739,7 +739,7 @@ func signer(c *cli.Context) error {
|
|||
if err != nil {
|
||||
utils.Fatalf("Could not register API: %w", err)
|
||||
}
|
||||
handler := node.NewHTTPHandlerStack(srv, cors, vhosts, nil)
|
||||
handler := node.NewHTTPHandlerStack(srv, cors, vhosts, nil, false)
|
||||
|
||||
// set port
|
||||
port := c.Int(rpcPortFlag.Name)
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ func newHandler(stack *node.Node, backend ethapi.Backend, filterSystem *filters.
|
|||
return nil, err
|
||||
}
|
||||
h := handler{Schema: s}
|
||||
handler := node.NewHTTPHandlerStack(h, cors, vhosts, nil)
|
||||
handler := node.NewHTTPHandlerStack(h, cors, vhosts, nil, false)
|
||||
|
||||
stack.RegisterHandler("GraphQL UI", "/graphql/ui", GraphiQL{})
|
||||
stack.RegisterHandler("GraphQL UI", "/graphql/ui/", GraphiQL{})
|
||||
|
|
|
|||
|
|
@ -445,6 +445,7 @@ func (n *Node) startRPC() error {
|
|||
Vhosts: n.config.AuthVirtualHosts,
|
||||
Modules: DefaultAuthModules,
|
||||
prefix: DefaultAuthPrefix,
|
||||
disableGzip: true,
|
||||
rpcEndpointConfig: sharedConfig,
|
||||
})
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ type httpConfig struct {
|
|||
CorsAllowedOrigins []string
|
||||
Vhosts []string
|
||||
prefix string // path prefix on which to mount http handler
|
||||
disableGzip bool
|
||||
rpcEndpointConfig
|
||||
}
|
||||
|
||||
|
|
@ -320,7 +321,7 @@ func (h *httpServer) enableRPC(apis []rpc.API, config httpConfig) error {
|
|||
}
|
||||
h.httpConfig = config
|
||||
h.httpHandler.Store(&rpcHandler{
|
||||
Handler: NewHTTPHandlerStack(srv, config.CorsAllowedOrigins, config.Vhosts, config.jwtSecret),
|
||||
Handler: NewHTTPHandlerStack(srv, config.CorsAllowedOrigins, config.Vhosts, config.jwtSecret, config.disableGzip),
|
||||
prefix: config.prefix,
|
||||
server: srv,
|
||||
})
|
||||
|
|
@ -402,13 +403,16 @@ func isWebsocket(r *http.Request) bool {
|
|||
}
|
||||
|
||||
// NewHTTPHandlerStack returns wrapped http-related handlers
|
||||
func NewHTTPHandlerStack(srv http.Handler, cors []string, vhosts []string, jwtSecret []byte) http.Handler {
|
||||
func NewHTTPHandlerStack(srv http.Handler, cors []string, vhosts []string, jwtSecret []byte, disableGzip bool) http.Handler {
|
||||
// Wrap the CORS-handler within a host-handler
|
||||
handler := newCorsHandler(srv, cors)
|
||||
handler = newVHostHandler(vhosts, handler)
|
||||
if len(jwtSecret) != 0 {
|
||||
handler = newJWTHandler(jwtSecret, handler)
|
||||
}
|
||||
if disableGzip {
|
||||
return handler
|
||||
}
|
||||
return newGzipHandler(handler)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue