wsd: remove sendWithDateAndAgent
The explicit header entries were needed with Poco, but since we always set them in our http::Response constructor, these are redundant. Change-Id: Ifde48fd3048018747dae3e84560b31960e511a25 Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>pull/8581/head
parent
7fb6ccf4ee
commit
882350ed70
|
@ -934,6 +934,10 @@ public:
|
||||||
/// Serializes the Server Response into the given buffer.
|
/// Serializes the Server Response into the given buffer.
|
||||||
bool writeData(Buffer& out) const
|
bool writeData(Buffer& out) const
|
||||||
{
|
{
|
||||||
|
assert(!get("Date").empty() && "Date is always set in http::Response ctor");
|
||||||
|
assert(get("Server") == http::getServerString() &&
|
||||||
|
"Server Agent is always set in http::Response ctor");
|
||||||
|
|
||||||
_statusLine.writeData(out);
|
_statusLine.writeData(out);
|
||||||
_header.writeData(out);
|
_header.writeData(out);
|
||||||
out.append("\r\n"); // End of header.
|
out.append("\r\n"); // End of header.
|
||||||
|
|
|
@ -809,15 +809,6 @@ void StreamSocket::dumpState(std::ostream& os)
|
||||||
_outBuffer.dumpHex(os, "\t\toutBuffer:\n", "\t\t");
|
_outBuffer.dumpHex(os, "\t\toutBuffer:\n", "\t\t");
|
||||||
}
|
}
|
||||||
|
|
||||||
void StreamSocket::sendWithDateAndAgent(http::Response& response)
|
|
||||||
{
|
|
||||||
assert(response.get("Server") == http::getServerString() &&
|
|
||||||
"Server Agent is always set in http::Response ctor");
|
|
||||||
assert(!response.get("Date").empty() && "Date is always set in http::Response ctor");
|
|
||||||
|
|
||||||
send(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool StreamSocket::send(const http::Response& response)
|
bool StreamSocket::send(const http::Response& response)
|
||||||
{
|
{
|
||||||
if (response.writeData(_outBuffer))
|
if (response.writeData(_outBuffer))
|
||||||
|
|
|
@ -1034,10 +1034,6 @@ public:
|
||||||
send(str.data(), str.size(), doFlush);
|
send(str.data(), str.size(), doFlush);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sends HTTP response.
|
|
||||||
/// Adds Date and User-Agent.
|
|
||||||
void sendWithDateAndAgent(http::Response& response);
|
|
||||||
|
|
||||||
/// Send an http::Request and flush.
|
/// Send an http::Request and flush.
|
||||||
/// Does not add any fields to the header.
|
/// Does not add any fields to the header.
|
||||||
/// Will shutdown the socket upon error and return false.
|
/// Will shutdown the socket upon error and return false.
|
||||||
|
|
|
@ -148,7 +148,7 @@ private:
|
||||||
http::Response response(http::StatusCode::BadRequest);
|
http::Response response(http::StatusCode::BadRequest);
|
||||||
response.setContentLength(0);
|
response.setContentLength(0);
|
||||||
LOG_INF("DumpWebSockets bad request");
|
LOG_INF("DumpWebSockets bad request");
|
||||||
socket->sendWithDateAndAgent(response);
|
socket->send(response);
|
||||||
disposition.setClosed();
|
disposition.setClosed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -494,7 +494,7 @@ bool AdminSocketHandler::handleInitialRequest(
|
||||||
http::Response response(http::StatusCode::BadRequest);
|
http::Response response(http::StatusCode::BadRequest);
|
||||||
response.setContentLength(0);
|
response.setContentLength(0);
|
||||||
LOG_INF_S("Admin::handleInitialRequest bad request");
|
LOG_INF_S("Admin::handleInitialRequest bad request");
|
||||||
socket->sendWithDateAndAgent(response);
|
socket->send(response);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1710,7 +1710,7 @@ bool ClientSession::handleKitToClientMessage(const std::shared_ptr<Message>& pay
|
||||||
{
|
{
|
||||||
http::Response response(http::StatusCode::Unauthorized);
|
http::Response response(http::StatusCode::Unauthorized);
|
||||||
response.set("X-ERROR-KIND", errorKind);
|
response.set("X-ERROR-KIND", errorKind);
|
||||||
_saveAsSocket->sendWithDateAndAgent(response);
|
_saveAsSocket->send(response);
|
||||||
|
|
||||||
// Conversion failed, cleanup fake session.
|
// Conversion failed, cleanup fake session.
|
||||||
LOG_TRC("Removing save-as ClientSession after conversion error.");
|
LOG_TRC("Removing save-as ClientSession after conversion error.");
|
||||||
|
|
Loading…
Reference in New Issue