Hello!
I'm trying to use django.middleware.common.CommonMiddleware to set ETags and it seems to me, that I found a bug.
Actual result:
django.utils.cache.get_conditional_response Always returns original response, even if ETag from header corresponds to ETag of current content.
Expected result:
django.utils.cache.get_conditional_response Must return HttpResponseNotModified response with 304 status, if ETag from header corresponds to ETag of current content.
I think the reason of such behaviour:
-- I'm trying to use django.middleware.common.CommonMiddleware to set ETags and it seems to me, that I found a bug.
if settings.USE_ETAGS:
if not response.has_header('ETag'):
set_response_etag(response)
if response.has_header('ETag'):
return get_conditional_response( # always returns response with 200 code
request,
etag=response['ETag'],
response=response,
)
Actual result:
django.utils.cache.get_conditional_response Always returns original response, even if ETag from header corresponds to ETag of current content.
Expected result:
django.utils.cache.get_conditional_response Must return HttpResponseNotModified response with 304 status, if ETag from header corresponds to ETag of current content.
I think the reason of such behaviour:
- etag argument passes to get_conditional_response as quoted string (as specified in RFC). For example:
'"281abb9608fa10d8839e5e8df5c98b0b"'
Inside
get_conditional_response etags list is parsed from headers as list of unquoted strings. For example: ['281abb9608fa10d8839e5e8df5c98b0b']
Then etag in etags check allways returns False!
Is it a bug, or expected?
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4a0fbb44-9c3b-4223-97d9-b9c41fa3d445%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment