修正流式构建HTTP响应时,重新申请write_ctx的问题
This commit is contained in:
@@ -61,9 +61,17 @@ static int __write_http_half(struct http_half_private * hf_private,
|
|||||||
unsigned char * __to_write = evbuffer_pullup(hf_private->evbuf_raw, __to_write_len);
|
unsigned char * __to_write = evbuffer_pullup(hf_private->evbuf_raw, __to_write_len);
|
||||||
|
|
||||||
/* Write the data to stream, UPSTREAM is the incoming direction for response */
|
/* Write the data to stream, UPSTREAM is the incoming direction for response */
|
||||||
int ret = tfe_stream_write(stream, dir, __to_write, __to_write_len);
|
int ret = 0;
|
||||||
if (unlikely(ret < 0)) { assert(0); }
|
if (hf_private->write_ctx)
|
||||||
|
{
|
||||||
|
ret = tfe_stream_write_frag(hf_private->write_ctx, __to_write, __to_write_len);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = tfe_stream_write(stream, dir, __to_write, __to_write_len);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unlikely(ret < 0)) { assert(0); }
|
||||||
evbuffer_drain(hf_private->evbuf_raw, __to_write_len);
|
evbuffer_drain(hf_private->evbuf_raw, __to_write_len);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -327,6 +335,11 @@ enum tfe_stream_action __http_connection_entry_on_response(const struct tfe_stre
|
|||||||
hf_private_destory(hf_private_resp_user);
|
hf_private_destory(hf_private_resp_user);
|
||||||
hs_private->hf_private_resp_user = NULL;
|
hs_private->hf_private_resp_user = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hf_private_resp_in->stream_action == ACTION_DEFER_DATA)
|
||||||
|
{
|
||||||
|
hf_private_resp_in->stream_action = ACTION_DROP_DATA;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
__stream_action = hf_private_resp_in->stream_action;
|
__stream_action = hf_private_resp_in->stream_action;
|
||||||
|
|||||||
Reference in New Issue
Block a user