修复缓存判定时,last modifide和expire字段的GMT的assert,改为if。
This commit is contained in:
5
cache/src/tango_cache_pending.cpp
vendored
5
cache/src/tango_cache_pending.cpp
vendored
@@ -148,7 +148,7 @@ time_t absolute_to_relative_time(const char* gmt_time)
|
|||||||
bool is_standard_gmt_format(const char* value)
|
bool is_standard_gmt_format(const char* value)
|
||||||
{
|
{
|
||||||
int str_len = strlen(value);
|
int str_len = strlen(value);
|
||||||
if ((value[str_len - 1] == 'T') && (value[str_len - 2] == 'M') && (value[str_len - 3] == 'G'))
|
if(0==strcasecmp(value+str_len-3,"GMT"))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -215,9 +215,8 @@ void get_response_freshness(const struct tfe_http_half *response, struct respons
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
field_value = tfe_http_std_field_read(response, TFE_HTTP_EXPIRES);
|
field_value = tfe_http_std_field_read(response, TFE_HTTP_EXPIRES);
|
||||||
if (field_value != NULL)
|
if (field_value != NULL && is_standard_gmt_format(field_value))
|
||||||
{
|
{
|
||||||
assert(is_standard_gmt_format(field_value));
|
|
||||||
expire_rel_time = absolute_to_relative_time(field_value);
|
expire_rel_time = absolute_to_relative_time(field_value);
|
||||||
const time_t cur_ct_time = time(NULL);
|
const time_t cur_ct_time = time(NULL);
|
||||||
if (gmtime_r(&cur_ct_time, &cur_gmt_time) == NULL)
|
if (gmtime_r(&cur_ct_time, &cur_gmt_time) == NULL)
|
||||||
|
|||||||
Reference in New Issue
Block a user