修正http解析层和业务层的若干bug。

This commit is contained in:
zhengchao
2018-10-25 21:13:37 +08:00
parent 96feddefb8
commit a55e63f523
3 changed files with 12 additions and 5 deletions

View File

@@ -80,7 +80,7 @@ static inline bool __is_ssl(struct tfe_stream_private * _stream)
return (_stream->session_type == STREAM_PROTO_SSL); 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_iter = 0;
unsigned int plugin_id = 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) if (*ref_peer_conn == NULL && *ref_this_conn == NULL)
{ {
__call_plugin_close(_stream); call_plugin_close(_stream);
tfe_stream_destory(_stream); tfe_stream_destory(_stream);
} }
@@ -431,7 +431,7 @@ __close_connection:
if (*ref_this_conn == NULL && *ref_peer_conn == NULL) if (*ref_this_conn == NULL && *ref_peer_conn == NULL)
{ {
__call_plugin_close(_stream); call_plugin_close(_stream);
tfe_stream_destory(_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) if (*ref_peer_conn == NULL && *ref_this_conn == NULL)
{ {
__call_plugin_close(_stream); call_plugin_close(_stream);
tfe_stream_destory(_stream); tfe_stream_destory(_stream);
} }
@@ -678,6 +678,7 @@ __close_connection:
return; return;
__call_plugin_close: __call_plugin_close:
call_plugin_close(_stream);
tfe_stream_destory(_stream); tfe_stream_destory(_stream);
} }

View File

@@ -904,6 +904,10 @@ int make_revalidate_request(const struct tfe_stream * stream, const struct tfe_h
ctx->cache_revalidate_req=NULL; ctx->cache_revalidate_req=NULL;
return RESUMED_CB_NO_MORE_CALLS; 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; return RESUMED_CB_MORE_CALLS;
} }
int dummy_resume(const struct tfe_stream * stream, const struct tfe_http_session * session, 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->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); 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; ctx->resumed_cb=make_revalidate_request;
return; return;
} }

View File

@@ -441,7 +441,7 @@ static void cache_query_meta_on_succ(future_result_t * result, void * user)
ctx->status=PENDING_RESULT_REVALIDATE; ctx->status=PENDING_RESULT_REVALIDATE;
break; break;
case RESULT_TYPE_USERTAG: 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" TFE_LOG_DEBUG(ctx->ref_handle->logger, "cache meta query hit: %s %s %s"
, ctx->url , ctx->url
, ctx->cached_obj_meta.last_modified ? ctx->cached_obj_meta.last_modified:"no_last_modify" , ctx->cached_obj_meta.last_modified ? ctx->cached_obj_meta.last_modified:"no_last_modify"