Refuse requests for non-gemini schemes
This commit is contained in:
parent
a49b0cdaac
commit
4c0b13fb57
|
@ -79,7 +79,7 @@ func login(rw *gmi.ResponseWriter, req *gmi.Request) {
|
||||||
sessions[fingerprint] = &session{
|
sessions[fingerprint] = &session{
|
||||||
username: username,
|
username: username,
|
||||||
}
|
}
|
||||||
gmi.Redirect(rw, req, "/login/password")
|
gmi.Redirect(rw, req, "/login#password")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -579,6 +579,11 @@ func (mux *ServeMux) shouldRedirectRLocked(host, path string) bool {
|
||||||
// If there is no registered handler that applies to the request,
|
// If there is no registered handler that applies to the request,
|
||||||
// Handler returns a ``page not found'' handler and an empty pattern.
|
// Handler returns a ``page not found'' handler and an empty pattern.
|
||||||
func (mux *ServeMux) Handler(r *Request) (h Handler, pattern string) {
|
func (mux *ServeMux) Handler(r *Request) (h Handler, pattern string) {
|
||||||
|
// Refuse requests for non-gemini schemes.
|
||||||
|
if r.URL.Scheme != "gemini" {
|
||||||
|
return NotFoundHandler(), ""
|
||||||
|
}
|
||||||
|
|
||||||
// All other requests have any port stripped and path cleaned
|
// All other requests have any port stripped and path cleaned
|
||||||
// before passing to mux.handler.
|
// before passing to mux.handler.
|
||||||
host := stripHostPort(r.Host)
|
host := stripHostPort(r.Host)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user