response_body_raw = ''.join(response_body)
response_headers = {'Content-Type': 'text/html; encoding=utf8',
    'Content-Length': len(response_body_raw), 'Connection': 'close'}
response_headers_raw = ''.join('%s: %s\n' % (k, v) for k, v in
    response_headers.items())
response_proto = 'HTTP/1.1'
response_status = '200'
response_status_text = 'OK'
client_sock.send('%s %s %s' % (response_proto, response_status,
    response_status_text))
client_sock.send(response_headers_raw)
client_sock.send('\n')
client_sock.send(response_body_raw)
client_sock.close()
run()
How to properly send HTTP response with Python using socket library only?