* patch - nnimap - case handling in STATUS command and response
@ 2007-12-03 17:13 Nathan J. Williams
2007-12-03 17:56 ` Simon Josefsson
0 siblings, 1 reply; 6+ messages in thread
From: Nathan J. Williams @ 2007-12-03 17:13 UTC (permalink / raw)
To: ding
The function imap-mailbox-status is careful to send tokens in
uppercase. imap-mailbox-status-async should be similarly careful. On
the receiving end, imap-parse-status needs to upcase the tokens before
applying string= to them, since the server might send them as
lowercase.
Noticed against MS Exchange 2007, which sends back STATUS tokens as
lowercase if you sent them to it as lowercase.
- Nathan
Index: imap.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/imap.el,v
retrieving revision 7.34
diff -u -r7.34 imap.el
--- imap.el 25 Oct 2007 08:17:54 -0000 7.34
+++ imap.el 3 Dec 2007 17:12:25 -0000
@@ -1526,10 +1526,11 @@
(imap-send-command (list "STATUS \""
(imap-utf7-encode mailbox)
"\" "
- (format "%s"
- (if (listp items)
- items
- (list items)))))))
+ (upcase
+ (format "%s"
+ (if (listp items)
+ items
+ (list items))))))))
(defun imap-mailbox-acl-get (&optional mailbox buffer)
"Get ACL on mailbox from server in BUFFER."
@@ -2517,7 +2518,7 @@
(while (and (not (eq (char-after) ?\)))
(or (forward-char) t)
(looking-at "\\([A-Za-z]+\\) "))
- (let ((token (match-string 1)))
+ (let ((token (upcase (match-string 1))))
(goto-char (match-end 0))
(cond ((string= token "MESSAGES")
(imap-mailbox-put 'messages (read (current-buffer)) mailbox))
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: patch - nnimap - case handling in STATUS command and response
2007-12-03 17:13 patch - nnimap - case handling in STATUS command and response Nathan J. Williams
@ 2007-12-03 17:56 ` Simon Josefsson
2007-12-03 18:09 ` Nathan J. Williams
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Simon Josefsson @ 2007-12-03 17:56 UTC (permalink / raw)
To: Nathan J. Williams; +Cc: ding
nathanw@MIT.EDU (Nathan J. Williams) writes:
> The function imap-mailbox-status is careful to send tokens in
> uppercase. imap-mailbox-status-async should be similarly careful. On
> the receiving end, imap-parse-status needs to upcase the tokens before
> applying string= to them, since the server might send them as
> lowercase.
>
> Noticed against MS Exchange 2007, which sends back STATUS tokens as
> lowercase if you sent them to it as lowercase.
Thanks, applied. Note that the server is broken here, the RFC is clear
that the status-att are upper case.
/Simon
> - Nathan
>
> Index: imap.el
> ===================================================================
> RCS file: /usr/local/cvsroot/gnus/lisp/imap.el,v
> retrieving revision 7.34
> diff -u -r7.34 imap.el
> --- imap.el 25 Oct 2007 08:17:54 -0000 7.34
> +++ imap.el 3 Dec 2007 17:12:25 -0000
> @@ -1526,10 +1526,11 @@
> (imap-send-command (list "STATUS \""
> (imap-utf7-encode mailbox)
> "\" "
> - (format "%s"
> - (if (listp items)
> - items
> - (list items)))))))
> + (upcase
> + (format "%s"
> + (if (listp items)
> + items
> + (list items))))))))
>
> (defun imap-mailbox-acl-get (&optional mailbox buffer)
> "Get ACL on mailbox from server in BUFFER."
> @@ -2517,7 +2518,7 @@
> (while (and (not (eq (char-after) ?\)))
> (or (forward-char) t)
> (looking-at "\\([A-Za-z]+\\) "))
> - (let ((token (match-string 1)))
> + (let ((token (upcase (match-string 1))))
> (goto-char (match-end 0))
> (cond ((string= token "MESSAGES")
> (imap-mailbox-put 'messages (read (current-buffer)) mailbox))
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: patch - nnimap - case handling in STATUS command and response
2007-12-03 17:56 ` Simon Josefsson
@ 2007-12-03 18:09 ` Nathan J. Williams
2007-12-18 15:42 ` Simon Josefsson
2007-12-03 20:43 ` Reiner Steib
2007-12-03 22:14 ` Leo
2 siblings, 1 reply; 6+ messages in thread
From: Nathan J. Williams @ 2007-12-03 18:09 UTC (permalink / raw)
To: ding
Simon Josefsson <simon@josefsson.org> writes:
>> Noticed against MS Exchange 2007, which sends back STATUS tokens as
>> lowercase if you sent them to it as lowercase.
>
> Thanks, applied.
Thanks.
> Note that the server is broken here, the RFC is clear
> that the status-att are upper case.
Ah. Can you let me know where it says that? I was going from the
formal syntax at the end of RFC3501, where it says:
(1) Except as noted otherwise, all alphabetic characters
are case-insensitive. The use of upper or lower case
characters to define token strings is for editorial clarity
only. Implementations MUST accept these strings in a
case-insensitive fashion.
and I didn't see anything specially marked about the case of
status-att (or, in fact, anything other than the issues around INBOX).
- Nathan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: patch - nnimap - case handling in STATUS command and response
2007-12-03 18:09 ` Nathan J. Williams
@ 2007-12-18 15:42 ` Simon Josefsson
0 siblings, 0 replies; 6+ messages in thread
From: Simon Josefsson @ 2007-12-18 15:42 UTC (permalink / raw)
To: Nathan J. Williams; +Cc: ding
nathanw@MIT.EDU (Nathan J. Williams) writes:
>> Note that the server is broken here, the RFC is clear
>> that the status-att are upper case.
>
> Ah. Can you let me know where it says that? I was going from the
> formal syntax at the end of RFC3501, where it says:
>
> (1) Except as noted otherwise, all alphabetic characters
> are case-insensitive. The use of upper or lower case
> characters to define token strings is for editorial clarity
> only. Implementations MUST accept these strings in a
> case-insensitive fashion.
>
> and I didn't see anything specially marked about the case of
> status-att (or, in fact, anything other than the issues around INBOX).
You are right! So your patch is indeed the right thing to do.
Reiner Steib <reinersteib+gmane@imap.cc> writes:
> ,----
> | * imap.el (imap-mailbox-status-asynch): Upcase STATUS items.
> | (imap-parse-status): Upcase status-att for broken servers that sends
> | them lower-case (e.g., MS Exchange 2007).
> `----
>
> I think this explanations should be added as a comment(s) in imap.el.
Given that it is incorrect, I modified the ChangeLog entry to read:
2007-12-03 Nathan J. Williams <nathanw@MIT.EDU> (tiny change)
* imap.el (imap-mailbox-status-asynch): Upcase STATUS items.
(imap-parse-status): Upcase status-att for servers that sends them
lower-case (e.g., MS Exchange 2007).
Since this was a real bug in imap.el, a comment shouldn't be needed.
Leo <sdl.web@gmail.com> writes:
>> Thanks, applied. Note that the server is broken here, the RFC is clear
>> that the status-att are upper case.
>
> Should this be added to the comments of the function?
Nope. :)
/Simon
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: patch - nnimap - case handling in STATUS command and response
2007-12-03 17:56 ` Simon Josefsson
2007-12-03 18:09 ` Nathan J. Williams
@ 2007-12-03 20:43 ` Reiner Steib
2007-12-03 22:14 ` Leo
2 siblings, 0 replies; 6+ messages in thread
From: Reiner Steib @ 2007-12-03 20:43 UTC (permalink / raw)
To: ding
On Mon, Dec 03 2007, Simon Josefsson wrote:
> nathanw@MIT.EDU (Nathan J. Williams) writes:
[...]
>> Noticed against MS Exchange 2007, which sends back STATUS tokens as
>> lowercase if you sent them to it as lowercase.
>
> Thanks, applied. Note that the server is broken here, the RFC is clear
> that the status-att are upper case.
,----
| * imap.el (imap-mailbox-status-asynch): Upcase STATUS items.
| (imap-parse-status): Upcase status-att for broken servers that sends
| them lower-case (e.g., MS Exchange 2007).
`----
I think this explanations should be added as a comment(s) in imap.el.
Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: patch - nnimap - case handling in STATUS command and response
2007-12-03 17:56 ` Simon Josefsson
2007-12-03 18:09 ` Nathan J. Williams
2007-12-03 20:43 ` Reiner Steib
@ 2007-12-03 22:14 ` Leo
2 siblings, 0 replies; 6+ messages in thread
From: Leo @ 2007-12-03 22:14 UTC (permalink / raw)
To: ding
On 2007-12-03 17:56 +0000, Simon Josefsson wrote:
>> Noticed against MS Exchange 2007, which sends back STATUS tokens as
>> lowercase if you sent them to it as lowercase.
>
> Thanks, applied. Note that the server is broken here, the RFC is clear
> that the status-att are upper case.
Should this be added to the comments of the function?
--
.: Leo :. [ sdl.web AT gmail.com ] .: [ GPG Key: 9283AA3F ] :.
Use the best OS -- http://www.fedoraproject.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-12-18 15:42 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-03 17:13 patch - nnimap - case handling in STATUS command and response Nathan J. Williams
2007-12-03 17:56 ` Simon Josefsson
2007-12-03 18:09 ` Nathan J. Williams
2007-12-18 15:42 ` Simon Josefsson
2007-12-03 20:43 ` Reiner Steib
2007-12-03 22:14 ` Leo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).