From a3a7a9e11be14f9fa10ea6e86feada08487d219f Mon Sep 17 00:00:00 2001 From: Marcin Siodelski Date: Wed, 30 May 2018 13:32:18 +0200 Subject: [PATCH] [5205] Further separate client-side from server-side msgs. --- src/lib/http/client.cc | 6 +-- src/lib/http/connection.cc | 14 +++--- src/lib/http/http_messages.mes | 90 +++++++++++++++++----------------- 3 files changed, 55 insertions(+), 55 deletions(-) diff --git a/src/lib/http/client.cc b/src/lib/http/client.cc index ed026acc1d..08b3d96723 100644 --- a/src/lib/http/client.cc +++ b/src/lib/http/client.cc @@ -455,7 +455,7 @@ Connection::doTransaction(const HttpRequestPtr& request, .arg(url_.toText()); LOG_DEBUG(http_logger, isc::log::DBGLVL_TRACE_DETAIL_DATA, - HTTP_CLIENT_REQUEST_DETAILS) + HTTP_CLIENT_REQUEST_SEND_DETAILS) .arg(url_.toText()) .arg(HttpMessageParserBase::logFormatHttpMessage(request->toString(), MAX_LOGGED_MESSAGE_SIZE)); @@ -506,7 +506,7 @@ Connection::terminate(const boost::system::error_code& ec, .arg(url_.toText()); LOG_DEBUG(http_logger, isc::log::DBGLVL_TRACE_BASIC_DATA, - HTTP_SERVER_RESPONSE_DETAILS) + HTTP_SERVER_RESPONSE_RECEIVED_DETAILS) .arg(url_.toText()) .arg(parser_->getBufferAsString(MAX_LOGGED_MESSAGE_SIZE)); @@ -522,7 +522,7 @@ Connection::terminate(const boost::system::error_code& ec, // to parse it. if (!parsing_error.empty()) { LOG_DEBUG(http_logger, isc::log::DBGLVL_TRACE_BASIC_DATA, - HTTP_BAD_SERVER_RESPONSE_DETAILS) + HTTP_BAD_SERVER_RESPONSE_RECEIVED_DETAILS) .arg(url_.toText()) .arg(parser_->getBufferAsString()); } diff --git a/src/lib/http/connection.cc b/src/lib/http/connection.cc index d9ce80b2cd..2449a63223 100644 --- a/src/lib/http/connection.cc +++ b/src/lib/http/connection.cc @@ -216,34 +216,34 @@ HttpConnection::socketReadCallback(boost::system::error_code ec, size_t length) request_->finalize(); LOG_DEBUG(http_logger, isc::log::DBGLVL_TRACE_BASIC, - HTTP_REQUEST_RECEIVED) + HTTP_CLIENT_REQUEST_RECEIVED) .arg(getRemoteEndpointAddressAsText()); LOG_DEBUG(http_logger, isc::log::DBGLVL_TRACE_BASIC_DATA, - HTTP_REQUEST_DETAILS) + HTTP_CLIENT_REQUEST_RECEIVED_DETAILS) .arg(getRemoteEndpointAddressAsText()) .arg(parser_->getBufferAsString(MAX_LOGGED_MESSAGE_SIZE)); } catch (const std::exception& ex) { LOG_DEBUG(http_logger, isc::log::DBGLVL_TRACE_BASIC, - HTTP_BAD_REQUEST_RECEIVED) + HTTP_BAD_CLIENT_REQUEST_RECEIVED) .arg(getRemoteEndpointAddressAsText()) .arg(ex.what()); LOG_DEBUG(http_logger, isc::log::DBGLVL_TRACE_BASIC_DATA, - HTTP_BAD_REQUEST_DETAILS) + HTTP_BAD_CLIENT_REQUEST_RECEIVED_DETAILS) .arg(getRemoteEndpointAddressAsText()) .arg(parser_->getBufferAsString(MAX_LOGGED_MESSAGE_SIZE)); } HttpResponsePtr response = response_creator_->createHttpResponse(request_); LOG_DEBUG(http_logger, isc::log::DBGLVL_TRACE_BASIC, - HTTP_RESPONSE_SEND) + HTTP_SERVER_RESPONSE_SEND) .arg(response->toBriefString()) .arg(getRemoteEndpointAddressAsText()); LOG_DEBUG(http_logger, isc::log::DBGLVL_TRACE_BASIC_DATA, - HTTP_RESPONSE_DETAILS) + HTTP_SERVER_RESPONSE_SEND_DETAILS) .arg(getRemoteEndpointAddressAsText()) .arg(HttpMessageParserBase::logFormatHttpMessage(response->toString(), MAX_LOGGED_MESSAGE_SIZE)); @@ -323,7 +323,7 @@ HttpConnection::setupIdleTimer() { void HttpConnection::requestTimeoutCallback() { LOG_DEBUG(http_logger, isc::log::DBGLVL_TRACE_DETAIL, - HTTP_REQUEST_TIMEOUT_OCCURRED) + HTTP_CLIENT_REQUEST_TIMEOUT_OCCURRED) .arg(getRemoteEndpointAddressAsText()); HttpResponsePtr response = response_creator_->createStockHttpResponse(request_, diff --git a/src/lib/http/http_messages.mes b/src/lib/http/http_messages.mes index 5a9ae1a5be..4c46693525 100644 --- a/src/lib/http/http_messages.mes +++ b/src/lib/http/http_messages.mes @@ -6,27 +6,20 @@ $NAMESPACE isc::http -% HTTP_BAD_REQUEST_DETAILS detailed information about bad request received from %1:\n%2 -This debug message is issued when a HTTP client sends malformed request to -the server. It includes detailed information about the received request -rejected by the server. The first argument specifies an address of -the remote endpoint which sent the request. The second argument provides -a request in the textual format. The request is truncated by the logger -if it is too large to be printed. - -% HTTP_BAD_REQUEST_RECEIVED bad request received from %1: %2 -This debug message is issued when a HTTP client sends malformed request to +% HTTP_BAD_CLIENT_REQUEST_RECEIVED bad request received from %1: %2 +This debug message is issued when an HTTP client sends malformed request to the server. This includes HTTP requests using unexpected content types, including malformed JSON etc. The first argument specifies an address of the remote endpoint which sent the request. The second argument provides a detailed error message. -% HTTP_BAD_SERVER_RESPONSE_DETAILS detailed information about bad response received from %1:\n%2 -This debug message is issued when an HTTP client receives malformed response -from the server. The first argument specifies an URL of the server. The -second argument provides a response in the textual format. The request is -truncated by the logger if it is too large to be printed. - +% HTTP_BAD_CLIENT_REQUEST_RECEIVED_DETAILS detailed information about bad request received from %1:\n%2 +This debug message is issued when an HTTP client sends malformed request to +the server. It includes detailed information about the received request +rejected by the server. The first argument specifies an address of +the remote endpoint which sent the request. The second argument provides +a request in the textual format. The request is truncated by the logger +if it is too large to be printed. % HTTP_BAD_SERVER_RESPONSE_RECEIVED bad response received when communicating with %1: %2 This debug message is issued when an HTTP client fails to receive a response @@ -34,12 +27,11 @@ from the server or when this response is malformed. The first argument specifies the server URL. The second argument provides a detailed error message. -% HTTP_CLIENT_REQUEST_DETAILS detailed information about request sent to %1:\n%2 -This debug message is issued right before the client sends a HTTP request -to the server. It includes detailed information about the request. The -first argument specifies an URL of the server to which the request is -being sent. The second argument provides the request in the textual form. -The request is truncated by the logger if it is too large to be printed. +% HTTP_BAD_SERVER_RESPONSE_RECEIVED_DETAILS detailed information about bad response received from %1:\n%2 +This debug message is issued when an HTTP client receives malformed response +from the server. The first argument specifies an URL of the server. The +second argument provides a response in the textual format. The request is +truncated by the logger if it is too large to be printed. % HTTP_CLIENT_REQUEST_SEND sending HTTP request %1 to %2 This debug message is issued when the client is starting to send a HTTP @@ -47,6 +39,25 @@ request to a server. The first argument holds basic information about the request (HTTP version number and status code). The second argument specifies a URL of the server. +% HTTP_CLIENT_REQUEST_SEND_DETAILS detailed information about request sent to %1:\n%2 +This debug message is issued right before the client sends an HTTP request +to the server. It includes detailed information about the request. The +first argument specifies an URL of the server to which the request is +being sent. The second argument provides the request in the textual form. +The request is truncated by the logger if it is too large to be printed. + +% HTTP_CLIENT_REQUEST_RECEIVED received HTTP request from %1 +This debug message is issued when the server finished receiving a HTTP +request from the remote endpoint. The address of the remote endpoint is +specified as an argument. + +% HTTP_CLIENT_REQUEST_RECEIVED_DETAILS detailed information about well formed request received from %1:\n%2 +This debug message is issued when the HTTP server receives a well formed +request. It includes detailed information about the received request. The +first argument specifies an address of the remote endpoint which sent the +request. The second argument provides the request in the textual format. +The request is truncated by the logger if it is too large to be printed. + % HTTP_CONNECTION_STOP stopping HTTP connection from %1 This debug message is issued when one of the HTTP connections is stopped. The connection can be stopped as a result of an error or after the @@ -67,30 +78,24 @@ produced the data. This debug message is issued when the persistent HTTP connection is being closed as a result of being idle. -% HTTP_REQUEST_DETAILS detailed information about well formed request received from %1:\n%2 -This debug message is issued when the HTTP server receives a well formed -request. It includes detailed information about the received request. The -first argument specifies an address of the remote endpoint which sent the -request. The second argument provides the request in the textual format. -The request is truncated by the logger if it is too large to be printed. - -% HTTP_REQUEST_RECEIVED received HTTP request from %1 -This debug message is issued when the server finished receiving a HTTP -request from the remote endpoint. The address of the remote endpoint is -specified as an argument. - % HTTP_REQUEST_RECEIVE_START start receiving request from %1 with timeout %2 This debug message is issued when the server starts receiving new request over the established connection. The first argument specifies the address of the remote endpoint. The second argument specifies request timeout in seconds. -% HTTP_REQUEST_TIMEOUT_OCCURRED HTTP request timeout occurred when communicating with %1 +% HTTP_CLIENT_REQUEST_TIMEOUT_OCCURRED HTTP request timeout occurred when communicating with %1 This debug message is issued when the HTTP request timeout has occurred and the server is going to send a response with Http Request timeout status code. -% HTTP_RESPONSE_DETAILS detailed information about response sent to %1:\n%2 +% HTTP_SERVER_RESPONSE_SEND sending HTTP response %1 to %2 +This debug message is issued when the server is starting to send a HTTP +response to a remote endpoint. The first argument holds basic information +about the response (HTTP version number and status code). The second +argument specifies an address of the remote endpoint. + +% HTTP_SERVER_RESPONSE_SEND_DETAILS detailed information about response sent to %1:\n%2 This debug message is issued right before the server sends a HTTP response to the client. It includes detailed information about the response. The first argument specifies an address of the remote endpoint to which the @@ -98,13 +103,11 @@ response is being sent. The second argument provides a response in the textual form. The response is truncated by the logger if it is too large to be printed. -% HTTP_RESPONSE_SEND sending HTTP response %1 to %2 -This debug message is issued when the server is starting to send a HTTP -response to a remote endpoint. The first argument holds basic information -about the response (HTTP version number and status code). The second -argument specifies an address of the remote endpoint. +% HTTP_SERVER_RESPONSE_RECEIVED received HTTP response from %1 +This debug message is issued when the client finished receiving an HTTP +response from the server. The URL of the server is specified as an argument. -% HTTP_SERVER_RESPONSE_DETAILS detailed information about well formed response received from %1:\n%2 +% HTTP_SERVER_RESPONSE_RECEIVED_DETAILS detailed information about well formed response received from %1:\n%2 This debug message is issued when the HTTP client receives a well formed response from the server. It includes detailed information about the received response. The first argument specifies a URL of the server which @@ -112,8 +115,5 @@ sent the response. The second argument provides the response in the textual format. The response is truncated by the logger if it is too large to be printed. -% HTTP_SERVER_RESPONSE_RECEIVED received HTTP response from %1 -This debug message is issued when the client finished receiving an HTTP -response from the server. The URL of the server is specified as an argument. -- 2.47.2