diff --git a/ext/json11/json11.cpp b/ext/json11/json11.cpp index 77bf0d7174e5..a0ed9645da16 100644 --- a/ext/json11/json11.cpp +++ b/ext/json11/json11.cpp @@ -93,10 +93,18 @@ static void dump(const string &value, string &out) { out += "\\r"; } else if (ch == '\t') { out += "\\t"; - } else if (static_cast(ch) <= 0x1f || static_cast(ch) >= 0x7f) { + } else if (static_cast(ch) <= 0x1f) { char buf[8]; snprintf(buf, sizeof buf, "\\u%04x", ch); out += buf; + } else if (static_cast(ch) == 0xe2 && static_cast(value[i+1]) == 0x80 + && static_cast(value[i+2]) == 0xa8) { + out += "\\u2028"; + i += 2; + } else if (static_cast(ch) == 0xe2 && static_cast(value[i+1]) == 0x80 + && static_cast(value[i+2]) == 0xa9) { + out += "\\u2029"; + i += 2; } else { out += ch; } diff --git a/pdns/webserver.cc b/pdns/webserver.cc index 43cd180e8225..f417561f3b36 100644 --- a/pdns/webserver.cc +++ b/pdns/webserver.cc @@ -535,7 +535,7 @@ void WebServer::serveConnection(const std::shared_ptr& client) const { } if (d_loglevel >= WebServer::LogLevel::Normal) { - SLOG(g_log<info(Logr::Info, "Request", "remote", Logging::Loggable(remote), "method", Logging::Loggable(req.method), "urlpath", Logging::Loggable(req.url.path), "HTTPVersion", Logging::Loggable(req.versionStr(req.version)), "status", Logging::Loggable(resp.status), "respsize", Logging::Loggable(reply.size()))); diff --git a/regression-tests.api/test_Servers.py b/regression-tests.api/test_Servers.py index c9f59d19c1a0..47122ebb1593 100644 --- a/regression-tests.api/test_Servers.py +++ b/regression-tests.api/test_Servers.py @@ -2,7 +2,6 @@ import operator import requests import unittest -import socket from test_helper import ApiTestCase, is_auth, is_recursor, is_auth_lmdb @@ -42,18 +41,13 @@ def test_read_config(self): self.assertIn('daemon', data) def test_read_statistics(self): - # Use low-level API as we want to create an invalid request to test log line encoding - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM); - sock.connect((self.server_address, self.server_port)) - sock.send(b'GET /binary\x00\x01\xeb HTTP/1.0\r\n') - sock.close() r = self.session.get(self.url("/api/v1/servers/localhost/statistics")) self.assert_success_json(r) data = r.json() self.assertIn('uptime', [e['name'] for e in data]) print(data) if is_auth(): - qtype_stats, respsize_stats, queries_stats, rcode_stats, logmessages = None, None, None, None, None + qtype_stats, respsize_stats, queries_stats, rcode_stats = None, None, None, None for elem in data: if elem['type'] == 'MapStatisticItem' and elem['name'] == 'response-by-qtype': qtype_stats = elem['value'] @@ -63,13 +57,10 @@ def test_read_statistics(self): queries_stats = elem['value'] elif elem['type'] == 'MapStatisticItem' and elem['name'] == 'response-by-rcode': rcode_stats = elem['value'] - elif elem['type'] == 'RingStatisticItem' and elem['name'] == 'logmessages': - logmessages = elem['value'] self.assertIn('A', [e['name'] for e in qtype_stats]) self.assertIn('80', [e['name'] for e in respsize_stats]) self.assertIn('example.com/A', [e['name'] for e in queries_stats]) self.assertIn('No Error', [e['name'] for e in rcode_stats]) - self.assertTrue(logmessages[0]['name'].startswith('[webserver]')) else: qtype_stats, respsize_stats, rcode_stats = None, None, None for elem in data: