From 751624939712c530279837ce6dc62766e69093ed Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Tue, 2 Jul 2024 01:52:17 +1200 Subject: [PATCH] Down the rabbit-hole of DeferredParams clientStreams --- src/Downloader.cc | 6 +++--- src/Downloader.h | 5 ++++- src/clientStreamForward.h | 7 ++----- src/client_side.cc | 10 +++++----- src/client_side.h | 4 ++-- src/esi/Esi.cc | 8 ++++---- src/esi/Include.cc | 16 ++++++++-------- src/servers/FtpServer.cc | 39 +++++++++++++++++++------------------- src/servers/FtpServer.h | 32 +++++++++++++++---------------- src/servers/Http1Server.cc | 28 +++++++++++++-------------- src/servers/Http1Server.h | 4 ++-- 11 files changed, 79 insertions(+), 80 deletions(-) diff --git a/src/Downloader.cc b/src/Downloader.cc index 022381ae3cd..65a6083a403 100644 --- a/src/Downloader.cc +++ b/src/Downloader.cc @@ -103,7 +103,7 @@ Downloader::doneAll() const static void downloaderRecipient(clientStreamNode * node, ClientHttpRequest * http, - HttpReply * rep, StoreIOBuffer receivedData) + const HttpReplyPointer &reply, StoreIOBuffer receivedData) { debugs(33, 6, MYNAME); /* Test preconditions */ @@ -120,7 +120,7 @@ downloaderRecipient(clientStreamNode * node, ClientHttpRequest * http, assert(context); if (context->downloader.valid()) - context->downloader->handleReply(node, http, rep, receivedData); + context->downloader->handleReply(node, http, reply, receivedData); } static void @@ -188,7 +188,7 @@ Downloader::start() } void -Downloader::handleReply(clientStreamNode * node, ClientHttpRequest *http, HttpReply *reply, StoreIOBuffer receivedData) +Downloader::handleReply(clientStreamNode * node, ClientHttpRequest *http, const HttpReplyPointer &reply, StoreIOBuffer receivedData) { DownloaderContext::Pointer callerContext = dynamic_cast(node->data.getRaw()); // TODO: remove the following check: diff --git a/src/Downloader.h b/src/Downloader.h index df4f093b60b..d548fb88cb9 100644 --- a/src/Downloader.h +++ b/src/Downloader.h @@ -58,7 +58,10 @@ class Downloader: virtual public AsyncJob /// The nested level of Downloader object (downloads inside downloads). unsigned int nestedLevel() const {return level_;} - void handleReply(clientStreamNode *, ClientHttpRequest *, HttpReply *, StoreIOBuffer); + /* clientStreams API */ + + /// \copydoc CSCB + void handleReply(clientStreamNode *, ClientHttpRequest *, const HttpReplyPointer &, StoreIOBuffer); protected: diff --git a/src/clientStreamForward.h b/src/clientStreamForward.h index 968f862b430..0ab3e8a9a04 100644 --- a/src/clientStreamForward.h +++ b/src/clientStreamForward.h @@ -10,9 +10,7 @@ #define SQUID_SRC_CLIENTSTREAMFORWARD_H #include "enums.h" /* for clientStream_status_t */ - -class Lock; -template class RefCount; +#include "http/forward.h" typedef RefCount ClientStreamData; @@ -20,11 +18,10 @@ typedef RefCount ClientStreamData; class clientStreamNode; class ClientHttpRequest; -class HttpReply; class StoreIOBuffer; /// client stream read callback -typedef void CSCB(clientStreamNode *, ClientHttpRequest *, HttpReply *, StoreIOBuffer); +typedef void CSCB(clientStreamNode *, ClientHttpRequest *, const HttpReplyPointer &, StoreIOBuffer); /// client stream read typedef void CSR(clientStreamNode *, ClientHttpRequest *); diff --git a/src/client_side.cc b/src/client_side.cc index 4e35fe7c272..dd102f9e922 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -797,7 +797,7 @@ ClientHttpRequest::rangeBoundaryStr() const */ void clientSocketRecipient(clientStreamNode * node, ClientHttpRequest * http, - HttpReply * rep, StoreIOBuffer receivedData) + const HttpReplyPointer &reply, StoreIOBuffer receivedData) { // do not try to deliver if client already ABORTED if (!http->getConn() || !cbdataReferenceValid(http->getConn()) || !Comm::IsConnOpen(http->getConn()->clientConnection)) @@ -819,11 +819,11 @@ clientSocketRecipient(clientStreamNode * node, ClientHttpRequest * http, // TODO: enforces HTTP/1 MUST on pipeline order, but is irrelevant to HTTP/2 if (context != http->getConn()->pipeline.front()) - context->deferRecipientForLater(node, rep, receivedData); + context->deferRecipientForLater(node, reply, receivedData); else if (http->getConn()->cbControlMsgSent) // 1xx to the user is pending - context->deferRecipientForLater(node, rep, receivedData); + context->deferRecipientForLater(node, reply, receivedData); else - http->getConn()->handleReply(rep, receivedData); + http->getConn()->handleReply(reply, receivedData); } /** @@ -3628,7 +3628,7 @@ ConnStateData::sendControlMsg(HttpControlMsg msg) typedef CommCbMemFunT Dialer; AsyncCall::Pointer call = JobCallback(33, 5, Dialer, this, HttpControlMsgSink::wroteControlMsg); - if (!writeControlMsgAndCall(rep.getRaw(), call)) { + if (!writeControlMsgAndCall(rep, call)) { // but still inform the caller (so it may resume its operation) doneWithControlMsg(); } diff --git a/src/client_side.h b/src/client_side.h index 4a67203f75a..9e2f948ccfc 100644 --- a/src/client_side.h +++ b/src/client_side.h @@ -315,11 +315,11 @@ class ConnStateData: void add(const Http::StreamPointer &context); /// handle a control message received by context from a peer and call back - virtual bool writeControlMsgAndCall(HttpReply *rep, AsyncCall::Pointer &call) = 0; + virtual bool writeControlMsgAndCall(const HttpReplyPointer &, AsyncCall::Pointer &) = 0; /// ClientStream calls this to supply response header (once) and data /// for the current Http::Stream. - virtual void handleReply(HttpReply *header, StoreIOBuffer receivedData) = 0; + virtual void handleReply(const HttpReplyPointer &, StoreIOBuffer receivedData) = 0; /// remove no longer needed leading bytes from the input buffer void consumeInput(const size_t byteCount); diff --git a/src/esi/Esi.cc b/src/esi/Esi.cc index 59339226cc6..f6ac493e614 100644 --- a/src/esi/Esi.cc +++ b/src/esi/Esi.cc @@ -666,7 +666,7 @@ esiStreamDetach (clientStreamNode *thisNode, ClientHttpRequest *http) * There is context data or a reply structure */ void -esiProcessStream (clientStreamNode *thisNode, ClientHttpRequest *http, HttpReply *rep, StoreIOBuffer receivedData) +esiProcessStream(clientStreamNode *thisNode, ClientHttpRequest *http, const HttpReplyPointer &reply, StoreIOBuffer receivedData) { /* test preconditions */ assert (thisNode != nullptr); @@ -684,7 +684,7 @@ esiProcessStream (clientStreamNode *thisNode, ClientHttpRequest *http, HttpReply if (!thisNode->data.getRaw()) /* setup ESI context from reply headers */ - thisNode->data = ESIContextNew(rep, thisNode, http); + thisNode->data = ESIContextNew(reply, thisNode, http); ESIContext::Pointer context = dynamic_cast(thisNode->data.getRaw()); @@ -697,7 +697,7 @@ esiProcessStream (clientStreamNode *thisNode, ClientHttpRequest *http, HttpReply * has been detected to prevent ESI processing the error body */ if (context->flags.passthrough) { - clientStreamCallback (thisNode, http, rep, receivedData); + clientStreamCallback(thisNode, http, reply, receivedData); return; } @@ -767,7 +767,7 @@ esiProcessStream (clientStreamNode *thisNode, ClientHttpRequest *http, HttpReply } /* EOF / Read error / aborted entry */ - if (rep == nullptr && receivedData.data == nullptr && receivedData.length == 0 && !context->flags.finishedtemplate) { + if (!reply && receivedData.data == nullptr && receivedData.length == 0 && !context->flags.finishedtemplate) { /* TODO: get stream status to test the entry for aborts */ /* else flush the esi processor */ debugs(86, 5, "esiProcess: " << context.getRaw() << " Finished reading upstream data"); diff --git a/src/esi/Include.cc b/src/esi/Include.cc index efd6759e7c1..2d7f0c6f5e6 100644 --- a/src/esi/Include.cc +++ b/src/esi/Include.cc @@ -60,7 +60,7 @@ esiBufferDetach (clientStreamNode *node, ClientHttpRequest *http) * not be reinstated or it will trigger bug #975 again - RBC 20060903 */ void -esiBufferRecipient (clientStreamNode *node, ClientHttpRequest *http, HttpReply *rep, StoreIOBuffer receivedData) +esiBufferRecipient(clientStreamNode *node, ClientHttpRequest *http, const HttpReplyPointer &reply, StoreIOBuffer receivedData) { /* Test preconditions */ assert (node != nullptr); @@ -80,24 +80,24 @@ esiBufferRecipient (clientStreamNode *node, ClientHttpRequest *http, HttpReply * assert (receivedData.length <= sizeof(esiStream->localbuffer->buf)); assert (!esiStream->finished); - debugs (86,5, "rep " << rep << " body " << receivedData.data << " len " << receivedData.length); + debugs(86, 5, "reply " << reply << " body " << receivedData.data << " len " << receivedData.length); assert (node->readBuffer.offset == receivedData.offset || receivedData.length == 0); /* trivial case */ if (http->out.offset != 0) { - assert(rep == nullptr); + assert(!reply); } else { - if (rep) { - if (rep->sline.status() != Http::scOkay) { - rep = nullptr; + if (reply) { + if (reply->sline.status() != Http::scOkay) { + reply = nullptr; esiStream->include->includeFail (esiStream); esiStream->finished = 1; httpRequestFree (http); return; } - rep = nullptr; + reply = nullptr; } } @@ -121,7 +121,7 @@ esiBufferRecipient (clientStreamNode *node, ClientHttpRequest *http, HttpReply * } /* EOF / Read error / aborted entry */ - if (rep == nullptr && receivedData.data == nullptr && receivedData.length == 0) { + if (!reply && receivedData.data == nullptr && receivedData.length == 0) { /* TODO: get stream status to test the entry for aborts */ debugs(86, 5, "Finished reading upstream data in subrequest"); esiStream->include->subRequestDone (esiStream, true); diff --git a/src/servers/FtpServer.cc b/src/servers/FtpServer.cc index 5b6cd63b34a..0d3da92aeec 100644 --- a/src/servers/FtpServer.cc +++ b/src/servers/FtpServer.cc @@ -45,7 +45,7 @@ CBDATA_NAMESPACED_CLASS_INIT(Ftp, Server); namespace Ftp { -static void PrintReply(MemBuf &mb, const HttpReply *reply, const char *const prefix = ""); +static void PrintReply(MemBuf &, const HttpReplyPointer &, const char *const prefix = ""); static bool SupportedCommand(const SBuf &name); static bool CommandHasPathParameter(const SBuf &cmd); }; @@ -504,13 +504,12 @@ Ftp::Server::writeReply(MemBuf &mb) } void -Ftp::Server::writeCustomReply(const int code, const char *msg, const HttpReply *reply) +Ftp::Server::writeCustomReply(const int code, const char *msg, const HttpReplyPointer &reply) { debugs(33, 7, code << ' ' << msg); assert(99 < code && code < 1000); - const bool sendDetails = reply != nullptr && - reply->header.has(Http::HdrType::FTP_STATUS) && reply->header.has(Http::HdrType::FTP_REASON); + const bool sendDetails = reply && reply->header.has(Http::HdrType::FTP_STATUS) && reply->header.has(Http::HdrType::FTP_REASON); MemBuf mb; mb.init(); @@ -775,7 +774,7 @@ Ftp::Server::parseOneRequest() } void -Ftp::Server::handleReply(HttpReply *reply, StoreIOBuffer data) +Ftp::Server::handleReply(const HttpReplyPointer &reply, StoreIOBuffer data) { // the caller guarantees that we are dealing with the current context only Http::StreamPointer context = pipeline.front(); @@ -809,7 +808,7 @@ Ftp::Server::handleReply(HttpReply *reply, StoreIOBuffer data) } void -Ftp::Server::handleFeatReply(const HttpReply *reply, StoreIOBuffer) +Ftp::Server::handleFeatReply(const HttpReplyPointer &reply, StoreIOBuffer) { if (pipeline.front()->http->request->error) { writeCustomReply(502, "Server does not support FEAT", reply); @@ -878,7 +877,7 @@ Ftp::Server::handleFeatReply(const HttpReply *reply, StoreIOBuffer) } void -Ftp::Server::handlePasvReply(const HttpReply *reply, StoreIOBuffer) +Ftp::Server::handlePasvReply(const HttpReplyPointer &reply, StoreIOBuffer) { const Http::StreamPointer context(pipeline.front()); assert(context != nullptr); @@ -918,7 +917,7 @@ Ftp::Server::handlePasvReply(const HttpReply *reply, StoreIOBuffer) } void -Ftp::Server::handlePortReply(const HttpReply *reply, StoreIOBuffer) +Ftp::Server::handlePortReply(const HttpReplyPointer &reply, StoreIOBuffer) { if (pipeline.front()->http->request->error) { writeCustomReply(502, "Server does not support PASV (converted from PORT)", reply); @@ -931,7 +930,7 @@ Ftp::Server::handlePortReply(const HttpReply *reply, StoreIOBuffer) } void -Ftp::Server::handleErrorReply(const HttpReply *reply, StoreIOBuffer) +Ftp::Server::handleErrorReply(const HttpReplyPointer &reply, StoreIOBuffer) { if (!pinning.pinned) // we failed to connect to server uri.clear(); @@ -940,9 +939,9 @@ Ftp::Server::handleErrorReply(const HttpReply *reply, StoreIOBuffer) } void -Ftp::Server::handleDataReply(const HttpReply *reply, StoreIOBuffer data) +Ftp::Server::handleDataReply(const HttpReplyPointer &reply, StoreIOBuffer data) { - if (reply != nullptr && reply->sline.status() != Http::scOkay) { + if (reply && reply->sline.status() != Http::scOkay) { writeForwardedReply(reply); if (Comm::IsConnOpen(dataConn)) { debugs(33, 3, "closing " << dataConn << " on KO reply"); @@ -1026,14 +1025,14 @@ Ftp::Server::replyDataWritingCheckpoint() } void -Ftp::Server::handleUploadReply(const HttpReply *reply, StoreIOBuffer) +Ftp::Server::handleUploadReply(const HttpReplyPointer &reply, StoreIOBuffer) { writeForwardedReply(reply); // note that the client data connection may already be closed by now } void -Ftp::Server::writeForwardedReply(const HttpReply *reply) +Ftp::Server::writeForwardedReply(const HttpReplyPointer &reply) { Must(reply); @@ -1056,7 +1055,7 @@ Ftp::Server::writeForwardedReply(const HttpReply *reply) } void -Ftp::Server::handleEprtReply(const HttpReply *reply, StoreIOBuffer) +Ftp::Server::handleEprtReply(const HttpReplyPointer &reply, StoreIOBuffer) { if (pipeline.front()->http->request->error) { writeCustomReply(502, "Server does not support PASV (converted from EPRT)", reply); @@ -1069,7 +1068,7 @@ Ftp::Server::handleEprtReply(const HttpReply *reply, StoreIOBuffer) } void -Ftp::Server::handleEpsvReply(const HttpReply *reply, StoreIOBuffer) +Ftp::Server::handleEpsvReply(const HttpReplyPointer &reply, StoreIOBuffer) { if (pipeline.front()->http->request->error) { writeCustomReply(502, "Cannot connect to server", reply); @@ -1092,7 +1091,7 @@ Ftp::Server::handleEpsvReply(const HttpReply *reply, StoreIOBuffer) /// writes FTP error response with given status and reply-derived error details void -Ftp::Server::writeErrorReply(const HttpReply *reply, const int scode) +Ftp::Server::writeErrorReply(const HttpReplyPointer &reply, const int scode) { const HttpRequest *request = pipeline.front()->http->request; assert(request); @@ -1140,7 +1139,7 @@ Ftp::Server::writeErrorReply(const HttpReply *reply, const int scode) /// writes FTP response based on HTTP reply that is not an FTP-response wrapper /// for example, internally-generated Squid "errorpages" end up here (for now) void -Ftp::Server::writeForwardedForeign(const HttpReply *reply) +Ftp::Server::writeForwardedForeign(const HttpReplyPointer &reply) { changeState(fssConnected, "foreign reply"); closeDataConnection(); @@ -1149,7 +1148,7 @@ Ftp::Server::writeForwardedForeign(const HttpReply *reply) } bool -Ftp::Server::writeControlMsgAndCall(HttpReply *reply, AsyncCall::Pointer &call) +Ftp::Server::writeControlMsgAndCall(const HttpReplyPointer &reply, AsyncCall::Pointer &call) { // the caller guarantees that we are dealing with the current context only // the caller should also make sure reply->header.has(Http::HdrType::FTP_STATUS) @@ -1158,7 +1157,7 @@ Ftp::Server::writeControlMsgAndCall(HttpReply *reply, AsyncCall::Pointer &call) } void -Ftp::Server::writeForwardedReplyAndCall(const HttpReply *reply, AsyncCall::Pointer &call) +Ftp::Server::writeForwardedReplyAndCall(const HttpReplyPointer &reply, AsyncCall::Pointer &call) { assert(reply != nullptr); const HttpHeader &header = reply->header; @@ -1210,7 +1209,7 @@ Ftp::Server::writeForwardedReplyAndCall(const HttpReply *reply, AsyncCall::Point } static void -Ftp::PrintReply(MemBuf &mb, const HttpReply *reply, const char *const) +Ftp::PrintReply(MemBuf &mb, const HttpReplyPointer &reply, const char *const) { const HttpHeader &header = reply->header; diff --git a/src/servers/FtpServer.h b/src/servers/FtpServer.h index 500364c4385..71f56f4be2f 100644 --- a/src/servers/FtpServer.h +++ b/src/servers/FtpServer.h @@ -98,9 +98,9 @@ class Server: public ConnStateData void processParsedRequest(Http::StreamPointer &context) override; void notePeerConnection(Comm::ConnectionPointer conn) override; void clientPinnedConnectionClosed(const CommCloseCbParams &io) override; - void handleReply(HttpReply *header, StoreIOBuffer receivedData) override; + void handleReply(const HttpReplyPointer &, StoreIOBuffer) override; int pipelinePrefetchMax() const override; - bool writeControlMsgAndCall(HttpReply *rep, AsyncCall::Pointer &call) override; + bool writeControlMsgAndCall(const HttpReplyPointer &, AsyncCall::Pointer &) override; time_t idleTimeout() const override; /* BodyPipe API */ @@ -139,12 +139,12 @@ class Server: public ConnStateData void maybeReadUploadData(); void setReply(const int code, const char *msg); - void writeCustomReply(const int code, const char *msg, const HttpReply *reply = nullptr); + void writeCustomReply(const int code, const char *msg, const HttpReplyPointer & = nullptr); void writeEarlyReply(const int code, const char *msg); - void writeErrorReply(const HttpReply *reply, const int status); - void writeForwardedForeign(const HttpReply *reply); - void writeForwardedReply(const HttpReply *reply); - void writeForwardedReplyAndCall(const HttpReply *reply, AsyncCall::Pointer &call); + void writeErrorReply(const HttpReplyPointer &, const int status); + void writeForwardedForeign(const HttpReplyPointer &); + void writeForwardedReply(const HttpReplyPointer &); + void writeForwardedReplyAndCall(const HttpReplyPointer &, AsyncCall::Pointer &); void writeReply(MemBuf &mb); Http::Stream *earlyError(const EarlyErrorKind eek); @@ -166,15 +166,15 @@ class Server: public ConnStateData bool handleCdupRequest(String &cmd, String ¶ms); /// a method handling an FTP response; selected by handleReply() - typedef void (Ftp::Server::*ReplyHandler)(const HttpReply *reply, StoreIOBuffer data); - void handleFeatReply(const HttpReply *header, StoreIOBuffer receivedData); - void handlePasvReply(const HttpReply *header, StoreIOBuffer receivedData); - void handlePortReply(const HttpReply *header, StoreIOBuffer receivedData); - void handleErrorReply(const HttpReply *header, StoreIOBuffer receivedData); - void handleDataReply(const HttpReply *header, StoreIOBuffer receivedData); - void handleUploadReply(const HttpReply *header, StoreIOBuffer receivedData); - void handleEprtReply(const HttpReply *header, StoreIOBuffer receivedData); - void handleEpsvReply(const HttpReply *header, StoreIOBuffer receivedData); + typedef void (Ftp::Server::*ReplyHandler)(const HttpReplyPointer &, StoreIOBuffer); + void handleFeatReply(const HttpReplyPointer &, StoreIOBuffer); + void handlePasvReply(const HttpReplyPointer &, StoreIOBuffer); + void handlePortReply(const HttpReplyPointer &, StoreIOBuffer); + void handleErrorReply(const HttpReplyPointer &, StoreIOBuffer); + void handleDataReply(const HttpReplyPointer &, StoreIOBuffer); + void handleUploadReply(const HttpReplyPointer &, StoreIOBuffer); + void handleEprtReply(const HttpReplyPointer &, StoreIOBuffer); + void handleEpsvReply(const HttpReplyPointer &, StoreIOBuffer); private: void doProcessRequest(); diff --git a/src/servers/Http1Server.cc b/src/servers/Http1Server.cc index 05151a339ce..08aa3f3e5a1 100644 --- a/src/servers/Http1Server.cc +++ b/src/servers/Http1Server.cc @@ -292,7 +292,7 @@ Http::One::Server::noteBodyConsumerAborted(BodyPipe::Pointer ptr) } void -Http::One::Server::handleReply(HttpReply *rep, StoreIOBuffer receivedData) +Http::One::Server::handleReply(const HttpReplyPointer &reply, StoreIOBuffer receivedData) { // the caller guarantees that we are dealing with the current context only Http::StreamPointer context = pipeline.front(); @@ -306,7 +306,7 @@ Http::One::Server::handleReply(HttpReply *rep, StoreIOBuffer receivedData) !http->request->flags.streamError && !EBIT_TEST(http->storeEntry()->flags, ENTRY_BAD_LENGTH) && !context->startOfOutput(); - const bool responseFinishedOrFailed = !rep && + const bool responseFinishedOrFailed = !reply && !receivedData.data && !receivedData.length; if (responseFinishedOrFailed && !mustSendLastChunk) { @@ -319,12 +319,12 @@ Http::One::Server::handleReply(HttpReply *rep, StoreIOBuffer receivedData) return; } - assert(rep); - context->sendStartOfMessage(rep, receivedData); + assert(reply); + context->sendStartOfMessage(reply, receivedData); } bool -Http::One::Server::writeControlMsgAndCall(HttpReply *rep, AsyncCall::Pointer &call) +Http::One::Server::writeControlMsgAndCall(const HttpReplyPointer &reply, AsyncCall::Pointer &call) { Http::StreamPointer context = pipeline.front(); Must(context != nullptr); @@ -340,27 +340,27 @@ Http::One::Server::writeControlMsgAndCall(HttpReply *rep, AsyncCall::Pointer &ca // remember Upgrade header; removeHopByHopEntries() will remove it String upgradeHeader; - const auto switching = (rep->sline.status() == Http::scSwitchingProtocols); + const auto switching = (reply->sline.status() == Http::scSwitchingProtocols); if (switching) - upgradeHeader = rep->header.getList(Http::HdrType::UPGRADE); + upgradeHeader = reply->header.getList(Http::HdrType::UPGRADE); // apply selected clientReplyContext::buildReplyHeader() mods // it is not clear what headers are required for control messages - rep->header.removeHopByHopEntries(); + reply->header.removeHopByHopEntries(); // paranoid: ContentLengthInterpreter has cleaned non-generated replies - rep->removeIrrelevantContentLength(); + reply->removeIrrelevantContentLength(); if (switching && /* paranoid: */ upgradeHeader.size()) { - rep->header.putStr(Http::HdrType::UPGRADE, upgradeHeader.termedBuf()); - rep->header.putStr(Http::HdrType::CONNECTION, "upgrade"); + reply->header.putStr(Http::HdrType::UPGRADE, upgradeHeader.termedBuf()); + reply->header.putStr(Http::HdrType::CONNECTION, "upgrade"); // keep-alive is redundant, breaks some 101 (Switching Protocols) recipients } else { - rep->header.putStr(Http::HdrType::CONNECTION, "keep-alive"); + reply->header.putStr(Http::HdrType::CONNECTION, "keep-alive"); } - httpHdrMangleList(&rep->header, http->request, http->al, ROR_REPLY); + httpHdrMangleList(&reply->header, http->request, http->al, ROR_REPLY); - MemBuf *mb = rep->pack(); + auto mb = reply->pack(); debugs(11, 2, "HTTP Client " << clientConnection); debugs(11, 2, "HTTP Client CONTROL MSG:\n---------\n" << mb->buf << "\n----------"); diff --git a/src/servers/Http1Server.h b/src/servers/Http1Server.h index e97a1f33359..8bd1e491536 100644 --- a/src/servers/Http1Server.h +++ b/src/servers/Http1Server.h @@ -34,8 +34,8 @@ class Server: public ConnStateData /* ConnStateData API */ Http::Stream *parseOneRequest() override; void processParsedRequest(Http::StreamPointer &context) override; - void handleReply(HttpReply *rep, StoreIOBuffer receivedData) override; - bool writeControlMsgAndCall(HttpReply *rep, AsyncCall::Pointer &call) override; + void handleReply(const HttpReplyPointer &, StoreIOBuffer) override; + bool writeControlMsgAndCall(const HttpReplyPointer &, AsyncCall::Pointer &) override; int pipelinePrefetchMax() const override; time_t idleTimeout() const override; void noteTakeServerConnectionControl(ServerConnectionContext) override;