Backport the HttpPostRequestEncoder fixes by @igstan