Handle repeated NNTP command whitespace (#20)

This commit is contained in:
phucnguyen1707 2026-06-15 10:25:04 +07:00 committed by GitHub
parent 0944fa2cb4
commit 36c6e0e275
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 96 additions and 5 deletions

View file

@ -142,12 +142,16 @@ func (s *Server) Process(nc net.Conn) {
if err != nil {
return
}
cmd := strings.Split(l, " ")
args := []string{}
if len(cmd) > 1 {
args = cmd[1:]
fields := strings.Fields(l)
if len(fields) == 0 {
err = handleDefault(nil, sess, c)
} else {
args := []string{}
if len(fields) > 1 {
args = fields[1:]
}
err = sess.dispatchCommand(fields[0], args, c)
}
err = sess.dispatchCommand(cmd[0], args, c)
if err != nil {
if _, isNNTPError := err.(*NNTPError); err == io.EOF {
return