How can I stream a GET request line-by-line?
Question: I would like to send a GET request to a server that is streamed almost in
'realtime' using Chunk Transfer Encoding that I can completley modify line-by-
line. For example:

    
    
    SendChunks = SomeHTTPLibrary.SendData;
    SendChunks(Example.org, "5\r\n")
    SendChunks(Example.org, "Hello\r\n")
    SendChunks(Example.org, "7\r\n")
    SendChunks(Example.org, "Goodbye\r\n")
    SendChunks(Example.org, "0\r\n")
    

Where I am right now, I don't even care about listening for a response. It
doesn't need to be in C++, I'm comfortable with Python, Javascript, PHP or
anything similar.


Answer: Firstly, you shouldn't be sending a request body along with a GET request. I
think technically you can, but if the server does anything with it then it's
non-compliant. See <http://stackoverflow.com/a/983458/241294>.

From you question it looks as though you already know that you need chunked
transfer encoding. Here is a crude example of how you can achieve this in
python, but with a `POST` request instead of a `GET` request (code hacked from
[here](http://stackoverflow.com/a/26673087/241294)):

    
    
    import httplib
    
    conn = httplib.HTTPConnection('Example.org')
    conn.connect()
    conn.putrequest('POST', '/post')
    conn.putheader('Transfer-Encoding', 'chunked')
    conn.endheaders()
    
    conn.send("5\r\n")
    conn.send("hello\r\n")
    conn.send("7\r\n")
    conn.send("Goodbye\r\n")
    conn.send("0\r\n")
    
    resp = conn.getresponse()
    print(resp.status, resp.reason, resp.read())
    conn.close()
    

For a nicer example with a python chunking function see [How to force
http.client to send chunked-encoding HTTP body in
python?](http://stackoverflow.com/q/9237961/241294).

