Simple reverse http proxy function that returns data/html from another http server (via sockets)
    only drawback is the peername is static, and currently does not support being changed.
    Example: curl localhost:8000/reverse_http_proxy?length=400

def reverse_http_proxy(length: int=100):
    """Simple reverse http proxy function that returns data/html from another http server (via sockets)
    only drawback is the peername is static, and currently does not support being changed.
    Example: curl localhost:8000/reverse_http_proxy?length=400"""

    http_request = """
GET / HTTP/1.0\r\n\r\n
Host: www.google.com\r\n\r\n
\r\n\r\n
"""
    return http_socket.request(http_request, timeout=5.0).data.read()[0:length]