Message206491
| 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:02 | martin.panter | set | recipients:
+ martin.panter, barry, orsenthil, serhiy.storchaka |
| 2013年12月18日 02:32:01 | martin.panter | set | messageid: <1387333921.91.0.6743196516.issue19524@psf.upfronthosting.co.za> |
| 2013年12月18日 02:32:01 | martin.panter | link | issue19524 messages |
| 2013年12月18日 02:32:00 | martin.panter | create |
|