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

View File

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