MCPcopy Create free account
hub / github.com/acl-dev/acl / transfer_request_body

Method transfer_request_body

app/wizard_demo/httpd_proxy/http_transfer.cpp:153–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151}
152
153bool 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
181bool http_transfer::transfer_get(void) {
182 if (!open_peer(req_, conn_)) {

Callers

nothing calls this directly

Calls 3

getContentLengthMethod · 0.80
readMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected