diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cache.c | 33 | ||||
-rw-r--r-- | src/cache.h | 2 |
2 files changed, 17 insertions, 18 deletions
diff --git a/src/cache.c b/src/cache.c index 84e93fc6..18347099 100644 --- a/src/cache.c +++ b/src/cache.c @@ -468,23 +468,22 @@ static void Cache_parse_header(CacheEntry_t *entry, int i; #endif - if (HdrLen < 12) { - /* Not enough info. */ - - } if (header[9] == '3' && header[10] == '0') { - /* 30x: URL redirection */ - entry->Flags |= CA_Redirect; - if (header[11] == '1') - entry->Flags |= CA_ForceRedirect; /* 301 Moved Permanently */ - else if (header[11] == '2') - entry->Flags |= CA_TempRedirect; /* 302 Temporal Redirect */ - - location_str = Cache_parse_field(header, "Location"); - entry->Location = a_Url_new(location_str, URL_STR_(entry->Url), 0, 0, 0); - dFree(location_str); - - } else if (strncmp(header + 9, "404", 3) == 0) { - entry->Flags |= CA_NotFound; + if (HdrLen > 12) { + if (header[9] == '3' && header[10] == '0') { + /* 30x: URL redirection */ + entry->Flags |= CA_Redirect; + if (header[11] == '1') + entry->Flags |= CA_ForceRedirect; /* 301 Moved Permanently */ + else if (header[11] == '2') + entry->Flags |= CA_TempRedirect; /* 302 Temporary Redirect */ + + location_str = Cache_parse_field(header, "Location"); + entry->Location = a_Url_new(location_str, URL_STR_(entry->Url), 0, 0, 0); + dFree(location_str); + + } else if (strncmp(header + 9, "404", 3) == 0) { + entry->Flags |= CA_NotFound; + } } if ((Length = Cache_parse_field(header, "Content-Length")) != NULL) { diff --git a/src/cache.h b/src/cache.h index e3891740..f6a831ea 100644 --- a/src/cache.h +++ b/src/cache.h @@ -26,7 +26,7 @@ extern "C" { #define CA_FreeData (16) /* Free the cache Data on close */ #define CA_Redirect (32) /* Data actually points to a redirect */ #define CA_ForceRedirect (64) /* Unconditional redirect */ -#define CA_TempRedirect (128) /* Temporal redirect */ +#define CA_TempRedirect (128) /* Temporary redirect */ #define CA_NotFound (256) /* True if remote server didn't find the URL */ #define CA_Stopped (512) /* True if the entry has been stopped */ #define CA_MsgErased (1024) /* Used to erase the bw's status bar */ |