Commit 5f6c4202 authored by ale's avatar ale

Directly write the 'auth' command with conn.PrintfLine

parent b9fd2573
Pipeline #2974 passed with stages
in 2 minutes and 23 seconds
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
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment