MCPcopy
hub / github.com/writefreely/writefreely / stripHostProtocol

Function stripHostProtocol

gopher.go:34–41  ·  view source on GitHub ↗

Utility function to strip the URL from the hostname provided by app.cfg.App.Host

(app *App)

Source from the content-addressed store, hash-verified

32
33// Utility function to strip the URL from the hostname provided by app.cfg.App.Host
34func stripHostProtocol(app *App) string {
35 u, err := url.Parse(app.cfg.App.Host)
36 if err != nil {
37 // Fall back to host, with scheme stripped
38 return string(regexp.MustCompile("^.*://").ReplaceAll([]byte(app.cfg.App.Host), []byte("")))
39 }
40 return u.Hostname()
41}
42
43func handleGopher(app *App, w gopher.ResponseWriter, r *gopher.Request) error {
44 parts := strings.Split(r.Selector, "/")

Callers 2

handleGopherFunction · 0.85
handleGopherCollectionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected