diff options
author | jet tsang zeon-git <zeon-git@jettsang.com> | 2021-09-07 22:26:39 +0800 |
---|---|---|
committer | jet tsang zeon-git <zeon-git@jettsang.com> | 2021-09-07 22:26:39 +0800 |
commit | a3e569d0b38a829cac26bf4710e8c4371aabb46a (patch) | |
tree | 7ad8845a08dfeac788c9009dca29b8fac22d008a | |
parent | add some error log print (diff) | |
download | relay-a3e569d0b38a829cac26bf4710e8c4371aabb46a.tar.gz relay-a3e569d0b38a829cac26bf4710e8c4371aabb46a.tar.bz2 relay-a3e569d0b38a829cac26bf4710e8c4371aabb46a.zip |
add a simple header printer
Signed-off-by: jet tsang zeon-git <zeon-git@jettsang.com>
-rw-r--r-- | main.go | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -24,6 +24,7 @@ var blockTxt string var shortenMap map[string]string var listen string var reloadURI = "/reload" +var clientHeaderURI = "/header" func init() { const ( @@ -60,6 +61,10 @@ func requestHandler(ctx *fasthttp.RequestCtx) { fmt.Fprint(ctx, "ok") ctx.SetStatusCode(fasthttp.StatusAccepted) return + } else if string(ctx.RequestURI()) == clientHeaderURI { + fmt.Fprint(ctx, string(ctx.Request.Header.Header())) + ctx.SetStatusCode(fasthttp.StatusAccepted) + return } if relayUrl, exist := shortenMap[string(ctx.Path())]; exist { var newRequest fasthttp.Request |