diff --git a/platform/src/tcp_stream.cpp b/platform/src/tcp_stream.cpp index 002b5be..c73881f 100644 --- a/platform/src/tcp_stream.cpp +++ b/platform/src/tcp_stream.cpp @@ -80,7 +80,7 @@ static inline bool __is_ssl(struct tfe_stream_private * _stream) return (_stream->session_type == STREAM_PROTO_SSL); } -static void __call_plugin_close(struct tfe_stream_private * _stream) +static void call_plugin_close(struct tfe_stream_private * _stream) { unsigned int plugin_id_iter = 0; unsigned int plugin_id = 0; @@ -373,7 +373,7 @@ static void __stream_bev_passthrough_writecb(struct bufferevent * bev, void * ar if (*ref_peer_conn == NULL && *ref_this_conn == NULL) { - __call_plugin_close(_stream); + call_plugin_close(_stream); tfe_stream_destory(_stream); } @@ -431,7 +431,7 @@ __close_connection: if (*ref_this_conn == NULL && *ref_peer_conn == NULL) { - __call_plugin_close(_stream); + call_plugin_close(_stream); tfe_stream_destory(_stream); } @@ -593,7 +593,7 @@ static void __stream_bev_writecb(struct bufferevent * bev, void * arg) if (*ref_peer_conn == NULL && *ref_this_conn == NULL) { - __call_plugin_close(_stream); + call_plugin_close(_stream); tfe_stream_destory(_stream); } @@ -678,6 +678,7 @@ __close_connection: return; __call_plugin_close: + call_plugin_close(_stream); tfe_stream_destory(_stream); } diff --git a/plugin/business/pangu-http/src/pangu_http.cpp b/plugin/business/pangu-http/src/pangu_http.cpp index 3ec3c49..cc3771b 100644 --- a/plugin/business/pangu-http/src/pangu_http.cpp +++ b/plugin/business/pangu-http/src/pangu_http.cpp @@ -904,6 +904,10 @@ int make_revalidate_request(const struct tfe_stream * stream, const struct tfe_h ctx->cache_revalidate_req=NULL; return RESUMED_CB_NO_MORE_CALLS; } + if(events & EV_HTTP_REQ_END && ctx->cache_revalidate_req) + { + ctx->cache_revalidate_req=NULL; + } return RESUMED_CB_MORE_CALLS; } int dummy_resume(const struct tfe_stream * stream, const struct tfe_http_session * session, @@ -1027,6 +1031,8 @@ static void cache_pending_on_succ(future_result_t * result, void * user) } if(meta->etag) tfe_http_std_field_write(ctx->cache_revalidate_req, TFE_HTTP_IF_NONE_MATCH, meta->etag); if(meta->last_modified) tfe_http_std_field_write(ctx->cache_revalidate_req, TFE_HTTP_IF_MODIFIED_SINCE, meta->last_modified); + + tfe_http_session_request_set(ctx->ref_session, ctx->cache_revalidate_req); ctx->resumed_cb=make_revalidate_request; return; } diff --git a/plugin/business/pangu-http/src/pangu_web_cache.cpp b/plugin/business/pangu-http/src/pangu_web_cache.cpp index 267e94e..a20b2d7 100644 --- a/plugin/business/pangu-http/src/pangu_web_cache.cpp +++ b/plugin/business/pangu-http/src/pangu_web_cache.cpp @@ -441,7 +441,7 @@ static void cache_query_meta_on_succ(future_result_t * result, void * user) ctx->status=PENDING_RESULT_REVALIDATE; break; case RESULT_TYPE_USERTAG: - cached_meta_set(&ctx->cached_obj_meta, RESULT_TYPE_HEADER, _result->data_frag, _result->size); + cached_meta_set(&ctx->cached_obj_meta, RESULT_TYPE_USERTAG, _result->data_frag, _result->size); TFE_LOG_DEBUG(ctx->ref_handle->logger, "cache meta query hit: %s %s %s" , ctx->url , ctx->cached_obj_meta.last_modified ? ctx->cached_obj_meta.last_modified:"no_last_modify"