File tree Expand file tree Collapse file tree 2 files changed +15
-15
lines changed
Expand file tree Collapse file tree 2 files changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -1612,14 +1612,6 @@ class coro_http_client : public std::enable_shared_from_this<coro_http_client> {
16121612 break ;
16131613 }
16141614
1615- if (chunk_size == 0 ) {
1616- // all finished, no more data
1617- chunked_buf_.consume (CRCF.size ());
1618- data.status = 200 ;
1619- data.eof = true ;
1620- break ;
1621- }
1622-
16231615 if (additional_size < size_t (chunk_size + 2 )) {
16241616 // not a complete chunk, read left chunk data.
16251617 size_t size_to_read = chunk_size + 2 - additional_size;
@@ -1630,6 +1622,14 @@ class coro_http_client : public std::enable_shared_from_this<coro_http_client> {
16301622 }
16311623 }
16321624
1625+ if (chunk_size == 0 ) {
1626+ // all finished, no more data
1627+ chunked_buf_.consume (chunked_buf_.size ());
1628+ data.status = 200 ;
1629+ data.eof = true ;
1630+ break ;
1631+ }
1632+
16331633 data_ptr = asio::buffer_cast<const char *>(chunked_buf_.data ());
16341634 if (ctx.stream ) {
16351635 ec = co_await ctx.stream ->async_write (data_ptr, chunk_size);
Original file line number Diff line number Diff line change @@ -524,13 +524,6 @@ class coro_http_connection
524524
525525 chunked_buf_.consume (size);
526526
527- if (chunk_size == 0 ) {
528- // all finished, no more data
529- chunked_buf_.consume (CRCF.size ());
530- result.eof = true ;
531- co_return result;
532- }
533-
534527 if (additional_size < size_t (chunk_size + 2 )) {
535528 // not a complete chunk, read left chunk data.
536529 size_t size_to_read = chunk_size + 2 - additional_size;
@@ -542,6 +535,13 @@ class coro_http_connection
542535 }
543536 }
544537
538+ if (chunk_size == 0 ) {
539+ // all finished, no more data
540+ chunked_buf_.consume (chunked_buf_.size ());
541+ result.eof = true ;
542+ co_return result;
543+ }
544+
545545 data_ptr = asio::buffer_cast<const char *>(chunked_buf_.data ());
546546 result.data = std::string_view{data_ptr, (size_t )chunk_size};
547547 chunked_buf_.consume (chunk_size + CRCF.size ());
You can’t perform that action at this time.
0 commit comments