summaryrefslogtreecommitdiff
path: root/finger
diff options
context:
space:
mode:
authortjpcc <tjp@ctrl-c.club>2023-08-12 10:47:51 -0600
committertjpcc <tjp@ctrl-c.club>2023-08-12 10:47:51 -0600
commit7d3cbefde656d5520067d56eeb44a8ba1f39d672 (patch)
treef8c12c0cc911cf24743798bbda6f3910f176db1a /finger
parent23bc5f4fb7542e64c94eaa7fe2c7a6aa55010898 (diff)
multi-protocol client
Fixes #4
Diffstat (limited to 'finger')
-rw-r--r--finger/client.go9
1 files changed, 8 insertions, 1 deletions
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 }