python 1.4 and HTTP/1.1 
Author Message
 python 1.4 and HTTP/1.1

Hi there,

right now i am working on a program to check urls for existance, size
and last-modified using python 1.4. i get different results if an url is
either on a HTTP/1.0 or on a HTTP/1.1 server.

in order to get the header of an url i am using httplib.getreply(). it
seems to me that python 1.4 can only handle the HTTP/1.0 protocol.

HTTP_VERSION = 'HTTP/1.0' is defined in httplib.py

can anyone help me

Olli Grzeorski



Sun, 06 Feb 2000 03:00:00 GMT  
 python 1.4 and HTTP/1.1

Quote:

>Hi there,
>right now i am working on a program to check urls for existance, size
>and last-modified using python 1.4. i get different results if an url is
>either on a HTTP/1.0 or on a HTTP/1.1 server.
>in order to get the header of an url i am using httplib.getreply(). it
>seems to me that python 1.4 can only handle the HTTP/1.0 protocol.
>HTTP_VERSION = 'HTTP/1.0' is defined in httplib.py

Hack the httplib.py file to not pattern match for 'HTTP/1.0', but
instead pattern match for 'HTTP/1.'.
--
XCOMM Kevin P. Neal, Junior, Comp. Sci.     -   House of Retrocomputing


XCOMM "Good grief, I've just noticed I've typed in a rant. Sorry chaps!"


Sun, 06 Feb 2000 03:00:00 GMT  
 python 1.4 and HTTP/1.1

Quote:

> right now i am working on a program to check urls for existance, size
> and last-modified using python 1.4. i get different results if an url is
> either on a HTTP/1.0 or on a HTTP/1.1 server.
> in order to get the header of an url i am using httplib.getreply(). it
> seems to me that python 1.4 can only handle the HTTP/1.0 protocol.
> HTTP_VERSION = 'HTTP/1.0' is defined in httplib.py

I had a similar problem some time ago and it was discussed in this
newsgroup. Thanks to Ron Klatchko for this fix:

        Change the Lines

        replypat = regsub.gsub('\\.', '\\\\.', HTTP_VERSION) + \
                               '[ \t]+\([0-9][0-9][0-9]\)\(.*\)'

        in file httplib.py to

        replypat = 'HTTP/[0-9]+\.[0-9]+' + '[ \t]+\([0-9][0-9][0-9]\)\(.*\)'

It worked for me. There was another answer in the mentioned thread with
a more complicated regex but the thread is vanished on my newsserver.

hth, Rene
--
Life is what happens, while you're making other plans



Mon, 07 Feb 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. HTTP/1.1 server in Python

2. HTTP 1.0 and HTTP 1.1 packages

3. HTTP 1.1 client in Python.

4. HTTP client code and examples in Dylanlibs 1.4

5. Python, MySQL, and MySQLmodule.c 1.4 - Python Version.

6. Version problem -- Python 1.4 V Python 1.5.1

7. Python 1.4 does, Python 1.5 doesn't...

8. AIX python.exp and misc on Python 1.4 beta 2

9. HTTP 1.1 support in BaseHTTPServer [patch 430706]

10. HTTP 1.1 anyone?

11. httplib supporting HTTP/1.1 [Q]

12. HTTP/1.1 module

 

 
Powered by phpBB® Forum Software