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

Method save_param

lib_acl_cpp/src/http/http_mime.cpp:269–292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267}
268
269bool http_mime::save_param(ostream &out, const std::string& bound,
270 const std::pair<std::string, std::string>& param) {
271 string buf;
272 buf.copy(bound.c_str(), bound.size());
273 buf.append("\r\n");
274
275 const char disposition[] = "Content-Disposition: form-data; name=\"";
276 buf.append(disposition, sizeof(disposition) - 1);
277 if (!param.first.empty()) {
278 buf.append(param.first.c_str(), param.first.size());
279 }
280 buf.append("\"\r\n\r\n");
281
282 if (!param.second.empty()) {
283 buf.append(param.second.c_str(), param.second.size());
284 }
285 buf.append("\r\n");
286
287 if (out.write(buf) == false) {
288 logger_error("write to file error: %s", last_serror());
289 return false;
290 }
291 return true;
292}
293
294bool http_mime::save_file(ostream &out, const std::string& bound,
295 const std::pair<std::string, pair_value>& file) {

Callers

nothing calls this directly

Calls 6

last_serrorFunction · 0.50
c_strMethod · 0.45
sizeMethod · 0.45
appendMethod · 0.45
emptyMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected