adds basic client support as well as chunked encoding -- just a basic working idea, needs cleanup