mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-17 17:08:39 +00:00
Print announce error response (#11878)
Fix HTTPFetch caller and request ID to 64 bits Check that allocated caller ID is not DISCARD Print body if serverlist request returns error Don't print control characters from HTTP responses Document special HTTPFetch caller IDs Allow unicode to be printed
This commit is contained in:
parent
544b9d5c72
commit
29d2b2ccd0
6 changed files with 73 additions and 36 deletions
|
@ -887,3 +887,19 @@ std::string sanitizeDirName(const std::string &str, const std::string &optional_
|
|||
|
||||
return wide_to_utf8(safe_name);
|
||||
}
|
||||
|
||||
|
||||
void safe_print_string(std::ostream &os, const std::string &str)
|
||||
{
|
||||
std::ostream::fmtflags flags = os.flags();
|
||||
os << std::hex;
|
||||
for (const char c : str) {
|
||||
if (IS_ASCII_PRINTABLE_CHAR(c) || IS_UTF8_MULTB_START(c) ||
|
||||
IS_UTF8_MULTB_INNER(c) || c == '\n' || c == '\t') {
|
||||
os << c;
|
||||
} else {
|
||||
os << '<' << std::setw(2) << (int)c << '>';
|
||||
}
|
||||
}
|
||||
os.setf(flags);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue