473,385 Members | 1,317 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

rfc822 module bug?

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
4 1401
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Michael B Allen | last post by:
How can I zoom in on what's going on below? $ archivemail -n ~/Maildir/.Lists.* /home/miallen/Maildir/.Lists.CIFS: I would have archived 11 of 29 message(s) in 0.1 seconds...
1
by: John Doe | last post by:
I've never used a factory and would like to get some help. The class mailbox.UnixMailbox has a defination for a factory. __init__(self, fp, factory=<class rfc822.Message>) where fp is a file...
1
by: Vladimir Litovka | last post by:
Hi. I have a problem with writing regular expression :-( There is message's header: From: blah-blah To: blah-blah <blah@blah>, blah1 <blah1@blah>,\n\t blah2 <blah2@blah> Cc: blah3@blah...
1
by: Malcolm Dew-Jones | last post by:
I am looking for an xml grammar for mail messages. It needs to be able to identify the structure of a mime message and also the structure of a non-mime (but rfc822) message. I can invent one...
0
by: Gary Brewer | last post by:
Hello, DateTime.Parse works great with ISO 8601 but it does not parse all RFC 822 formats, for example, it will parse Mon, 02 Feb 2004 12:35:25 GMT but it won't parse Mon, 02 Feb 2004...
5
by: John Smith | last post by:
Hi, I've been carefully storing my dates as ISO dates in a DB and now have to add an RSS feed to a website. Is there an easy way to convert these dates to RFC822 compliant dates ? I've had a...
1
by: praba kar | last post by:
Dear All, I am new to python world. I have pasted my code which I used it to build rfc822 format mails for webbased mailing system task(which is like to yahoo.com web interface). Now I am...
0
by: Nikolaus Schulz | last post by:
Hi, while playing with the rfc822 module and imaplib, I've found the following weird behaviour. Quickstart: rfc822.Message(fp) instantiates a rfc822.Message object from a file object fp. The...
3
by: Phoe6 | last post by:
Hi all, Have a look at this snippet, I have a file direct.txt and I want to read it as rfc8222.Message() so that I get the Subject: and Mood: as Dict Keys and content separately, but I am unable...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.