@@ -1183,30 +1183,31 @@ srs_error_t SrsHttpResponseReader::read_chunked(void* data, size_t nb_data, ssiz
1183
1183
if (nb_read) {
1184
1184
*nb_read = 0 ;
1185
1185
}
1186
- } else {
1187
- // for not the last chunk, there must always exists bytes.
1188
- // left bytes in chunk, read some.
1189
- srs_assert (nb_left_chunk);
1190
-
1191
- size_t nb_bytes = srs_min (nb_left_chunk, nb_data);
1192
- err = read_specified (data, nb_bytes, (ssize_t *)&nb_bytes);
1193
-
1194
- // the nb_bytes used for output already read size of bytes.
1195
- if (nb_read) {
1196
- *nb_read = nb_bytes;
1197
- }
1198
- nb_left_chunk -= nb_bytes;
1186
+ return err;
1187
+ }
1199
1188
1200
- if (err != srs_success) {
1201
- return srs_error_wrap (err, " read specified " );
1202
- }
1189
+ // for not the last chunk, there must always exists bytes.
1190
+ // left bytes in chunk, read some.
1191
+ srs_assert (nb_left_chunk);
1203
1192
1204
- // If still left bytes in chunk, ignore and read in future.
1205
- if (nb_left_chunk > 0 ) {
1206
- return err;
1207
- }
1193
+ size_t nb_bytes = srs_min (nb_left_chunk, nb_data);
1194
+ err = read_specified (data, nb_bytes, (ssize_t *)&nb_bytes);
1195
+
1196
+ // the nb_bytes used for output already read size of bytes.
1197
+ if (nb_read) {
1198
+ *nb_read = nb_bytes;
1208
1199
}
1209
-
1200
+ nb_left_chunk -= nb_bytes;
1201
+
1202
+ if (err != srs_success) {
1203
+ return srs_error_wrap (err, " read specified" );
1204
+ }
1205
+
1206
+ // If still left bytes in chunk, ignore and read in future.
1207
+ if (nb_left_chunk > 0 ) {
1208
+ return err;
1209
+ }
1210
+
1210
1211
// for both the last or not, the CRLF of chunk payload end.
1211
1212
if ((err = buffer->grow (skt, 2 )) != srs_success) {
1212
1213
return srs_error_wrap (err, " grow buffer" );
0 commit comments