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

Method readLine

src/Server/HTTP/HTMLForm.cpp:285–318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

283}
284
285std::string HTMLForm::MultipartReadBuffer::readLine(bool append_crlf)
286{
287 std::string line;
288 char ch = 0; // silence "uninitialized" warning from gcc-*
289
290 /// If we don't append CRLF, it means that we may have to prepend CRLF from previous content line, which wasn't the boundary.
291 if (in.read(ch))
292 line += ch;
293 if (in.read(ch))
294 line += ch;
295 if (append_crlf && line == "\r\n")
296 return line;
297
298 while (!in.eof())
299 {
300 while (in.read(ch) && ch != '\r')
301 line += ch;
302
303 if (in.eof()) break;
304
305 chassert(ch == '\r');
306
307 if (in.peek(ch) && ch == '\n')
308 {
309 in.ignore();
310 if (append_crlf) line += "\r\n";
311 break;
312 }
313
314 line += ch;
315 }
316
317 return line;
318}
319
320bool HTMLForm::MultipartReadBuffer::nextImpl()
321{

Callers

nothing calls this directly

Calls 4

readMethod · 0.45
eofMethod · 0.45
peekMethod · 0.45
ignoreMethod · 0.45

Tested by

no test coverage detected