From 09db5de25b33b77bc42efd2e42ff5f14de9c4c4e Mon Sep 17 00:00:00 2001 From: zhengchao Date: Sun, 21 Oct 2018 11:07:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BC=93=E5=AD=98=E5=88=A4?= =?UTF-8?q?=E5=AE=9A=E6=97=B6=EF=BC=8Clast=20modifide=E5=92=8Cexpire?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E7=9A=84GMT=E7=9A=84assert=EF=BC=8C=E6=94=B9?= =?UTF-8?q?=E4=B8=BAif=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cache/src/tango_cache_pending.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cache/src/tango_cache_pending.cpp b/cache/src/tango_cache_pending.cpp index 2a5d928..22a42b3 100644 --- a/cache/src/tango_cache_pending.cpp +++ b/cache/src/tango_cache_pending.cpp @@ -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)