| 151 | } |
| 152 | |
| 153 | bool http_transfer::transfer_request_body(acl::socket_stream& conn) { |
| 154 | long long length = req_.getContentLength(); |
| 155 | if (length <= 0) { |
| 156 | return true; |
| 157 | } |
| 158 | |
| 159 | long long n = 0; |
| 160 | char buf[8192]; |
| 161 | |
| 162 | acl::istream* in = &req_.getInputStream(); |
| 163 | while (n < length) { |
| 164 | int ret = in->read(buf, sizeof(buf), false); |
| 165 | if (ret == -1) { |
| 166 | logger_error("read request body error"); |
| 167 | return false; |
| 168 | } |
| 169 | |
| 170 | if (conn.write(buf, ret) == -1) { |
| 171 | logger_error("send request body error"); |
| 172 | return false; |
| 173 | } |
| 174 | |
| 175 | n += ret; |
| 176 | } |
| 177 | |
| 178 | return true; |
| 179 | } |
| 180 | |
| 181 | bool http_transfer::transfer_get(void) { |
| 182 | if (!open_peer(req_, conn_)) { |
nothing calls this directly
no test coverage detected