psf/cachecontrol

Bug in new cache mechanism: updating existing requests has two problems

Closed this issue · 1 comments

First problem:

When updating an existing request in controller.py (update_cached_response) it ends up passing a body of None to _cache_set; line 437.

The result is that _cache_set then calls self._cache.set_body(cache_url, None), which blows up. Easy solution is to add a if body is not None: before setting the body.

Second problem:

When loading the body in update_cached_response, the body is never loaded if a separate-body cache is used.

My fault, sorry :(

Good news is that pip memory usage is down from 2500MB to 85MB with this new release (when installing 500MB wheel)! Next I will work on PR to fix this issue.