This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients barry, martin.panter, orsenthil, serhiy.storchaka
Date 2013-12-18.02:32:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1387333921.91.0.6743196516.issue19524@psf.upfronthosting.co.za>
In-reply-to
Content
Thanks for looking at this. Perhaps you weren’t pasting the HTTP response into “socat”. After the six request lines are printed out, I enter the five lines between <HTTP response start> and <HTTP response end>; I didn’t really make this obvious. Otherwise, urlopen() hangs waiting for the response and read() never even gets called.

Here’s a Python-only HTTP server to demonstrate without needing “socat”. Run this in one terminal:

from http.server import HTTPServer, BaseHTTPRequestHandler
class Handler(BaseHTTPRequestHandler):
    protocol_version = "HTTP/1.1"
    def do_GET(self):
        self.send_response(200)
        self.send_header("Transfer-Encoding", "chunked")
        self.end_headers()
        self.wfile.write(b"0\r\n\r\n")
HTTPServer(("", 8000), Handler).serve_forever()

. . . and in another terminal:

from urllib.request import urlopen
with urlopen("http://localhost:8000") as response:
    response.read()
import gc; gc.collect()
History
Date User Action Args
2013-12-18 02:32:02martin.pantersetrecipients: + martin.panter, barry, orsenthil, serhiy.storchaka
2013-12-18 02:32:01martin.pantersetmessageid: <1387333921.91.0.6743196516.issue19524@psf.upfronthosting.co.za>
2013-12-18 02:32:01martin.panterlinkissue19524 messages
2013-12-18 02:32:00martin.pantercreate