MCPcopy Create free account
hub / github.com/PurpleI2P/i2pd / MergeChunkedResponse

Function MergeChunkedResponse

libi2pd/HTTP.cpp:579–600  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

577 }
578
579 bool MergeChunkedResponse (std::istream& in, std::ostream& out)
580 {
581 std::string hexLen;
582 while (!in.eof ())
583 {
584 std::getline (in, hexLen);
585 errno = 0;
586 long int len = strtoul(hexLen.c_str(), (char **) NULL, 16);
587 if (errno != 0)
588 return false; /* conversion error */
589 if (len == 0)
590 return true; /* end of stream */
591 if (len < 0 || len > 10 * 1024 * 1024) /* < 10Mb */
592 return false; /* too large chunk */
593 char * buf = new char[len];
594 in.read (buf, len);
595 out.write (buf, len);
596 delete[] buf;
597 std::getline (in, hexLen); // read \r\n after chunk
598 }
599 return true;
600 }
601
602 std::string CreateBasicAuthorizationString (const std::string& user, const std::string& pass)
603 {

Callers 3

MakeRequestMethod · 0.85
mainFunction · 0.85
ReseedRequestMethod · 0.85

Calls 1

writeMethod · 0.80

Tested by 1

mainFunction · 0.68