Fixed 20346 cache middleware should vary on full URL

https://code.djangoproject.com/ticket/20346 Implemented the suggested change in cache.py. I'm not sure if there are utils_tests for cache.py or if they are necessary. Feel free to code review. Thanks.