正在显示
2 个修改的文件
包含
11 行增加
和
11 行删除
@@ -1315,17 +1315,6 @@ int SrsHttpParser::parse_message_imp(SrsStSocket* skt) | @@ -1315,17 +1315,6 @@ int SrsHttpParser::parse_message_imp(SrsStSocket* skt) | ||
1315 | srs_info("buffer=%d, nparsed=%d, body=%d", buffer->size(), (int)nparsed, body_parsed); | 1315 | srs_info("buffer=%d, nparsed=%d, body=%d", buffer->size(), (int)nparsed, body_parsed); |
1316 | } | 1316 | } |
1317 | 1317 | ||
1318 | - // when nothing parsed, read more to parse. | ||
1319 | - if (nparsed == 0) { | ||
1320 | - // when requires more, only grow 1bytes, but the buffer will cache more. | ||
1321 | - if ((ret = buffer->grow(skt, buffer->size() + 1)) != ERROR_SUCCESS) { | ||
1322 | - if (!srs_is_client_gracefully_close(ret)) { | ||
1323 | - srs_error("read body from server failed. ret=%d", ret); | ||
1324 | - } | ||
1325 | - return ret; | ||
1326 | - } | ||
1327 | - } | ||
1328 | - | ||
1329 | // consume the parsed bytes. | 1318 | // consume the parsed bytes. |
1330 | if (nparsed && nparsed - body_parsed > 0) { | 1319 | if (nparsed && nparsed - body_parsed > 0) { |
1331 | buffer->read_slice(nparsed - body_parsed); | 1320 | buffer->read_slice(nparsed - body_parsed); |
@@ -1336,6 +1325,17 @@ int SrsHttpParser::parse_message_imp(SrsStSocket* skt) | @@ -1336,6 +1325,17 @@ int SrsHttpParser::parse_message_imp(SrsStSocket* skt) | ||
1336 | if (state == SrsHttpParseStateHeaderComplete || state == SrsHttpParseStateMessageComplete) { | 1325 | if (state == SrsHttpParseStateHeaderComplete || state == SrsHttpParseStateMessageComplete) { |
1337 | break; | 1326 | break; |
1338 | } | 1327 | } |
1328 | + | ||
1329 | + // when nothing parsed, read more to parse. | ||
1330 | + if (nparsed == 0) { | ||
1331 | + // when requires more, only grow 1bytes, but the buffer will cache more. | ||
1332 | + if ((ret = buffer->grow(skt, buffer->size() + 1)) != ERROR_SUCCESS) { | ||
1333 | + if (!srs_is_client_gracefully_close(ret)) { | ||
1334 | + srs_error("read body from server failed. ret=%d", ret); | ||
1335 | + } | ||
1336 | + return ret; | ||
1337 | + } | ||
1338 | + } | ||
1339 | } | 1339 | } |
1340 | 1340 | ||
1341 | // parse last header. | 1341 | // parse last header. |
-
请 注册 或 登录 后发表评论