[libsoup/cache] soup-cache: handle invalid 'Expires' headers
- From: Xan Lopez <xan src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libsoup/cache] soup-cache: handle invalid 'Expires' headers
- Date: Thu, 6 Aug 2009 08:23:58 +0000 (UTC)
commit 8759ed475e7a8759251ccd7bb750c119ef923fe2
Author: Xan Lopez <xan gnome org>
Date: Thu Aug 6 11:23:24 2009 +0300
soup-cache: handle invalid 'Expires' headers
libsoup/soup-cache.c | 21 +++++++++++++--------
1 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/libsoup/soup-cache.c b/libsoup/soup-cache.c
index d7275fd..c6a349c 100644
--- a/libsoup/soup-cache.c
+++ b/libsoup/soup-cache.c
@@ -251,17 +251,22 @@ soup_cache_entry_set_freshness (SoupCacheEntry *entry, SoupMessage *msg)
time_t expires_t, date_t;
expires_d = soup_date_new_from_string (expires);
- date_d = soup_date_new_from_string (date);
+ if (expires_d != NULL) {
+ /* If Expires is not a valid date we
+ should treat it as already expired, see
+ section 14.21 */
+ date_d = soup_date_new_from_string (date);
- expires_t = soup_date_to_time_t (expires_d);
- date_t = soup_date_to_time_t (date_d);
+ expires_t = soup_date_to_time_t (expires_d);
+ date_t = soup_date_to_time_t (date_d);
- soup_date_free (expires_d);
- soup_date_free (date_d);
+ soup_date_free (expires_d);
+ soup_date_free (date_d);
- if (expires_t && date_t) {
- entry->freshness_lifetime = (guint) MAX (expires_t - date_t, G_MAXUINT32);
- return;
+ if (expires_t && date_t) {
+ entry->freshness_lifetime = (guint) MAX (expires_t - date_t, G_MAXUINT32);
+ return;
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]