thecreeper / go-pop3 Goto Github PK
View Code? Open in Web Editor NEWPackage pop3 provides an implementation of the Post Office Protocol - Version 3.
License: BSD 2-Clause "Simplified" License
Package pop3 provides an implementation of the Post Office Protocol - Version 3.
License: BSD 2-Clause "Simplified" License
I discovered that reading a mail message using c.ReadLines()
is incorrect: while the function interprets a single .
as the end of message, it does not un-escape the dot when a line begins with a dot.
Dropping in the code from net/textproto helps:
diff --git i/pop3.go w/pop3.go
index de0727a..cd44007 100644
--- i/pop3.go
+++ w/pop3.go
@@ -72,10 +72,13 @@ func (c *Client) ReadLines() (lines []string, err error) {
return nil, err
}
- // Look for a dot to indicate the end of a message
- // from the server.
- if line == "." {
- break
+ // from go1.20.5/src/net/textproto/reader.go#L298:
+ // Dot by itself marks end; otherwise cut one dot.
+ if len(line) > 0 && line[0] == '.' {
+ if len(line) == 1 {
+ break
+ }
+ line = line[1:]
}
lines = append(lines, line)
}
I suspect that c.Retr()
is similarly buggy because it uses mail.ReadMessage
, which does use net/textproto
, but does not call its DotReader()
function, but I haven’t verified.
Filing this issue mostly so that other users are aware of the issue.
c.Cmd("%s %s\r\n", DELE, msg)
msg is inter
c.Cmd("%s %d\r\n", DELE, msg)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.