1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

For #1657, refine on_http_message with response writer

This commit is contained in:
winlin 2020-11-05 18:08:13 +08:00
parent d67b050935
commit 74799a31e3
6 changed files with 18 additions and 14 deletions

View file

@ -200,14 +200,14 @@ srs_error_t SrsHttpConn::do_cycle()
// copy request to last request object.
srs_freep(last_req);
last_req = hreq->to_request(hreq->host());
// may should discard the body.
if ((err = handler_->on_http_message(req)) != srs_success) {
SrsHttpResponseWriter writer(skt);
if ((err = handler_->on_http_message(req, &writer)) != srs_success) {
break;
}
// ok, handle http request.
SrsHttpResponseWriter writer(skt);
if ((err = process_request(&writer, req)) != srs_success) {
break;
}
@ -365,14 +365,14 @@ srs_error_t SrsResponseOnlyHttpConn::on_start()
return srs_success;
}
srs_error_t SrsResponseOnlyHttpConn::on_http_message(ISrsHttpMessage* msg)
srs_error_t SrsResponseOnlyHttpConn::on_http_message(ISrsHttpMessage* r, SrsHttpResponseWriter* w)
{
srs_error_t err = srs_success;
ISrsHttpResponseReader* br = msg->body_reader();
ISrsHttpResponseReader* br = r->body_reader();
// when not specified the content length, ignore.
if (msg->content_length() == -1) {
if (r->content_length() == -1) {
return err;
}