Use chunked encoding for HTTP uploads. Patch by Tomas Härdin