CacheControl fails on invalid (non-integer) max-age header
CacheControl totally fails on this URL:
'http://www.meristation.com/v3/podcasts_rss.php'
Due to the max-age header being '600s' which is obviously wrong, but I think CacheControl should catch the ValueError (trying to cast the string to an int) and handle it gracefully.
Exception:
ValueError
invalid literal for int() with base 10: '600s'
Location: cachecontrol/controller.py, cache_response:241
I agree. That said, CacheControl probably should raise an error of its own to let you know that there were cache headers present, but they were invalid. You might otherwise expect that this was cached if you inspected the response and missed that header being malformed.
Maybe a warning or log an error? But to die completely I think is over the top. I use cachecontrol as a wrapper around all my HTTP handling, so I expect it to be solid and withstand all the weird stuff on the web. ;)
Yeah, I guess its unreasonable for anyone talking to the internet to handle any failures at all
Haha, I meant the opposite of course. But yes, handling the internet is a pretty big task. :)
@hakanw Thanks for catching this one! I'll take a look.
Long fixed, I believe.