Resolve the bugs that XmlHttpRequest would truncate binary data

This pr merged from https://github.com/cocos2d/cocos2d-x/pull/9073 and did some modify.Thanks @dantezhu.