Re: SocketServer and Ctrl-C on Windows

2017-04-03 Thread Chris Angelico
On Tue, Apr 4, 2017 at 12:34 AM, Paul Moore wrote: > On Monday, 3 April 2017 15:10:12 UTC+1, Chris Angelico wrote: >> You're getting HTTP/1.1 requests. Maybe you need to send a >> "Connection: close" header to tell the browser to leave you be? > > That sounds possible - I don't really know enoug

Re: SocketServer and Ctrl-C on Windows

2017-04-03 Thread Paul Moore
On Monday, 3 April 2017 15:10:12 UTC+1, Chris Angelico wrote: > You're getting HTTP/1.1 requests. Maybe you need to send a > "Connection: close" header to tell the browser to leave you be? That sounds possible - I don't really know enough about HTTP to even know that was a thing, so I'm not surp

Re: SocketServer and Ctrl-C on Windows

2017-04-03 Thread Chris Angelico
On Mon, Apr 3, 2017 at 11:56 PM, Paul Moore 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, l

Re: SocketServer and Ctrl-C on Windows

2017-04-03 Thread Paul Moore
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 a

Re: SocketServer and Ctrl-C on Windows

2017-04-03 Thread eryk sun
On Mon, Apr 3, 2017 at 1:20 PM, 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

Re: SocketServer and Ctrl-C on Windows

2017-04-03 Thread Paul Moore
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... 12

Re: SocketServer and Ctrl-C on Windows

2017-04-03 Thread eryk sun
On Mon, Apr 3, 2017 at 12:34 PM, Paul Moore wrote: > On Monday, 3 April 2017 13:23:11 UTC+1, eryk sun wrote: >> It works for me when run from a command prompt in Windows 10. >> serve_forever() uses select() with a timeout of 0.5s, so it doesn't >> block the main thread. > > Odd. For me, it doesn

Re: SocketServer and Ctrl-C on Windows

2017-04-03 Thread Paul Moore
On Monday, 3 April 2017 13:23:11 UTC+1, eryk sun wrote: > It works for me when run from a command prompt in Windows 10. > serve_forever() uses select() with a timeout of 0.5s, so it doesn't > block the main thread. Odd. For me, it doesn't work (Windows 7, but I can't see why that would affect it

Re: SocketServer and Ctrl-C on Windows

2017-04-03 Thread eryk sun
On Mon, Apr 3, 2017 at 9:08 AM, Paul Moore wrote: > I know I've seen this before, but for the life of me I can't find any > reference. > > If I write a simple web server using wsgiref, something like > > from wsgiref.simple_server import make_server, demo_app > > with make_server('', 800

SocketServer and Ctrl-C on Windows

2017-04-03 Thread Paul Moore
I know I've seen this before, but for the life of me I can't find any reference. If I write a simple web server using wsgiref, something like from wsgiref.simple_server import make_server, demo_app with make_server('', 8000, demo_app) as httpd: print("Serving HTTP on port 8000...