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:
parent
d67b050935
commit
74799a31e3
6 changed files with 18 additions and 14 deletions
|
@ -1700,13 +1700,17 @@ srs_error_t SrsHttpApi::on_start()
|
|||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsHttpApi::on_http_message(ISrsHttpMessage* req)
|
||||
srs_error_t SrsHttpApi::on_http_message(ISrsHttpMessage* r, SrsHttpResponseWriter* w)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
// TODO: For each API session, we use short-term HTTP connection.
|
||||
//SrsHttpHeader* hdr = w->header();
|
||||
//hdr->set("Connection", "Close");
|
||||
|
||||
// read all rest bytes in request body.
|
||||
char buf[SRS_HTTP_READ_CACHE_BYTES];
|
||||
ISrsHttpResponseReader* br = req->body_reader();
|
||||
ISrsHttpResponseReader* br = r->body_reader();
|
||||
while (!br->eof()) {
|
||||
if ((err = br->read(buf, SRS_HTTP_READ_CACHE_BYTES, NULL)) != srs_success) {
|
||||
return srs_error_wrap(err, "read response");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue