:bug: fix Content-Range header for partial response according to http… · LZGroup/AndroidVideoCache@14ac4a9 · GitHub
Skip to content

Commit 14ac4a9

Browse files
committed
🐛 fix Content-Range header for partial response according to http spec (http://bit.ly/content-range)
1 parent c5cf254 commit 14ac4a9

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

library/build.gradle

Lines changed: 1 addition & 1 deletion

library/src/main/java/com/danikula/videocache/HttpProxyCache.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ private String newResponseHeaders(GetRequest request) throws IOException, ProxyC
6666
.append(request.partial ? "HTTP/1.1 206 PARTIAL CONTENT\n" : "HTTP/1.1 200 OK\n")
6767
.append("Accept-Ranges: bytes\n")
6868
.append(lengthKnown ? String.format("Content-Length: %d\n", contentLength) : "")
69-
.append(addRange ? String.format("Content-Range: bytes %d-%d/%d\n", request.rangeOffset, length, length) : "")
69+
.append(addRange ? String.format("Content-Range: bytes %d-%d/%d\n", request.rangeOffset, length - 1, length) : "")
7070
.append(mimeKnown ? String.format("Content-Type: %s\n", mime) : "")
7171
.append("\n") // headers end
7272
.toString();

sample/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ apt {
3535
}
3636

3737
dependencies {
38-
compile project(':library')
38+
// compile project(':library')
3939
compile 'com.android.support:support-v4:23.1.0'
4040
compile 'org.androidannotations:androidannotations-api:3.3.2'
41-
// compile 'com.danikula:videocache:2.2.0'
41+
compile 'com.danikula:videocache:2.3.1'
4242
compile 'com.viewpagerindicator:library:2.4.2-SNAPSHOT@aar'
4343
apt 'org.androidannotations:androidannotations:3.3.2'
4444
}

test/src/test/java/com/danikula/videocache/HttpProxyCacheServerTest.java

Lines changed: 2 additions & 2 deletions

0 commit comments

Comments
 (0)