Ported from ahc-1.7.x about issue #411 "Improve multipart logic for grizzly provider".