From 7d3cbefde656d5520067d56eeb44a8ba1f39d672 Mon Sep 17 00:00:00 2001 From: tjpcc Date: Sat, 12 Aug 2023 10:47:51 -0600 Subject: multi-protocol client Fixes #4 --- finger/client.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'finger') diff --git a/finger/client.go b/finger/client.go index 75a382f..bd1e3bf 100644 --- a/finger/client.go +++ b/finger/client.go @@ -37,7 +37,12 @@ func (c Client) RoundTrip(request *types.Request) (*types.Response, error) { request.RemoteAddr = conn.RemoteAddr() request.TLSState = nil - if _, err := conn.Write([]byte(strings.TrimPrefix(request.Path, "/") + "\r\n")); err != nil { + username := request.User.String() + if username == "" { + username = strings.TrimPrefix(request.Path, "/") + } + + if _, err := conn.Write([]byte(username + "\r\n")); err != nil { return nil, err } @@ -57,3 +62,5 @@ func (c Client) Fetch(query string) (*types.Response, error) { } return c.RoundTrip(req) } + +func (c Client) IsRedirect(_ *types.Response) bool { return false } -- cgit v1.2.3