mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Don't request that the server use DEFLATE compression.
If the server actually gives us a DEFLATE response, we fail to handle it properly!
This commit is contained in:
parent
4d6c9f27c2
commit
99b438e4c4
1 changed files with 13 additions and 1 deletions
|
|
@ -226,6 +226,19 @@ public class HttpDataSource implements DataSource {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TODO: If the server uses gzip compression when serving the response, this may end up returning
|
||||||
|
* the size of the compressed response, where-as it should be returning the decompressed size or
|
||||||
|
* -1. See: developer.android.com/reference/java/net/HttpURLConnection.html
|
||||||
|
*
|
||||||
|
* To fix this we should:
|
||||||
|
*
|
||||||
|
* 1. Explicitly require no compression for media requests (since media should be compressed
|
||||||
|
* already) by setting the Accept-Encoding header to "identity"
|
||||||
|
* 2. In other cases, for example when requesting manifests, we don't want to disable compression.
|
||||||
|
* For these cases we should ensure that we return -1 here (and avoid performing any sanity
|
||||||
|
* checks on the content length).
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public long open(DataSpec dataSpec) throws HttpDataSourceException {
|
public long open(DataSpec dataSpec) throws HttpDataSourceException {
|
||||||
this.dataSpec = dataSpec;
|
this.dataSpec = dataSpec;
|
||||||
|
|
@ -380,7 +393,6 @@ public class HttpDataSource implements DataSource {
|
||||||
connection.setRequestProperty(property.getKey(), property.getValue());
|
connection.setRequestProperty(property.getKey(), property.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
connection.setRequestProperty("Accept-Encoding", "deflate");
|
|
||||||
connection.setRequestProperty("User-Agent", userAgent);
|
connection.setRequestProperty("User-Agent", userAgent);
|
||||||
connection.setRequestProperty("Range", buildRangeHeader(dataSpec));
|
connection.setRequestProperty("Range", buildRangeHeader(dataSpec));
|
||||||
connection.connect();
|
connection.connect();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue