Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into recordingdb_features
Browse files Browse the repository at this point in the history
  • Loading branch information
tsahee committed Jul 10, 2023
2 parents 704d1b8 + 6afe422 commit fcda31c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion node/rpcstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,11 @@ func (h *httpServer) doStop() {
h.server, h.listener = nil, nil
}

// Arbitrum: Allows injection of custom http.Handler functionality.
var WrapHTTPHandler = func(srv http.Handler) (http.Handler, error) {
return srv, nil
}

// enableRPC turns on JSON-RPC over HTTP on the server.
func (h *httpServer) enableRPC(apis []rpc.API, config httpConfig) error {
h.mu.Lock()
Expand All @@ -300,9 +305,15 @@ func (h *httpServer) enableRPC(apis []rpc.API, config httpConfig) error {
if err := RegisterApis(apis, config.Modules, srv); err != nil {
return err
}

httpHandler, err := WrapHTTPHandler(srv)
if err != nil {
return err
}

h.httpConfig = config
h.httpHandler.Store(&rpcHandler{
Handler: NewHTTPHandlerStack(srv, config.CorsAllowedOrigins, config.Vhosts, config.jwtSecret),
Handler: NewHTTPHandlerStack(httpHandler, config.CorsAllowedOrigins, config.Vhosts, config.jwtSecret),
server: srv,
})
return nil
Expand Down

0 comments on commit fcda31c

Please sign in to comment.