diff --git a/plugin/business/pangu-http/src/pangu_http.cpp b/plugin/business/pangu-http/src/pangu_http.cpp index 1fb17b0..1e8634f 100644 --- a/plugin/business/pangu-http/src/pangu_http.cpp +++ b/plugin/business/pangu-http/src/pangu_http.cpp @@ -518,7 +518,7 @@ static void pangu_http_ctx_free(struct pangu_http_ctx * ctx) } if(ctx->cached_response) { - tfe_http_half_free(ctx->cached_response); + //Dirty close ctx->cached_response=NULL; } @@ -1098,8 +1098,11 @@ static void cache_read_on_succ(future_result_t * result, void * user) tfe_http_nonstd_field_write(ctx->cached_response, "X-Cache-Lookup", "Hit From TFE"); snprintf(temp, sizeof(temp), "%lu", meta->content_length); tfe_http_std_field_write(ctx->cached_response, TFE_HTTP_CONT_LENGTH, temp); - + + //Dirty code here. tfe_http_session_response_set(ctx->ref_session, ctx->cached_response); + //From now, ownership of cached_response has been transfered to http session, + //bussines plugin only hold this pointer as an reference for writing response body. tfe_http_half_write_body_begin(ctx->cached_response, 1); meta=NULL;