diff --git a/cache/src/tango_cache_pending.cpp b/cache/src/tango_cache_pending.cpp index 9d82c31..5786561 100644 --- a/cache/src/tango_cache_pending.cpp +++ b/cache/src/tango_cache_pending.cpp @@ -302,51 +302,3 @@ enum cache_pending_action tfe_cache_put_pending(const struct tfe_http_field *res } return res; } - -int main() -{ - printf("please input the head info\n"); - printf("first line input the head type and the num of head,0:request head 1:response head\n"); - printf("next line input the head field,date:10,pragma :14,expires:23,cache-control:25,If-Match:26,If-None-Match:27,If-Modified-since:28,If-Unmodified-since:29,Last-Modified:30\n"); - int head_type; - int head_num = 0; - scanf("%d %d", &head_type, &head_num); - struct tfe_http_field *http_heads = (struct tfe_http_field *)malloc(sizeof(struct tfe_http_field)*head_num); - printf("head type is %d and head_num is %d\n", head_type, head_num); - int i = 0; - for (; i < head_num; i++) - { - http_heads[i].value = (char *)malloc(sizeof(char) * 50); - scanf("%d ", &(http_heads[i].http_field)); - fgets(http_heads[i].value, 50, stdin); - int len = strlen(http_heads[i].value); - http_heads[i].value[len - 1] = '\0'; - printf("head field is %d and head value is %s\n", http_heads[i].http_field, http_heads[i].value); - } - enum cache_pending_action res; - struct request_freshness restrict; - struct response_freshness freshness; - switch (head_type) - { - case 0: - res = tfe_cache_get_pending(http_heads, head_num, &restrict); - printf(" request cache pending action is %d\n", res); - printf("request min-fresh is %lu,max-age=%lu\n", restrict.min_fresh, restrict.max_age); - break; - case 1: - res = tfe_cache_put_pending(http_heads, head_num, &freshness); - printf(" request cache pending action is %d\n", res); - printf("response date is %lu ,last-modified is %lu, timeout is %lu\n", freshness.date, freshness.last_modified, freshness.timeout); - break; - default: - assert(0); - break; - } - - for (i = 0; i < head_num; i++) - { - free(http_heads[i].value); - } - free(http_heads); - return 0; -}