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

This is for master branch. All testcases have been passed successfully in my local.