Archived
1
0

Merge pull request #165 from cathugger/master

srnd: error while reading message isn't valid thing
This commit is contained in:
Jeff 2018-12-08 15:05:08 -05:00 committed by GitHub
commit 1517941b29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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()