There is a script that acts as a simple http server. In an attempt to eliminate the hang of the script when the client connects to the server, I decided to set a socket timeout (perhaps an erroneous solution). But another problem arose, which in turn is reproduced only in the LXC container. The script gives the body no more than 83.5 KB - more files are cut to this size.
On host Ubuntu Desktop 16.04 x64 and OpenSUSE Tumbleweed x64, the script responds to the request as expected.
I tried on several configurations:
- Host: Ubuntu server 16.04 x64 Container: Ubuntu 16.04
- Host: Proxmox VE 4.3 Container: Debian 8
Example:
import http.server as http class HTTPRequestHandler(http.BaseHTTPRequestHandler): def __init__(self, reqest, cli_addr, server): self.timeout = 10.0 super().__init__(reqest, cli_addr, server) def do_GET(self): if self.path == '/': self.send_response(200) self.send_header('Content-type', 'text/css') self.end_headers() with open("bootstrap.min.css", 'rb') as css: self.wfile.write(css.read()) http_server = http.HTTPServer(('', 8080), HTTPRequestHandler) if __name__ == '__main__': http_server.serve_forever()