By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,375 Members | 1,387 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,375 IT Pros & Developers. It's quick & easy.

rfc822 module bug?

P: n/a
Hi all,
I found that the function parsedate_tz of the rfc822 module has a bug
(or at least I think so).
I found a usenet article (message-id: <27**********@myg.winews.net>)
that has this Date field:

Date: Tue,26 Jul 2005 13:14:27 GMT +0200

It seems to be correct¹, but parsedate_tz is not able to decode it, it
is confused by the absence of a space after the ",".
I studied the parsedate_tz code and the problem is on its third line:
....
if not data:
return None
data = data.split()
....
After the split I have:

['Tue,26', 'Jul', '2005', '13:14:27', 'GMT', '+0200']

but "Tue," and "26" should be separated.

Of course parsedate_tz correctly decode the field if you add a space
after the ",".

Do you think that's a bug?
Which is the most correct place where to file this bug?
¹ and looking at rfc822 par3.3 it should be correct:

date-time = [ day-of-week "," ] date FWS time [CFWS]

day-of-week = ([FWS] day-name) / obs-day-of-week

day-name = "Mon" / "Tue" / "Wed" / "Thu" /
"Fri" / "Sat" / "Sun"

date = day month year

--
A pat on the back is only a few centimeters from a kick in the butt.

|\ | |HomePage : http://nem01.altervista.org
| \|emesis |XPN (my nr): http://xpn.altervista.org

Jul 30 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Sat, 30 Jul 2005 09:08:39 GMT, Nemesis <ne*****@nowhere.invalid>
declaimed the following in comp.lang.python:

Which is the most correct place where to file this bug?
Uh, with the software the created that DATE: header?

Does RFC822 (or modern replacement) permit the lack of a space
in that position? The spec is somewhat vague on spacing for dates, only
indicating that the text day is optional and, if present, has a comma
after it.

5.1. SYNTAX

date-time = [ day "," ] date time ; dd mm yy
; hh:mm:ss zzz

-- ================================================== ============ <
wl*****@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
================================================== ============ <
Home Page: <http://www.dm.net/~wulfraed/> <
Overflow Page: <http://wlfraed.home.netcom.com/> <

Jul 30 '05 #2

P: n/a
On Sat, 2005-07-30 at 09:08 +0000, Nemesis wrote:
Hi all,
I found that the function parsedate_tz of the rfc822 module has a bug
(or at least I think so).
I found a usenet article (message-id: <27**********@myg.winews.net>)
that has this Date field:

Date: Tue,26 Jul 2005 13:14:27 GMT +0200


My preferred date/time module is Gustavo Niemeyer's DateUtil module:

https://moin.conectiva.com.br/DateUtil

It parses an astounding number of date formats (I used it to parse the
mess of dates and times provided by RSS feeds without a hitch).

Regards,
Cliff
--
cl***@develix.com
http://www.develix.com :: Web applications and hosting :: Linux, PostgreSQL and Python specialists ::
Jul 30 '05 #3

P: n/a
Nemesis <ne*****@nowhere.invalid> wrote:

Hi all,
I found that the function parsedate_tz of the rfc822 module has a bug
(or at least I think so).
I found a usenet article (message-id: <27**********@myg.winews.net>)
that has this Date field:

Date: Tue,26 Jul 2005 13:14:27 GMT +0200

It seems to be correct¹, but parsedate_tz is not able to decode it, it
is confused by the absence of a space after the ",".
Fascinating. I've written a lot of e-mail programs, and I would have bet
real money that this was not legal by either RFC822 or 2822, but the BNF
certainly supports your assertion that this is valid.

RFC1036, which gives the format for Usenet articles, includes the space in
its "suggested" date format.
¹ and looking at rfc822 par3.3 it should be correct:

date-time = [ day-of-week "," ] date FWS time [CFWS]

day-of-week = ([FWS] day-name) / obs-day-of-week

day-name = "Mon" / "Tue" / "Wed" / "Thu" /
"Fri" / "Sat" / "Sun"

date = day month year


This is actually from RFC2822, but the point is the same.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Aug 1 '05 #4

P: n/a
Mentre io pensavo ad una intro simpatica "Tim Roberts" scriveva:

[rfc822 module bug]
Date: Tue,26 Jul 2005 13:14:27 GMT +0200

It seems to be correct¹, but parsedate_tz is not able to decode it, it
is confused by the absence of a space after the ",".
Fascinating. I've written a lot of e-mail programs, and I would have bet
real money that this was not legal by either RFC822 or 2822, but the BNF
certainly supports your assertion that this is valid.

[...] This is actually from RFC2822, but the point is the same.


Yes you are right of course.

I think I'll submit this bug on the Python web-site.

--
"Sfugge un braccio a Pessotto." (Amedeo Goria)

|\ | |HomePage : http://nem01.altervista.org
| \|emesis |XPN (my nr): http://xpn.altervista.org

Aug 1 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.