summaryrefslogtreecommitdiffstats
path: root/src/lib/http/connection.cc
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2022-03-31 18:48:28 +0200
committerTomek Mrugalski <tomek@isc.org>2022-04-22 13:34:00 +0200
commita28d5e6d436e7f63486535ad417b08c5d56bf0f7 (patch)
treed1c2c2968886a1256b6f6570571bb83c39d59f49 /src/lib/http/connection.cc
parent[#2352] changelog now mentions debuglevel (diff)
downloadkea-a28d5e6d436e7f63486535ad417b08c5d56bf0f7.tar.xz
kea-a28d5e6d436e7f63486535ad417b08c5d56bf0f7.zip
[#687] Added the remote address in the json
Diffstat (limited to 'src/lib/http/connection.cc')
-rw-r--r--src/lib/http/connection.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/lib/http/connection.cc b/src/lib/http/connection.cc
index b1e57bddbe..ba0b8f7a20 100644
--- a/src/lib/http/connection.cc
+++ b/src/lib/http/connection.cc
@@ -401,11 +401,13 @@ HttpConnection::socketReadCallback(HttpConnection::TransactionPtr transaction,
// Receiving is in progress, so push back the timeout.
setupRequestTimer(transaction);
+ const std::string& remote = getRemoteEndpointAddressAsText();
+
if (length != 0) {
LOG_DEBUG(http_logger, isc::log::DBGLVL_TRACE_DETAIL_DATA,
HTTP_DATA_RECEIVED)
.arg(length)
- .arg(getRemoteEndpointAddressAsText());
+ .arg(remote);
transaction->getParser()->postBuffer(static_cast<void*>(transaction->getInputBufData()),
length);
@@ -420,6 +422,7 @@ HttpConnection::socketReadCallback(HttpConnection::TransactionPtr transaction,
} else {
try {
// The whole message has been received, so let's finalize it.
+ transaction->getRequest()->setRemote(remote);
transaction->getRequest()->finalize();
LOG_DEBUG(http_logger, isc::log::DBGLVL_TRACE_BASIC,
@@ -428,18 +431,18 @@ HttpConnection::socketReadCallback(HttpConnection::TransactionPtr transaction,
LOG_DEBUG(http_logger, isc::log::DBGLVL_TRACE_BASIC_DATA,
HTTP_CLIENT_REQUEST_RECEIVED_DETAILS)
- .arg(getRemoteEndpointAddressAsText())
+ .arg(remote)
.arg(transaction->getParser()->getBufferAsString(MAX_LOGGED_MESSAGE_SIZE));
} catch (const std::exception& ex) {
LOG_DEBUG(http_logger, isc::log::DBGLVL_TRACE_BASIC,
HTTP_BAD_CLIENT_REQUEST_RECEIVED)
- .arg(getRemoteEndpointAddressAsText())
+ .arg(remote)
.arg(ex.what());
LOG_DEBUG(http_logger, isc::log::DBGLVL_TRACE_BASIC_DATA,
HTTP_BAD_CLIENT_REQUEST_RECEIVED_DETAILS)
- .arg(getRemoteEndpointAddressAsText())
+ .arg(remote)
.arg(transaction->getParser()->getBufferAsString(MAX_LOGGED_MESSAGE_SIZE));
}
@@ -452,7 +455,7 @@ HttpConnection::socketReadCallback(HttpConnection::TransactionPtr transaction,
LOG_DEBUG(http_logger, isc::log::DBGLVL_TRACE_BASIC,
HTTP_SERVER_RESPONSE_SEND)
.arg(response->toBriefString())
- .arg(getRemoteEndpointAddressAsText());
+ .arg(remote);
LOG_DEBUG(http_logger, isc::log::DBGLVL_TRACE_BASIC_DATA,
HTTP_SERVER_RESPONSE_SEND_DETAILS)