修复缓存判定时,last modifide和expire字段的GMT的assert,改为if。

This commit is contained in:
zhengchao
2018-10-21 11:07:20 +08:00
parent af4f470fe7
commit 09db5de25b

View File

@@ -148,7 +148,7 @@ time_t absolute_to_relative_time(const char* gmt_time)
bool is_standard_gmt_format(const char* 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;
}
@@ -215,9 +215,8 @@ void get_response_freshness(const struct tfe_http_half *response, struct respons
else
{
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);
const time_t cur_ct_time = time(NULL);
if (gmtime_r(&cur_ct_time, &cur_gmt_time) == NULL)