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

refine http request post. 2.0.132.

This commit is contained in:
winlin 2015-03-06 11:51:20 +08:00
parent 3982ec1d87
commit 964e4be9d4
6 changed files with 88 additions and 259 deletions

View file

@ -1181,22 +1181,8 @@ int SrsHttpMessage::body_read_all(string& body)
{
int ret = ERROR_SUCCESS;
// chunked, always read with
if (chunked) {
return _body->read(body);
}
int content_length = (int)(int64_t)_header.content_length;
// ignore if not set, should be zero length body.
if (content_length <= 0) {
srs_info("unspecified content-length with body empty.");
return ret;
}
// when content length specified, read specified length.
int expect = content_length + (int)body.length();
while ((int)body.length() < expect) {
// whatever, read util EOF.
while (!_body->eof()) {
if ((ret = _body->read(body)) != ERROR_SUCCESS) {
return ret;
}