Better handling of POST and PUT data

Don't try and read the input stream twice!
Cope with non-terminating input stream (connection keep-alive)
Ensure do_PUT actually calls request.put
Move accept-encoding fix into rewrite_headers for better modularity.