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

Method prepareSubmit

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

Source from the content-addressed store, hash-verified

203
204
205void HTMLForm::prepareSubmit(HTTPRequest& request, int options)
206{
207 if (request.getMethod() == HTTPRequest::HTTP_POST || request.getMethod() == HTTPRequest::HTTP_PUT)
208 {
209 if (_encoding == ENCODING_URL)
210 {
211 request.setContentType(_encoding);
212 request.setChunkedTransferEncoding(false);
213 Poco::CountingOutputStream ostr;
214 writeUrl(ostr);
215 request.setContentLength(ostr.chars());
216 }
217 else
218 {
219 _boundary = MultipartWriter::createBoundary();
220 std::string ct(_encoding);
221 ct.append("; boundary=\"");
222 ct.append(_boundary);
223 ct.append("\"");
224 request.setContentType(ct);
225 }
226 if (request.getVersion() == HTTPMessage::HTTP_1_0)
227 {
228 request.setKeepAlive(false);
229 request.setChunkedTransferEncoding(false);
230 }
231 else if (_encoding != ENCODING_URL && (options & OPT_USE_CONTENT_LENGTH) == 0)
232 {
233 request.setChunkedTransferEncoding(true);
234 }
235 if (!request.getChunkedTransferEncoding() && !request.hasContentLength())
236 {
237 request.setContentLength(calculateContentLength());
238 }
239 }
240 else
241 {
242 std::string uri = request.getURI();
243 std::ostringstream ostr;
244 writeUrl(ostr);
245 uri.append("?");
246 uri.append(ostr.str());
247 request.setURI(uri);
248 }
249}
250
251
252std::streamsize HTMLForm::calculateContentLength()

Callers

nothing calls this directly

Calls 12

setContentLengthMethod · 0.80
charsMethod · 0.80
hasContentLengthMethod · 0.80
getURIMethod · 0.80
setContentTypeMethod · 0.45
appendMethod · 0.45
getVersionMethod · 0.45
setKeepAliveMethod · 0.45
strMethod · 0.45
setURIMethod · 0.45

Tested by

no test coverage detected