summaryrefslogtreecommitdiff
path: root/cache
diff options
context:
space:
mode:
authorzhengchao <[email protected]>2018-11-20 19:34:27 +0800
committerzhengchao <[email protected]>2018-11-20 19:34:27 +0800
commit6c9ff10aa72b944c7dc986a3a93d4d59d9097b21 (patch)
tree8f2f1f82aae909f5ce964ea5ee65cf03523c0016 /cache
parent866883a1f793bc9aebc1453734fb83ac9d2f040d (diff)
#85 修复ssl、http业务层中的编译警告。
Diffstat (limited to 'cache')
-rw-r--r--cache/src/tango_cache_pending.cpp36
1 files changed, 9 insertions, 27 deletions
diff --git a/cache/src/tango_cache_pending.cpp b/cache/src/tango_cache_pending.cpp
index 9434bbe..2cfece3 100644
--- a/cache/src/tango_cache_pending.cpp
+++ b/cache/src/tango_cache_pending.cpp
@@ -31,9 +31,6 @@ time_t get_time_value(const char* field_value, const char* field_type)
void get_request_freshness(const char *value, struct request_freshness* restrict)
{
const char* field_value = NULL;
- const char* cache_control_time[] = { "min-fresh", "max-age" };
- int i = 0;
- time_t relative_time;
field_value = strstr(value, "min-fresh");
if (field_value != NULL)
{
@@ -50,7 +47,6 @@ void get_request_freshness(const char *value, struct request_freshness* restrict
enum cache_pending_action request_cache_control(const char* value, struct request_freshness* restrict)
{
- int i = 0;
if (strstr(value, "no-cache") != NULL)
{
return REVALIDATE;
@@ -66,7 +62,6 @@ enum cache_pending_action request_cache_control(const char* value, struct reques
bool cache_verify(const struct tfe_http_half *request)
{
- int i = 0;
if( !tfe_http_std_field_read(request,TFE_HTTP_IF_MATCH) ||
!tfe_http_std_field_read(request,TFE_HTTP_IF_NONE_MATCH) ||
!tfe_http_std_field_read(request,TFE_HTTP_IF_MODIFIED_SINCE) ||
@@ -81,7 +76,7 @@ bool cache_verify(const struct tfe_http_half *request)
const char* get_head_value(const struct tfe_http_field *http_fields, size_t n_fields, enum tfe_http_std_field head_key)
{
- int i = 0;
+ size_t i = 0;
for (i = 0; i < n_fields; i++)
{
if (http_fields[i].http_field == head_key)
@@ -107,8 +102,6 @@ enum cache_pending_action get_pragma_action(const char * value)
enum cache_pending_action tfe_cache_get_pending(const struct tfe_http_half *request, struct request_freshness* restrict)
{
enum cache_pending_action res = UNDEFINED;
- int i = 0;
- int index = 0;
const char *value = NULL;
memset(restrict,0,sizeof(struct request_freshness));
if(request->req_spec.method!=TFE_HTTP_METHOD_GET)
@@ -170,23 +163,6 @@ bool is_standard_gmt_format(const char* value)
}
}
-
-time_t get_relative_time(const char* value)
-{
- const char* temp_str = NULL;
- char * str_age = NULL;
- time_t time = 0;
- const char * cache_ctl_time[] = { "s-maxage","max-age" };//s-maxage优先级大于max-age优先级
- int i = 0;
- for (; i < 2; i++)
- {
- temp_str = strstr(value, cache_ctl_time[i]);
-
- }
- return time;
-}
-
-
time_t get_response_s_maxage(const char* cache_ctl)
{
const char* s_maxage = NULL;
@@ -195,6 +171,10 @@ time_t get_response_s_maxage(const char* cache_ctl)
{
return get_time_value(s_maxage, "s-maxage");
}
+ else
+ {
+ return 0;
+ }
}
@@ -206,6 +186,10 @@ time_t get_response_maxage(const char* cache_ctl)
{
return get_time_value(max_age, "max-age");
}
+ else
+ {
+ return 0;
+ }
}
@@ -279,8 +263,6 @@ enum cache_pending_action response_cache_control(const char* value)
enum cache_pending_action tfe_cache_put_pending(const struct tfe_http_half *response, struct response_freshness* freshness)
{
enum cache_pending_action res = UNDEFINED;
- int i = 0;
- int index = 0;
const char *value = NULL;
memset(freshness,0,sizeof(struct response_freshness));
if(response->resp_spec.resp_code!=TFE_HTTP_STATUS_OK