MCPcopy Create free account
hub / github.com/CPChain/chain / NewHTTPServer

Function NewHTTPServer

api/rpc/http.go:164–174  ·  view source on GitHub ↗

NewHTTPServer creates a new HTTP RPC server around an API provider. Deprecated: Server implements http.Handler

(cors []string, vhosts []string, srv *Server)

Source from the content-addressed store, hash-verified

162//
163// Deprecated: Server implements http.Handler
164func NewHTTPServer(cors []string, vhosts []string, srv *Server) *http.Server {
165 // Wrap the CORS-handler within a host-handler
166 handler := newCorsHandler(srv, cors)
167 handler = newVHostHandler(vhosts, handler)
168 return &http.Server{
169 Handler: handler,
170 ReadTimeout: 5 * time.Second,
171 WriteTimeout: 10 * time.Second,
172 IdleTimeout: 120 * time.Second,
173 }
174}
175
176// ServeHTTP serves JSON-RPC requests over HTTP.
177func (srv *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {

Callers 1

StartHTTPEndpointFunction · 0.85

Calls 2

newCorsHandlerFunction · 0.85
newVHostHandlerFunction · 0.85

Tested by

no test coverage detected