BrowserAdapter:

-added disabled (if false) code to set HEADER_REQUEST_ACCEPT_ENCODING to identity, see comment
RAFChunk:
-added special handling for URLConnection.isContentDecoded to set endByte -1 (open) when possible (startByte=0), else error out

git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@49634 ebf7c1c2-ba36-0410-9fe8-c592906822b4

Former-commit-id: 315adb8aa55873558c7997381160a141e0e48711
This commit is contained in:
jiaz 2024-08-22 08:48:04 +00:00
parent c0fd5a7a13
commit d921f16c6f
2 changed files with 17 additions and 1 deletions

View File

@ -15,7 +15,9 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package jd.plugins;
import org.appwork.net.protocol.http.HTTPConstants;
import org.appwork.storage.config.JsonConfig;
import org.appwork.utils.net.HTTPHeader;
import org.jdownloader.settings.GeneralSettings;
import jd.controlling.downloadcontroller.SingleDownloadController;
@ -30,6 +32,11 @@ public class BrowserAdapter {
public static final int ERROR_REDIRECTED = -1;
private static DownloadInterface getDownloadInterface(Downloadable downloadable, Request request, boolean resumeEnabled, int pluginConnections) throws Exception {
if (false) {
// was fine all the years, so better optimize handling in download system to better support edge cases with downloading
// content-encoding connections
request.getHeaders().put(new HTTPHeader(HTTPConstants.HEADER_REQUEST_ACCEPT_ENCODING, "identity", false));
}
final jd.plugins.download.raf.OldRAFDownload dl = new jd.plugins.download.raf.OldRAFDownload(downloadable, request);
final int customizedConnections = downloadable.getChunks();
final int setConnections;

View File

@ -669,7 +669,16 @@ public class RAFChunk extends Thread {
}
endByte = ContentRange[1];
}
if (endByte <= 0) {
if (connection.isContentDecoded()) {
final String encoding = connection.getHeaderField("Content-Encoding");
if (startByte == 0) {
logger.severe("reset endByte(-1) because connection is content decoded:" + encoding);
endByte = -1;
} else {
dl.error(new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT, "unsupported resume with content-encoding:" + encoding));
return;
}
} else if (endByte <= 0) {
/* endByte not yet set!, use Content-Length */
if (contentLength > 0) {
final long end = contentLength - 1;