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

refine the http code.

This commit is contained in:
winlin 2015-06-14 19:42:43 +08:00
parent f8f6e438cc
commit 3211282b0c
4 changed files with 18 additions and 14 deletions

View file

@ -1204,25 +1204,27 @@ int SrsHttpConn::process_request(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
return ret;
}
SrsStaticHttpConn::SrsStaticHttpConn(IConnectionManager* cm, st_netfd_t fd, ISrsHttpServeMux* m)
SrsResponseOnlyHttpConn::SrsResponseOnlyHttpConn(IConnectionManager* cm, st_netfd_t fd, ISrsHttpServeMux* m)
: SrsHttpConn(cm, fd, m)
{
}
SrsStaticHttpConn::~SrsStaticHttpConn()
SrsResponseOnlyHttpConn::~SrsResponseOnlyHttpConn()
{
}
int SrsStaticHttpConn::on_got_http_message(ISrsHttpMessage* msg)
int SrsResponseOnlyHttpConn::on_got_http_message(ISrsHttpMessage* msg)
{
int ret = ERROR_SUCCESS;
// TODO: FIXME: use the post body.
std::string res;
ISrsHttpResponseReader* br = msg->body_reader();
// get response body.
if ((ret = msg->body_read_all(res)) != ERROR_SUCCESS) {
return ret;
// drop all request body.
while (!br->eof()) {
char body[4096];
if ((ret = br->read(body, 4096, NULL)) != ERROR_SUCCESS) {
return ret;
}
}
return ret;