MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / writeMultipart

Method writeMultipart

base/poco/Net/src/HTMLForm.cpp:401–448  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

399
400
401void HTMLForm::writeMultipart(std::ostream& ostr)
402{
403 HTMLFormCountingOutputStream* pCountingOutputStream(dynamic_cast<HTMLFormCountingOutputStream*>(&ostr));
404
405 MultipartWriter writer(ostr, _boundary);
406 for (NameValueCollection::ConstIterator it = begin(); it != end(); ++it)
407 {
408 MessageHeader header;
409 std::string disp("form-data; name=\"");
410 disp.append(it->first);
411 disp.append("\"");
412 header.set("Content-Disposition", disp);
413 writer.nextPart(header);
414 ostr << it->second;
415 }
416 for (PartVec::iterator ita = _parts.begin(); ita != _parts.end(); ++ita)
417 {
418 MessageHeader header(ita->pSource->headers());
419 std::string disp("form-data; name=\"");
420 disp.append(ita->name);
421 disp.append("\"");
422 std::string filename = ita->pSource->filename();
423 if (!filename.empty())
424 {
425 disp.append("; filename=\"");
426 disp.append(filename);
427 disp.append("\"");
428 }
429 header.set("Content-Disposition", disp);
430 header.set("Content-Type", ita->pSource->mediaType());
431 writer.nextPart(header);
432 if (pCountingOutputStream)
433 {
434 // count only, don't move stream position
435 std::streamsize partlen = ita->pSource->getContentLength();
436 if (partlen != PartSource::UNKNOWN_CONTENT_LENGTH)
437 pCountingOutputStream->addChars(static_cast<int>(partlen));
438 else
439 pCountingOutputStream->setValid(false);
440 }
441 else
442 {
443 StreamCopier::copyStream(ita->pSource->stream(), ostr);
444 }
445 }
446 writer.close();
447 _boundary = writer.boundary();
448}
449
450
451void HTMLForm::setFieldLimit(int limit)

Callers

nothing calls this directly

Calls 13

beginFunction · 0.85
addCharsMethod · 0.80
setValidMethod · 0.80
endFunction · 0.50
appendMethod · 0.45
setMethod · 0.45
nextPartMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45
getContentLengthMethod · 0.45
streamMethod · 0.45

Tested by

no test coverage detected