SocketServer and Ctrl-C on Windows
rosuav at gmail.com
Mon Apr 3 10:09:58 EDT 2017
On Mon, Apr 3, 2017 at 11:56 PM, Paul Moore <p.f.moore at gmail.com> wrote:
> On Monday, 3 April 2017 14:20:43 UTC+1, Paul Moore wrote:
>> On Monday, 3 April 2017 14:00:18 UTC+1, eryk sun wrote:
>> > It should service the request and return to the serve_forever() loop.
>> > Do you see a line logged for each request, like "[IP] - - [date] "GET
>> > ..."?
>> Yes, I see that and the page is served.
>> >py .\example.py
>> Serving HTTP on port 8000...
>> 127.0.0.1 - - [03/Apr/2017 13:25:34] "GET / HTTP/1.1" 200 5470
>> 127.0.0.1 - - [03/Apr/2017 13:25:34] "GET /favicon.ico HTTP/1.1" 200 5438
>> But if I press Ctrl-C at this point, nothing happens. Even if I press Ctrl-C multiple times.
> Hmm, looks like sometimes it works. I wonder if the browser is holding open the page request somehow. That seems unlikely as HTTP is supposed to be stateless.
You're getting HTTP/1.1 requests. Maybe you need to send a
"Connection: close" header to tell the browser to leave you be?
More information about the Python-list