nntplib.py converts message ID to lowercase 
Author Message
 nntplib.py converts message ID to lowercase

Hi,

While writing a NNTP subject header search script I noticed the
following: the message ID as returned for example by nntlib.stat(),
nntplib.head() and nntplib.body() are converted to lowercase.
This makes it, for example, unsuitable to be used in a construction
like this:

        resp, count, first, last, name = server.group('alt.test')
        resp, num, id = server.stat(last)
        resp, num, id, lines = server.article(id)

When the article ID returned by 'server.stat(last)' contained uppercase
letters, the 'server.article(id)' call will fail.

The following function from nntplib.py is responsible:

        # Internal: parse the response of a STAT, NEXT or LAST command
        def statparse(self, resp):
                if resp[:2] <> '22':
                        raise error_reply, resp
                words = string.split(resp)
                nr = 0
                id = ''
                n = len(words)
                if n > 1:
                        nr = words[1]
                        if n > 2:
                                id = string.lower(words[2])
                return resp, nr, id

Does anybody have any idea why 'id = string.lower(words[2])' was added
to this function, does it have anything to do with the standard as
described in RFC 977 ? Or is the news server I'm using incorrect, and
should all message ID's only contain lowercase letters ?

I hope someone can help me with this.

--
                 Hans Trompert, Hogeschool van Amsterdam,
                 Europaboulevard 23, 1079 PC Amsterdam, The Netherlands,

                 Voice: (+31) 20 6429333, Fax: (+31) 20 6443215



Sat, 04 Dec 1999 03:00:00 GMT  
 nntplib.py converts message ID to lowercase

Quote:
> described in RFC 977 ? Or is the news server I'm using incorrect, and
> should all message ID's only contain lowercase letters ?

Unless someone out there can provide a reason for doing this, this
looks like an nntplib bug.  RFC 850, "Standard for Interchange of
USENET Messages" says:

  In order to conform to RFC 822, the Message-ID must have the format

   where "full domain name" is the full name of the host at which the
  article entered the network, including a domain that host is in,
  and unique is any string of printing ASCII characters, not including

The source code for suck-3.4.1 does a case-sensitive compare of the
first portion of the message ID ("unique") and a case-insensitive
comparision of the domain name portion; that's specified by RFC822 for
email addresses.  So the string.lower() looks wrong; it could

        The group() method folds the group name parameter to
lower-case; perhaps someone drew a false parallel and did the same for
message IDs.

        Andrew Kuchling

        http://people.magnet.com/%7Eamk/



Sat, 04 Dec 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Bug in nntplib.py

2. nntplib.py 'mode reader' addition

3. Converting lowercase to uppercase and arrow keys

4. How to convert uppercase to lowercase in fortran

5. Message-Id: <306D58231AA1D411ACB90080C84A3FFF9B4A@SPHNT1>

6. List message id

7. Unique ID numbers for compile/runtime error messages?

8. converting an id() into an object

 

 
Powered by phpBB® Forum Software