MinecraftForge / ForgeGradle

Minecraft mod development framework used by Forge and FML for the gradle build system
GNU Lesser General Public License v2.1
508 stars 436 forks source link

Make `DownloaderUtils` properly handle compression of response #905

Closed Matyrobbrt closed 1 year ago

Matyrobbrt commented 1 year ago

This PR makes DownloadUtils add the Accept-Encoding header to requests, as otherwise, it is assumed we accept any compression strategy. The gzip and deflate strategies are now handled. Additionally, when the content-length is -1 or there is a compression strategy in use, an exception will no longer be thrown if the bytes read vs expected don't match, as a discrepancy between the two will usually exist in that scenario.