HTTP 1.1 client in Python. 
Author Message
 HTTP 1.1 client in Python.

I have some trouble making the HTTPConnection class in httplib (that says it
supports 1.1) to handle 100 continue messages from the http server. I had to
resort to a truly ghastly hack to get the content from the server, because
100 code is just a message that tells the client it can now send the message
body. The HTTPConnection doesn't seem to understand this, or maybe I use it
wrongly. If there were anybody on this list that knew how to make a HTTP 1.1
client with python some pointers would be much appreciated.

Syver Enstad



Sun, 16 Nov 2003 01:56:02 GMT  
 HTTP 1.1 client in Python.

Quote:

> I have some trouble making the HTTPConnection class in httplib (that says
> it supports 1.1) to handle 100 continue messages from the http server. I
> had to resort to a truly ghastly hack to get the content from the server,
> because 100 code is just a message that tells the client it can now send
> the message body. The HTTPConnection doesn't seem to understand this, or
> maybe I use it wrongly. If there were anybody on this list that knew how
> to make a HTTP 1.1 client with Python some pointers would be much
> appreciated.

> Syver Enstad

Here's how I did it.

    while 1:
        response = self._client.getresponse()
        if response.status != 100:
            break
        # 2000-12-30 djf -- drop bogus 100 response
        # by kludging httplib
        self._client._HTTPConnection__state = httplib._CS_REQ_SENT
        self._client._HTTPConnection__response = None

I submitted this as bug #227361 on SourceForge.  

--

Senior Meat Manager
Downright Software LLC
http://www.downright.com

______________________________________________________________________
Posted Via Uncensored-News.Com - Still Only $9.95 - http://www.uncensored-news.com
   With Seven Servers In California And Texas - The Worlds Uncensored News Source



Sun, 16 Nov 2003 03:56:08 GMT  
 HTTP 1.1 client in Python.
Thanks very much Doug. I this solution looks a bit more general.


Quote:
> Here's how I did it.

>     while 1:
>         response = self._client.getresponse()
>         if response.status != 100:
>             break
>         # 2000-12-30 djf -- drop bogus 100 response
>         # by kludging httplib
>         self._client._HTTPConnection__state = httplib._CS_REQ_SENT
>         self._client._HTTPConnection__response = None

> I submitted this as bug #227361 on SourceForge.



Sun, 16 Nov 2003 05:44:53 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. HTTP/1.1 server in Python

2. python 1.4 and HTTP/1.1

3. HTTP 1.0 and HTTP 1.1 packages

4. HTTP 1.1 support in BaseHTTPServer [patch 430706]

5. HTTP 1.1 anyone?

6. httplib supporting HTTP/1.1 [Q]

7. HTTP/1.1 module

8. HTTP/1.1 support in 1.5?

9. HTTP/1.1 BaseHTTPServer

10. urllib HTTP/1.1 patch

11. httplib.py fixed for HTTP/1.1?

12. FAQ: Patch for HTTP/1.1 in httplib...

 

 
Powered by phpBB® Forum Software