mirror of
https://github.com/TecharoHQ/anubis.git
synced 2025-10-04 13:52:08 +08:00
* fix(lib): enable multiple consecutive slash support Closes #754 Closes #808 Closes #815 Apparently more applications use multiple slashes in a row than I thought. There is no easy way around this other than to do this hacky fix to avoid net/http#ServeMux's URL cleaning. * test(double_slash): add sourceware case Signed-off-by: Xe Iaso <me@xeiaso.net> * test(lib): fix tests for double slash fix Signed-off-by: Xe Iaso <me@xeiaso.net> --------- Signed-off-by: Xe Iaso <xe.iaso@techaro.lol> Signed-off-by: Xe Iaso <me@xeiaso.net>
25 lines
469 B
Go
25 lines
469 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"log"
|
|
"log/slog"
|
|
"net/http"
|
|
)
|
|
|
|
var (
|
|
bind = flag.String("bind", ":3923", "TCP port to bind to")
|
|
)
|
|
|
|
func main() {
|
|
flag.Parse()
|
|
|
|
slog.Info("listening", "url", "http://localhost"+*bind)
|
|
log.Fatal(http.ListenAndServe(*bind, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
slog.Info("got request", "method", r.Method, "path", r.RequestURI)
|
|
|
|
fmt.Fprintln(w, r.Method, r.RequestURI)
|
|
r.Header.Write(w)
|
|
})))
|
|
}
|