SimpleHTTPServer - Serving Large Files

I am using python -m SimpleHTTPServer for a small project. The index.html file links to some videos. <video><source src="big_buck_bunny_480p_stereo.ogg"></video> This file is 159 MB in size. When I try to download it, SimpleHTTPServer displays several error messages instead of my video.

 Marc-Laptop - - [23/Sep/2012 18:18:29] "GET /big_buck_bunny_480p_stereo.ogg HTTP /1.1" 200 - ---------------------------------------- Exception happened during processing of request from ('192.168.4.38', 51152) Traceback (most recent call last): File "C:Program Files (x86)PythonlibSocketServer.py", line 284, in _handle _request_noblock self.process_request(request, client_address) File "C:Program Files (x86)PythonlibSocketServer.py", line 310, in process _request self.finish_request(request, client_address) File "C:Program Files (x86)PythonlibSocketServer.py", line 323, in finish_ request self.RequestHandlerClass(request, client_address, self) File "C:Program Files (x86)PythonlibSocketServer.py", line 640, in __init_ _ self.finish() File "C:Program Files (x86)PythonlibSocketServer.py", line 693, in finish self.wfile.flush() File "C:Program Files (x86)Pythonlibsocket.py", line 303, in flush self._sock.sendall(view[write_offset:write_offset+buffer_size]) error: [Errno 10054] Eine vorhandene Verbindung wurde vom Remotehost geschlossen ---------------------------------------- 
+4
source share
1 answer

simpleHTTPServer is trying to buffer everything and will really explode due to lack of memory. It is better to do this asynchronously, but simpleHTTPServer does not know how to do this. Make sure thread . Someone suggested a modified version of simpleHTTPserver: SimpleAsyncHTTPServer.py

+3
source

Source: https://habr.com/ru/post/1435776/


All Articles