Commit 5ea429bd authored by Dennis Urban's avatar Dennis Urban
Browse files

remove "size" from was_modifies_since, because it was deprecated in django 4.1

parent cfe1e62e
...@@ -61,8 +61,7 @@ class DjangoStreamingServer: ...@@ -61,8 +61,7 @@ class DjangoStreamingServer:
def serve(private_file): def serve(private_file):
# Support If-Last-Modified # Support If-Last-Modified
mtime = private_file.modified_time.timestamp() mtime = private_file.modified_time.timestamp()
size = private_file.size if not was_modified_since(private_file.request.META.get('HTTP_IF_MODIFIED_SINCE'), mtime):
if not was_modified_since(private_file.request.META.get('HTTP_IF_MODIFIED_SINCE'), mtime, size):
return HttpResponseNotModified() return HttpResponseNotModified()
# As of Django 1.8, FileResponse triggers 'wsgi.file_wrapper' in Django's WSGIHandler. # As of Django 1.8, FileResponse triggers 'wsgi.file_wrapper' in Django's WSGIHandler.
...@@ -74,7 +73,7 @@ class DjangoStreamingServer: ...@@ -74,7 +73,7 @@ class DjangoStreamingServer:
else: else:
response = FileResponse(private_file.open()) response = FileResponse(private_file.open())
response['Content-Type'] = private_file.content_type response['Content-Type'] = private_file.content_type
response['Content-Length'] = size response['Content-Length'] = private_file.size
response["Last-Modified"] = http_date(mtime) response["Last-Modified"] = http_date(mtime)
return response return response
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment