支持缓存校验。

This commit is contained in:
zhengchao
2018-10-25 18:45:33 +08:00
parent 990e247155
commit 27d4581d9b
7 changed files with 523 additions and 211 deletions

View File

@@ -7,7 +7,7 @@ enum cache_pending_action {
UNDEFINED = 0,
ALLOWED,
FORBIDDEN,
VERIFY
REVALIDATE
};
@@ -30,6 +30,8 @@ struct response_freshness{
time_t timeout;
};
time_t read_GMT_time(const char* gmt_string);
/*
函数功能:
根据请求头字段判断是否允许将缓存作为该请求的响应,并且将请求字段对缓存新鲜度的约束范围作为传出参数返回给调用者
@@ -41,7 +43,7 @@ restrict:如果该函数返回值为ALLOWED则返回请求Cache-Control字段
UNDEFINED = 0,//请求字段中未定义缓存的行为
ALLOWED ,//允许使用缓存作为该请求的响应
FORBIDDEN,//禁止使用缓存作为该请求的响应,需要向源服务器请求
VERIFY,//禁止使用未验证有效性的缓存作为该请求的响应
REVALIDATE,//禁止使用未验证有效性的缓存作为该请求的响应
*/
enum cache_pending_action tfe_cache_get_pending(const struct tfe_http_half *request, struct request_freshness* restrict);
@@ -59,4 +61,4 @@ UNDEFINED = 0,//响应字段中未定义缓存的行为
ALLOWED ,//允许缓存该响应
FORBIDDEN,//禁止缓存该响应
*/
enum cache_pending_action tfe_cache_put_pending(const struct tfe_http_half *response, struct response_freshness* freshness);
enum cache_pending_action tfe_cache_put_pending(const struct tfe_http_half *response, struct response_freshness* freshness);