MCPcopy
hub / github.com/TecharoHQ/anubis / ServeHTTP

Method ServeHTTP

lib/http.go:339–358  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

337}
338
339func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
340 if strings.HasPrefix(r.URL.Path, anubis.BasePrefix+anubis.StaticPath) {
341 s.mux.ServeHTTP(w, r)
342 return
343 } else if strings.HasPrefix(r.URL.Path, anubis.BasePrefix+xess.BasePrefix) {
344 s.mux.ServeHTTP(w, r)
345 return
346 }
347
348 // Forward robots.txt requests to mux when ServeRobotsTXT is enabled
349 if s.opts.ServeRobotsTXT {
350 path := strings.TrimPrefix(r.URL.Path, anubis.BasePrefix)
351 if path == "/robots.txt" || path == "/.well-known/robots.txt" {
352 s.mux.ServeHTTP(w, r)
353 return
354 }
355 }
356
357 s.maybeReverseProxyOrPage(w, r)
358}
359
360func (s *Server) stripBasePrefixFromRequest(r *http.Request) *http.Request {
361 if !s.opts.StripBasePrefix || s.opts.BasePrefix == "" {

Callers 5

RenderIndexMethod · 0.45
RenderBenchMethod · 0.45
respondWithStatusMethod · 0.45
ServeHTTPNextMethod · 0.45
NewFunction · 0.45

Calls 1

Tested by

no test coverage detected