fixes and refactoring for http multipart post streaming