From 5f6c4202ceac71349b414ab65b94f8e0f191c208 Mon Sep 17 00:00:00 2001 From: ale Date: Fri, 24 May 2019 12:03:32 +0100 Subject: [PATCH] Directly write the 'auth' command with conn.PrintfLine --- client/client.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/client/client.go b/client/client.go index 245a402..3aa4e5b 100644 --- a/client/client.go +++ b/client/client.go @@ -1,9 +1,7 @@ package client import ( - "bytes" "context" - "io" "net/textproto" "git.autistici.org/id/auth" @@ -47,11 +45,8 @@ func (c *socketClient) Authenticate(ctx context.Context, req *auth.Request) (*au go func() { defer close(done) - // Write the command to a buffer. - var buf bytes.Buffer - io.WriteString(&buf, "auth ") - buf.Write(c.codec.Encode(req)) - if err := conn.PrintfLine(buf.String()); err != nil { + // Write the auth command to the connection. + if err := conn.PrintfLine("auth %s", string(c.codec.Encode(req))); err != nil { done <- err return } -- GitLab