Commit 570f034
committed
httpclient: read_body should return 0 at EOF
When users call `git_http_client_read_body`, it should return 0 at the
end of a message. When the `on_message_complete` callback is called,
this will set `client->state` to `DONE`. In our read loop, we look for
this condition and exit.
Without this, when there is no data left except the end of message chunk
(`0\r\n`) in the http stream, we would block by reading the three bytes
off the stream but not making progress in any `on_body` callbacks.
Listening to the `on_message_complete` callback allows us to stop trying
to read from the socket when we've read the end of message chunk.1 parent b7bdb07 commit 570f034
1 file changed
+8
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1419 | 1419 | | |
1420 | 1420 | | |
1421 | 1421 | | |
1422 | | - | |
1423 | | - | |
1424 | | - | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
1425 | 1427 | | |
1426 | 1428 | | |
1427 | 1429 | | |
1428 | 1430 | | |
1429 | 1431 | | |
1430 | 1432 | | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
1431 | 1436 | | |
1432 | 1437 | | |
1433 | 1438 | | |
| |||
0 commit comments