Archived
1
0

srnd: error while reading message isn't valid thing

This commit is contained in:
cathugger 2018-12-08 19:44:05 +00:00
parent 3b492579b8
commit 2d62a3bc7f
No known key found for this signature in database
GPG Key ID: 9BADDA2DAF6F01A8
2 changed files with 6 additions and 6 deletions

View File

@ -547,8 +547,8 @@ func (self *articleStore) ProcessMessage(wr io.Writer, msg io.Reader, spamfilter
if e != nil {
log.Println("failed to read entire message", e)
}
pw_in.Close()
pr_in.Close()
pw_in.CloseWithError(e)
pr_in.CloseWithError(e)
}()
r := bufio.NewReader(pr_out)
m, e := readMIMEHeader(r)
@ -579,7 +579,7 @@ func (self *articleStore) ProcessMessage(wr io.Writer, msg io.Reader, spamfilter
return
}
writeMIMEHeader(wr, m.Header)
read_message_body(m.Body, m.Header, self, wr, false, process)
err = read_message_body(m.Body, m.Header, self, wr, false, process)
}
return
}
@ -632,7 +632,7 @@ func read_message_body(body io.Reader, hdr map[string][]string, store ArticleSto
body = io.TeeReader(body, wr)
}
boundary, ok := params["boundary"]
if ok || content_type == "multipart/mixed" {
if content_type == "multipart/mixed" && ok {
partReader := multipart.NewReader(body, boundary)
for {
part, err := partReader.NextPart()

View File

@ -801,8 +801,8 @@ func storeMessage(daemon *NNTPDaemon, hdr textproto.MIMEHeader, body io.Reader)
go func() {
var buff [65536]byte
writeMIMEHeader(pw, hdr)
io.CopyBuffer(pw, body, buff[:])
pw.Close()
_, e := io.CopyBuffer(pw, body, buff[:])
pw.CloseWithError(e)
}()
err = daemon.store.ProcessMessage(f, pr, daemon.CheckText, hdr.Get("Newsgroups"))
pr.Close()