| 36 | } |
| 37 | |
| 38 | bool Client::read_next(RequestBody &req) { |
| 39 | if (waiting_write_response) |
| 40 | return false; |
| 41 | if (!receiving_body) |
| 42 | return false; |
| 43 | size_t expect_count = request.has_content_length() ? request.content_length : 0; |
| 44 | if (receiving_body_stream.size() != expect_count) |
| 45 | return false; |
| 46 | req.body = std::move(receiving_body_stream.buffer()); |
| 47 | receiving_body_stream.clear(); |
| 48 | req.r = std::move(request); |
| 49 | request = http::RequestHeader{}; |
| 50 | parser.reset(); |
| 51 | receiving_body = false; |
| 52 | waiting_write_response = true; |
| 53 | return true; |
| 54 | } |
| 55 | |
| 56 | void Client::write() { |
| 57 | while (!responses.empty()) { |
nothing calls this directly
no test coverage detected