MCPcopy
hub / github.com/caddyserver/caddy / ServeHTTP

Method ServeHTTP

admin.go:781–807  ·  admin.go::adminHandler.ServeHTTP

ServeHTTP is the external entry point for API requests. It will only be called once per request.

(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

779// ServeHTTP is the external entry point for API requests.
780// It will only be called once per request.
781func (h adminHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
782 ip, port, err := net.SplitHostPort(r.RemoteAddr)
783 if err != nil {
784 ip = r.RemoteAddr
785 port = ""
786 }
787 log := Log().Named("admin.api").With(
788 zap.String("method", r.Method),
789 zap.String("host", r.Host),
790 zap.String("uri", r.RequestURI),
791 zap.String("remote_ip", ip),
792 zap.String("remote_port", port),
793 zap.Object("headers", internal.LoggableHTTPHeader{Header: r.Header}),
794 )
795 if r.TLS != nil {
796 log = log.With(
797 zap.Bool("secure", true),
798 zap.Int("verified_chains", len(r.TLS.VerifiedChains)),
799 )
800 }
801 if r.RequestURI == "/metrics" {
802 log.Debug("received request")
803 } else {
804 log.Info("received request")
805 }
806 h.serveHTTP(w, r)
807}
808
809// serveHTTP is the internal entry point for API requests. It may
810// be called more than once per request, for example if a request

Calls 6

serveHTTPMethod · 0.95
LogFunction · 0.85
WithMethod · 0.45
StringMethod · 0.45
BoolMethod · 0.45
IntMethod · 0.45