diff --git a/plugin/business/pangu-http/pangu_http.cpp b/plugin/business/pangu-http/pangu_http.cpp index 152f531..6610b7c 100644 --- a/plugin/business/pangu-http/pangu_http.cpp +++ b/plugin/business/pangu-http/pangu_http.cpp @@ -480,7 +480,7 @@ static void cache_query_on_succ(future_result_t * result, void * user) case CACHE_QUERY_RESULT_MISS: ctx->cache_query_status=WEB_CACHE_NOT_HIT; printf("cache query miss: %s\n", ctx->ref_session->req->req_spec.url); - ctx->resume_from_cache_query=1; + ctx->resume_from_cache_query=1; tfe_http_session_resume(ctx->ref_session); future_destroy(ctx->f_cache_query); ctx->f_cache_query=NULL; @@ -495,9 +495,18 @@ static void cache_query_on_fail(enum e_future_error err, const char * what, void struct pangu_http_ctx * ctx = (struct pangu_http_ctx *)user; future_destroy(ctx->f_cache_query); ctx->f_cache_query=NULL; - tfe_http_session_resume(ctx->ref_session); ctx->cache_query_status=WEB_CACHE_NOT_HIT; - ctx->resume_from_cache_query=1; + ctx->resume_from_cache_query=1; + if(!ctx->cached_response) + { + tfe_http_session_resume(ctx->ref_session); + } + else + { + tfe_http_half_write_body_end(ctx->cached_response); + ctx->cached_response=NULL; + } + printf("cache query failed: %s %s\n", ctx->ref_session->req->req_spec.url, what); } void http_replace(const struct tfe_stream * stream, const struct tfe_http_session * session,