Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should support SEARCH response with trailing whitespace? #9

Closed
verterok opened this issue Apr 29, 2015 · 2 comments
Closed

Should support SEARCH response with trailing whitespace? #9

verterok opened this issue Apr 29, 2015 · 2 comments

Comments

@verterok
Copy link

Hi,

While testing the client with different servers, I found that Yahoo IMAP is returning an unexpected trailing whitespace on the SEARCH results, e.g: "* SEARCH 61 62 63 "
I'm far from an IMAP expert, so I wanted to ask: could this case be supported?

A test case to reproduce it:

--- a/imap/reader_test.go
+++ b/imap/reader_test.go
@@ -469,6 +469,9 @@ func TestReaderParse(t *testing.T) {
                {`* SEARCH 2 84 882`,
                        &Response{Tag: "*", Type: Data, Label: "SEARCH", Fields: []Field{"SEARCH", uint32(2), uint32(84), uint32(882)}}},

+               {`* SEARCH 2 84 882 `,
+                       &Response{Tag: "*", Type: Data, Label: "SEARCH", Fields: []Field{"SEARCH", uint32(2), uint32(84), uint32(882)}}},
+
                // Page 66
                {`* OK [ALERT] System shutdown in 10 minutes`,
                        &Response{Tag: "*", Type: Status, Status: OK, Info: "System shutdown in 10 minutes", Label: "ALERT", Fields: []Field{"ALERT"}}},

I still getting familiar with the code (reader.go) but will try to get a patch with a fix.

@mxk
Copy link
Owner

mxk commented Apr 29, 2015

That's not a valid response. The ABNF is "SEARCH" *(SP nz-number). I just committed a fix to the master branch. Try it out and let me know if that resolves the problem.

Really don't get why it's so difficult for server authors to follow the RFC, especially at companies like Yahoo.

@verterok
Copy link
Author

Yes, no idea why they send the extra space.
Just in case, I double checked with telnet:

TAG SEARCH UNSEEN SINCE 28-Apr-2015
* SEARCH 65 66 67 68 69 
TAG OK SEARCH completed

The fix works as expected. Thanks!

@mxk mxk added the bug label Apr 29, 2015
@mxk mxk closed this as completed Apr 29, 2015
@mxk mxk removed the bug label Apr 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants