From b4677d74666a5fb5b491d5395aa83890a9853030 Mon Sep 17 00:00:00 2001 From: "Adam Ginsburg (keflavich)" Date: Sat, 24 Dec 2016 13:41:52 -0700 Subject: [PATCH] should return content-length when requesting range, and that content-length should be the range specified in the url (i.e., range/1024 has length 1024) --- httpbin/core.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/httpbin/core.py b/httpbin/core.py index e3ca094..dfad2b9 100644 --- a/httpbin/core.py +++ b/httpbin/core.py @@ -598,7 +598,8 @@ def range_request(numbytes): response = Response(headers={ 'ETag' : 'range%d' % numbytes, 'Accept-Ranges' : 'bytes', - 'Content-Range' : 'bytes */%d' % numbytes + 'Content-Range' : 'bytes */%d' % numbytes, + "Content-Length": str(numbytes), }) response.status_code = 416 return response @@ -625,7 +626,9 @@ def range_request(numbytes): 'Content-Type': 'application/octet-stream', 'ETag' : 'range%d' % numbytes, 'Accept-Ranges' : 'bytes', - 'Content-Range' : content_range } + "Content-Length": str(numbytes), + 'Content-Range' : content_range + } response = Response(generate_bytes(), headers=response_headers)