]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Cleanup: rename ServerStateData to Client
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 22 Sep 2014 17:39:41 +0000 (10:39 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 22 Sep 2014 17:39:41 +0000 (10:39 -0700)
* rename class

* move Server.* to clients/Client.*

src/Makefile.am
src/clients/Client.cc [moved from src/Server.cc with 89% similarity]
src/clients/Client.h [moved from src/Server.h with 95% similarity]
src/clients/FtpClient.cc
src/clients/FtpClient.h
src/clients/FtpGateway.cc
src/clients/FtpRelay.cc
src/clients/Makefile.am
src/http.cc
src/http.h

index d6d0d8d9106db45022275382843e42edf2940514..22f19c58dcb4eccbe46173b5098e61c8b046e0fa 100644 (file)
@@ -538,8 +538,6 @@ squid_SOURCES = \
        StoreStats.h \
        StoreSwapLogData.cc \
        StoreSwapLogData.h \
-       Server.cc \
-       Server.h \
        swap_log_op.h \
        SwapDir.cc \
        SwapDir.h \
@@ -1544,7 +1542,6 @@ tests_testCacheManager_SOURCES = \
        refresh.h \
        refresh.cc \
        RemovalPolicy.cc \
-       Server.cc \
        $(SBUF_SOURCE) \
        SBufDetailedStats.h \
        tests/stub_SBufDetailedStats.cc \
@@ -1972,7 +1969,6 @@ tests_testEvent_SOURCES = \
        refresh.h \
        refresh.cc \
        RemovalPolicy.cc \
-       Server.cc \
        StrList.h \
        StrList.cc \
        $(SBUF_SOURCE) \
@@ -2224,7 +2220,6 @@ tests_testEventLoop_SOURCES = \
        tests/stub_redirect.cc \
        refresh.h \
        refresh.cc \
-       Server.cc \
        $(SBUF_SOURCE) \
        SBufDetailedStats.h \
        tests/stub_SBufDetailedStats.cc \
@@ -2472,7 +2467,6 @@ tests_test_http_range_SOURCES = \
        refresh.h \
        refresh.cc \
        RemovalPolicy.cc \
-       Server.cc \
        $(SBUF_SOURCE) \
        SBufDetailedStats.h \
        tests/stub_SBufDetailedStats.cc \
@@ -2775,7 +2769,6 @@ tests_testHttpRequest_SOURCES = \
        refresh.h \
        refresh.cc \
        RemovalPolicy.cc \
-       Server.cc \
        $(SBUF_SOURCE) \
        SBufDetailedStats.h \
        tests/stub_SBufDetailedStats.cc \
@@ -3604,7 +3597,6 @@ tests_testURL_SOURCES = \
        refresh.h \
        refresh.cc \
        RemovalPolicy.cc \
-       Server.cc \
        $(SBUF_SOURCE) \
        SBufDetailedStats.h \
        tests/stub_SBufDetailedStats.cc \
similarity index 89%
rename from src/Server.cc
rename to src/clients/Client.cc
index b3fa922e1fd3848793f4d68040eecd2c5618972e..11283ce6daa53d1253f548cabfcca09d133d4ded 100644 (file)
@@ -10,6 +10,7 @@
 #include "acl/FilledChecklist.h"
 #include "acl/Gadgets.h"
 #include "base/TextException.h"
+#include "clients/Client.h"
 #include "comm/Connection.h"
 #include "comm/forward.h"
 #include "comm/Write.h"
@@ -19,7 +20,6 @@
 #include "HttpHdrContRange.h"
 #include "HttpReply.h"
 #include "HttpRequest.h"
-#include "Server.h"
 #include "SquidConfig.h"
 #include "SquidTime.h"
 #include "StatCounters.h"
@@ -37,7 +37,7 @@
 // implemented in client_side_reply.cc until sides have a common parent
 void purgeEntriesByUrl(HttpRequest * req, const char *url);
 
-ServerStateData::ServerStateData(FwdState *theFwdState): AsyncJob("ServerStateData"),
+Client::Client(FwdState *theFwdState): AsyncJob("Client"),
         requestSender(NULL),
 #if USE_ADAPTATION
         adaptedHeadSource(NULL),
@@ -51,13 +51,13 @@ ServerStateData::ServerStateData(FwdState *theFwdState): AsyncJob("ServerStateDa
     fwd = theFwdState;
     entry = fwd->entry;
 
-    entry->lock("ServerStateData");
+    entry->lock("Client");
 
     request = fwd->request;
     HTTPMSGLOCK(request);
 }
 
-ServerStateData::~ServerStateData()
+Client::~Client()
 {
     // paranoid: check that swanSong has been called
     assert(!requestBodySource);
@@ -66,7 +66,7 @@ ServerStateData::~ServerStateData()
     assert(!adaptedBodySource);
 #endif
 
-    entry->unlock("ServerStateData");
+    entry->unlock("Client");
 
     HTTPMSGUNLOCK(request);
     HTTPMSGUNLOCK(theVirginReply);
@@ -81,7 +81,7 @@ ServerStateData::~ServerStateData()
 }
 
 void
-ServerStateData::swanSong()
+Client::swanSong()
 {
     // get rid of our piping obligations
     if (requestBodySource != NULL)
@@ -107,21 +107,21 @@ ServerStateData::swanSong()
 }
 
 HttpReply *
-ServerStateData::virginReply()
+Client::virginReply()
 {
     assert(theVirginReply);
     return theVirginReply;
 }
 
 const HttpReply *
-ServerStateData::virginReply() const
+Client::virginReply() const
 {
     assert(theVirginReply);
     return theVirginReply;
 }
 
 HttpReply *
-ServerStateData::setVirginReply(HttpReply *rep)
+Client::setVirginReply(HttpReply *rep)
 {
     debugs(11,5, HERE << this << " setting virgin reply to " << rep);
     assert(!theVirginReply);
@@ -132,14 +132,14 @@ ServerStateData::setVirginReply(HttpReply *rep)
 }
 
 HttpReply *
-ServerStateData::finalReply()
+Client::finalReply()
 {
     assert(theFinalReply);
     return theFinalReply;
 }
 
 HttpReply *
-ServerStateData::setFinalReply(HttpReply *rep)
+Client::setFinalReply(HttpReply *rep)
 {
     debugs(11,5, HERE << this << " setting final reply to " << rep);
 
@@ -160,7 +160,7 @@ ServerStateData::setFinalReply(HttpReply *rep)
 
 // called when no more server communication is expected; may quit
 void
-ServerStateData::serverComplete()
+Client::serverComplete()
 {
     debugs(11,5,HERE << "serverComplete " << this);
 
@@ -184,7 +184,7 @@ ServerStateData::serverComplete()
 }
 
 void
-ServerStateData::serverComplete2()
+Client::serverComplete2()
 {
     debugs(11,5,HERE << "serverComplete2 " << this);
 
@@ -199,7 +199,7 @@ ServerStateData::serverComplete2()
     completeForwarding();
 }
 
-bool ServerStateData::doneAll() const
+bool Client::doneAll() const
 {
     return  doneWithServer() &&
 #if USE_ADAPTATION
@@ -212,7 +212,7 @@ bool ServerStateData::doneAll() const
 
 // FTP side overloads this to work around multiple calls to fwd->complete
 void
-ServerStateData::completeForwarding()
+Client::completeForwarding()
 {
     debugs(11,5, HERE << "completing forwarding for "  << fwd);
     assert(fwd != NULL);
@@ -220,7 +220,7 @@ ServerStateData::completeForwarding()
 }
 
 // Register to receive request body
-bool ServerStateData::startRequestBodyFlow()
+bool Client::startRequestBodyFlow()
 {
     HttpRequest *r = originalRequest();
     assert(r->body_pipe != NULL);
@@ -239,7 +239,7 @@ bool ServerStateData::startRequestBodyFlow()
 
 // Entry-dependent callbacks use this check to quit if the entry went bad
 bool
-ServerStateData::abortOnBadEntry(const char *abortReason)
+Client::abortOnBadEntry(const char *abortReason)
 {
     if (entry->isAccepting())
         return false;
@@ -251,7 +251,7 @@ ServerStateData::abortOnBadEntry(const char *abortReason)
 
 // more request or adapted response body is available
 void
-ServerStateData::noteMoreBodyDataAvailable(BodyPipe::Pointer bp)
+Client::noteMoreBodyDataAvailable(BodyPipe::Pointer bp)
 {
 #if USE_ADAPTATION
     if (adaptedBodySource == bp) {
@@ -265,7 +265,7 @@ ServerStateData::noteMoreBodyDataAvailable(BodyPipe::Pointer bp)
 
 // the entire request or adapted response body was provided, successfully
 void
-ServerStateData::noteBodyProductionEnded(BodyPipe::Pointer bp)
+Client::noteBodyProductionEnded(BodyPipe::Pointer bp)
 {
 #if USE_ADAPTATION
     if (adaptedBodySource == bp) {
@@ -279,7 +279,7 @@ ServerStateData::noteBodyProductionEnded(BodyPipe::Pointer bp)
 
 // premature end of the request or adapted response body production
 void
-ServerStateData::noteBodyProducerAborted(BodyPipe::Pointer bp)
+Client::noteBodyProducerAborted(BodyPipe::Pointer bp)
 {
 #if USE_ADAPTATION
     if (adaptedBodySource == bp) {
@@ -293,7 +293,7 @@ ServerStateData::noteBodyProducerAborted(BodyPipe::Pointer bp)
 
 // more origin request body data is available
 void
-ServerStateData::handleMoreRequestBodyAvailable()
+Client::handleMoreRequestBodyAvailable()
 {
     if (!requestSender)
         sendMoreRequestBody();
@@ -303,7 +303,7 @@ ServerStateData::handleMoreRequestBodyAvailable()
 
 // there will be no more handleMoreRequestBodyAvailable calls
 void
-ServerStateData::handleRequestBodyProductionEnded()
+Client::handleRequestBodyProductionEnded()
 {
     receivedWholeRequestBody = true;
     if (!requestSender)
@@ -314,7 +314,7 @@ ServerStateData::handleRequestBodyProductionEnded()
 
 // called when we are done sending request body; kids extend this
 void
-ServerStateData::doneSendingRequestBody()
+Client::doneSendingRequestBody()
 {
     debugs(9,3, HERE << "done sending request body");
     assert(requestBodySource != NULL);
@@ -325,7 +325,7 @@ ServerStateData::doneSendingRequestBody()
 
 // called when body producers aborts; kids extend this
 void
-ServerStateData::handleRequestBodyProducerAborted()
+Client::handleRequestBodyProducerAborted()
 {
     if (requestSender != NULL)
         debugs(9,3, HERE << "fyi: request body aborted while we were sending");
@@ -338,7 +338,7 @@ ServerStateData::handleRequestBodyProducerAborted()
 
 // called when we wrote request headers(!) or a part of the body
 void
-ServerStateData::sentRequestBody(const CommIoCbParams &io)
+Client::sentRequestBody(const CommIoCbParams &io)
 {
     debugs(11, 5, "sentRequestBody: FD " << io.fd << ": size " << io.size << ": errflag " << io.flag << ".");
     debugs(32,3,HERE << "sentRequestBody called");
@@ -383,7 +383,7 @@ ServerStateData::sentRequestBody(const CommIoCbParams &io)
 }
 
 void
-ServerStateData::sendMoreRequestBody()
+Client::sendMoreRequestBody()
 {
     assert(requestBodySource != NULL);
     assert(!requestSender);
@@ -398,8 +398,8 @@ ServerStateData::sendMoreRequestBody()
     MemBuf buf;
     if (getMoreRequestBody(buf) && buf.contentSize() > 0) {
         debugs(9,3, HERE << "will write " << buf.contentSize() << " request body bytes");
-        typedef CommCbMemFunT<ServerStateData, CommIoCbParams> Dialer;
-        requestSender = JobCallback(93,3, Dialer, this, ServerStateData::sentRequestBody);
+        typedef CommCbMemFunT<Client, CommIoCbParams> Dialer;
+        requestSender = JobCallback(93,3, Dialer, this, Client::sentRequestBody);
         Comm::Write(conn, &buf, requestSender);
     } else {
         debugs(9,3, HERE << "will wait for more request body bytes or eof");
@@ -409,7 +409,7 @@ ServerStateData::sendMoreRequestBody()
 
 /// either fill buf with available [encoded] request body bytes or return false
 bool
-ServerStateData::getMoreRequestBody(MemBuf &buf)
+Client::getMoreRequestBody(MemBuf &buf)
 {
     // default implementation does not encode request body content
     Must(requestBodySource != NULL);
@@ -480,7 +480,7 @@ purgeEntriesByHeader(HttpRequest *req, const char *reqUrl, HttpMsg *rep, http_hd
 
 // some HTTP methods should purge matching cache entries
 void
-ServerStateData::maybePurgeOthers()
+Client::maybePurgeOthers()
 {
     // only some HTTP methods should purge matching cache entries
     if (!request->method.purgesOthers())
@@ -500,7 +500,7 @@ ServerStateData::maybePurgeOthers()
 
 /// called when we have final (possibly adapted) reply headers; kids extend
 void
-ServerStateData::haveParsedReplyHeaders()
+Client::haveParsedReplyHeaders()
 {
     Must(theFinalReply);
     maybePurgeOthers();
@@ -513,7 +513,7 @@ ServerStateData::haveParsedReplyHeaders()
 
 /// whether to prevent caching of an otherwise cachable response
 bool
-ServerStateData::blockCaching()
+Client::blockCaching()
 {
     if (const Acl::Tree *acl = Config.accessList.storeMiss) {
         // This relatively expensive check is not in StoreEntry::checkCachable:
@@ -530,7 +530,7 @@ ServerStateData::blockCaching()
 }
 
 HttpRequest *
-ServerStateData::originalRequest()
+Client::originalRequest()
 {
     return request;
 }
@@ -538,9 +538,9 @@ ServerStateData::originalRequest()
 #if USE_ADAPTATION
 /// Initiate an asynchronous adaptation transaction which will call us back.
 void
-ServerStateData::startAdaptation(const Adaptation::ServiceGroupPointer &group, HttpRequest *cause)
+Client::startAdaptation(const Adaptation::ServiceGroupPointer &group, HttpRequest *cause)
 {
-    debugs(11, 5, "ServerStateData::startAdaptation() called");
+    debugs(11, 5, "Client::startAdaptation() called");
     // check whether we should be sending a body as well
     // start body pipe to feed ICAP transaction if needed
     assert(!virginBodyDestination);
@@ -564,7 +564,7 @@ ServerStateData::startAdaptation(const Adaptation::ServiceGroupPointer &group, H
 
 // properly cleans up ICAP-related state
 // may be called multiple times
-void ServerStateData::cleanAdaptation()
+void Client::cleanAdaptation()
 {
     debugs(11,5, HERE << "cleaning ICAP; ACL: " << adaptationAccessCheckPending);
 
@@ -581,7 +581,7 @@ void ServerStateData::cleanAdaptation()
 }
 
 bool
-ServerStateData::doneWithAdaptation() const
+Client::doneWithAdaptation() const
 {
     return !adaptationAccessCheckPending &&
            !virginBodyDestination && !adaptedHeadSource && !adaptedBodySource;
@@ -589,7 +589,7 @@ ServerStateData::doneWithAdaptation() const
 
 // sends virgin reply body to ICAP, buffering excesses if needed
 void
-ServerStateData::adaptVirginReplyBody(const char *data, ssize_t len)
+Client::adaptVirginReplyBody(const char *data, ssize_t len)
 {
     assert(startedAdaptation);
 
@@ -631,7 +631,7 @@ ServerStateData::adaptVirginReplyBody(const char *data, ssize_t len)
 
 // can supply more virgin response body data
 void
-ServerStateData::noteMoreBodySpaceAvailable(BodyPipe::Pointer)
+Client::noteMoreBodySpaceAvailable(BodyPipe::Pointer)
 {
     if (responseBodyBuffer) {
         addVirginReplyBody(NULL, 0); // kick the buffered fragment alive again
@@ -645,7 +645,7 @@ ServerStateData::noteMoreBodySpaceAvailable(BodyPipe::Pointer)
 
 // the consumer of our virgin response body aborted
 void
-ServerStateData::noteBodyConsumerAborted(BodyPipe::Pointer)
+Client::noteBodyConsumerAborted(BodyPipe::Pointer)
 {
     stopProducingFor(virginBodyDestination, false);
 
@@ -657,7 +657,7 @@ ServerStateData::noteBodyConsumerAborted(BodyPipe::Pointer)
 
 // received adapted response headers (body may follow)
 void
-ServerStateData::noteAdaptationAnswer(const Adaptation::Answer &answer)
+Client::noteAdaptationAnswer(const Adaptation::Answer &answer)
 {
     clearAdaptation(adaptedHeadSource); // we do not expect more messages
 
@@ -677,7 +677,7 @@ ServerStateData::noteAdaptationAnswer(const Adaptation::Answer &answer)
 }
 
 void
-ServerStateData::handleAdaptedHeader(HttpMsg *msg)
+Client::handleAdaptedHeader(HttpMsg *msg)
 {
     if (abortOnBadEntry("entry went bad while waiting for adapted headers")) {
         // If the adapted response has a body, the ICAP side needs to know
@@ -711,7 +711,7 @@ ServerStateData::handleAdaptedHeader(HttpMsg *msg)
 }
 
 void
-ServerStateData::resumeBodyStorage()
+Client::resumeBodyStorage()
 {
     if (abortOnBadEntry("store entry aborted while kick producer callback"))
         return;
@@ -727,7 +727,7 @@ ServerStateData::resumeBodyStorage()
 
 // more adapted response body is available
 void
-ServerStateData::handleMoreAdaptedBodyAvailable()
+Client::handleMoreAdaptedBodyAvailable()
 {
     if (abortOnBadEntry("entry refuses adapted body"))
         return;
@@ -743,9 +743,9 @@ ServerStateData::handleMoreAdaptedBodyAvailable()
 
     if (spaceAvailable < contentSize ) {
         // No or partial body data consuming
-        typedef NullaryMemFunT<ServerStateData> Dialer;
-        AsyncCall::Pointer call = asyncCall(93, 5, "ServerStateData::resumeBodyStorage",
-                                            Dialer(this, &ServerStateData::resumeBodyStorage));
+        typedef NullaryMemFunT<Client> Dialer;
+        AsyncCall::Pointer call = asyncCall(93, 5, "Client::resumeBodyStorage",
+                                            Dialer(this, &Client::resumeBodyStorage));
         entry->deferProducer(call);
     }
 
@@ -774,7 +774,7 @@ ServerStateData::handleMoreAdaptedBodyAvailable()
 
 // the entire adapted response body was produced, successfully
 void
-ServerStateData::handleAdaptedBodyProductionEnded()
+Client::handleAdaptedBodyProductionEnded()
 {
     if (abortOnBadEntry("entry went bad while waiting for adapted body eof"))
         return;
@@ -786,14 +786,14 @@ ServerStateData::handleAdaptedBodyProductionEnded()
 }
 
 void
-ServerStateData::endAdaptedBodyConsumption()
+Client::endAdaptedBodyConsumption()
 {
     stopConsumingFrom(adaptedBodySource);
     handleAdaptationCompleted();
 }
 
 // premature end of the adapted response body
-void ServerStateData::handleAdaptedBodyProducerAborted()
+void Client::handleAdaptedBodyProducerAborted()
 {
     stopConsumingFrom(adaptedBodySource);
     handleAdaptationAborted();
@@ -801,7 +801,7 @@ void ServerStateData::handleAdaptedBodyProducerAborted()
 
 // common part of noteAdaptationAnswer and handleAdaptedBodyProductionEnded
 void
-ServerStateData::handleAdaptationCompleted()
+Client::handleAdaptationCompleted()
 {
     debugs(11,5, HERE << "handleAdaptationCompleted");
     cleanAdaptation();
@@ -820,7 +820,7 @@ ServerStateData::handleAdaptationCompleted()
 
 // common part of noteAdaptation*Aborted and noteBodyConsumerAborted methods
 void
-ServerStateData::handleAdaptationAborted(bool bypassable)
+Client::handleAdaptationAborted(bool bypassable)
 {
     debugs(11,5, HERE << "handleAdaptationAborted; bypassable: " << bypassable <<
            ", entry empty: " << entry->isEmpty());
@@ -845,7 +845,7 @@ ServerStateData::handleAdaptationAborted(bool bypassable)
 
 // adaptation service wants us to deny HTTP client access to this response
 void
-ServerStateData::handleAdaptationBlocked(const Adaptation::Answer &answer)
+Client::handleAdaptationBlocked(const Adaptation::Answer &answer)
 {
     debugs(11,5, HERE << answer.ruleId);
 
@@ -875,7 +875,7 @@ ServerStateData::handleAdaptationBlocked(const Adaptation::Answer &answer)
 }
 
 void
-ServerStateData::noteAdaptationAclCheckDone(Adaptation::ServiceGroupPointer group)
+Client::noteAdaptationAclCheckDone(Adaptation::ServiceGroupPointer group)
 {
     adaptationAccessCheckPending = false;
 
@@ -903,7 +903,7 @@ ServerStateData::noteAdaptationAclCheckDone(Adaptation::ServiceGroupPointer grou
 #endif
 
 void
-ServerStateData::sendBodyIsTooLargeError()
+Client::sendBodyIsTooLargeError()
 {
     ErrorState *err = new ErrorState(ERR_TOO_BIG, Http::scForbidden, request);
     fwd->fail(err);
@@ -914,7 +914,7 @@ ServerStateData::sendBodyIsTooLargeError()
 // TODO: when HttpStateData sends all errors to ICAP,
 // we should be able to move this at the end of setVirginReply().
 void
-ServerStateData::adaptOrFinalizeReply()
+Client::adaptOrFinalizeReply()
 {
 #if USE_ADAPTATION
     // TODO: merge with client side and return void to hide the on/off logic?
@@ -932,7 +932,7 @@ ServerStateData::adaptOrFinalizeReply()
 
 /// initializes bodyBytesRead stats if needed and applies delta
 void
-ServerStateData::adjustBodyBytesRead(const int64_t delta)
+Client::adjustBodyBytesRead(const int64_t delta)
 {
     int64_t &bodyBytesRead = originalRequest()->hier.bodyBytesRead;
 
@@ -947,7 +947,7 @@ ServerStateData::adjustBodyBytesRead(const int64_t delta)
 }
 
 void
-ServerStateData::addVirginReplyBody(const char *data, ssize_t len)
+Client::addVirginReplyBody(const char *data, ssize_t len)
 {
     adjustBodyBytesRead(len);
 
@@ -963,7 +963,7 @@ ServerStateData::addVirginReplyBody(const char *data, ssize_t len)
 
 // writes virgin or adapted reply body to store
 void
-ServerStateData::storeReplyBody(const char *data, ssize_t len)
+Client::storeReplyBody(const char *data, ssize_t len)
 {
     // write even if len is zero to push headers towards the client side
     entry->write (StoreIOBuffer(len, currentOffset, (char*)data));
@@ -971,7 +971,7 @@ ServerStateData::storeReplyBody(const char *data, ssize_t len)
     currentOffset += len;
 }
 
-size_t ServerStateData::replyBodySpace(const MemBuf &readBuf,
+size_t Client::replyBodySpace(const MemBuf &readBuf,
                                        const size_t minSpace) const
 {
     size_t space = readBuf.spaceSize(); // available space w/o heroic measures
@@ -1001,7 +1001,7 @@ size_t ServerStateData::replyBodySpace(const MemBuf &readBuf,
         size_t adaptation_space =
             virginBodyDestination->buf().potentialSpaceSize();
 
-        debugs(11,9, "ServerStateData may read up to min(" <<
+        debugs(11,9, "Client may read up to min(" <<
                adaptation_space << ", " << space << ") bytes");
 
         if (adaptation_space < space)
similarity index 95%
rename from src/Server.h
rename to src/clients/Client.h
index 66529aa154785f5a3942e7ffc81093b6b2b25b8c..b5c9b4c8d96038e863e86fc79cc31cb399c4e18a 100644 (file)
@@ -6,8 +6,8 @@
  * Please see the COPYING and CONTRIBUTORS files for details.
  */
 
-#ifndef SQUID_SERVER_H
-#define SQUID_SERVER_H
+#ifndef SQUID_SRC_CLIENTS_CLIENT_H
+#define SQUID_SRC_CLIENTS_CLIENT_H
 
 #include "base/AsyncJob.h"
 #include "BodyPipe.h"
@@ -23,15 +23,13 @@ class HttpMsg;
 class HttpReply;
 
 /**
- * ServerStateData is a common base for server-side classes such as
+ * Client is a common base for server-side classes such as
  * HttpStateData and FtpStateData. All such classes must be able to
  * consume request bodies from the client-side or ICAP producer, adapt
  * virgin responses using ICAP, and provide the client-side consumer with
  * responses.
- *
- \todo TODO: Rename to ServerStateDataInfoRecordHandler.
  */
-class ServerStateData:
+class Client:
 #if USE_ADAPTATION
         public Adaptation::Initiator,
         public BodyProducer,
@@ -40,8 +38,8 @@ class ServerStateData:
 {
 
 public:
-    ServerStateData(FwdState *);
-    virtual ~ServerStateData();
+    Client(FwdState *);
+    virtual ~Client();
 
     /// \return primary or "request data connection"
     virtual const Comm::ConnectionPointer & dataConnection() const = 0;
@@ -181,4 +179,4 @@ private:
     HttpReply *theFinalReply;        /**< adapted reply from ICAP or virgin reply */
 };
 
-#endif /* SQUID_SERVER_H */
+#endif /* SQUID_SRC_CLIENTS_CLIENT_H */
index 4265426c40056581e7f60e14a289b29a5c7d348f..8466fbaf15d7d92d3553292fd9479cfbca2b6519 100644 (file)
@@ -163,7 +163,7 @@ Ftp::DataChannel::addr(const Ip::Address &import)
 
 Ftp::Client::Client(FwdState *fwdState):
         AsyncJob("Ftp::Client"),
-        ::ServerStateData(fwdState),
+        ::Client(fwdState),
         ctrl(),
         data(),
         state(BEGIN),
@@ -1020,7 +1020,7 @@ Ftp::Client::sentRequestBody(const CommIoCbParams &io)
 {
     if (io.size > 0)
         kb_incr(&(statCounter.server.ftp.kbytes_out), io.size);
-    ::ServerStateData::sentRequestBody(io);
+    ::Client::sentRequestBody(io);
 }
 
 /**
@@ -1029,7 +1029,7 @@ Ftp::Client::sentRequestBody(const CommIoCbParams &io)
 void
 Ftp::Client::doneSendingRequestBody()
 {
-    ::ServerStateData::doneSendingRequestBody();
+    ::Client::doneSendingRequestBody();
     debugs(9, 3, status());
     dataComplete();
     /* NP: RFC 959  3.3.  DATA CONNECTION MANAGEMENT
index e2424c8fb30238b8c1fc3fa52b98f918ee5a03c6..028aa614583d1feadd1ae16a6147c0b8dc6bec25 100644 (file)
@@ -11,7 +11,7 @@
 #ifndef SQUID_FTP_CLIENT_H
 #define SQUID_FTP_CLIENT_H
 
-#include "Server.h"
+#include "clients/Client.h"
 
 class String;
 namespace Ftp
@@ -89,7 +89,7 @@ public:
 };
 
 /// FTP client functionality shared among FTP Gateway and Relay clients.
-class Client: public ::ServerStateData
+class Client: public ::Client
 {
 public:
     explicit Client(FwdState *fwdState);
@@ -101,7 +101,7 @@ public:
     /// read timeout handler
     virtual void timeout(const CommTimeoutCbParams &io);
 
-    /* ServerStateData API */
+    /* Client API */
     virtual void maybeReadVirginBody();
 
     void writeCommand(const char *buf);
@@ -160,7 +160,7 @@ protected:
     /* AsyncJob API */
     virtual void start();
 
-    /* ServerStateData API */
+    /* Client API */
     virtual void closeServer();
     virtual bool doneWithServer() const;
     virtual const Comm::ConnectionPointer & dataConnection() const;
index 11f04ec3c0fa2ff069eb51415dfe03701dd17292..f6f439820cd14ff34ce6866cf2d0df25a3b24054 100644 (file)
@@ -33,7 +33,6 @@
 #include "MemBuf.h"
 #include "mime.h"
 #include "rfc1738.h"
-#include "Server.h"
 #include "SquidConfig.h"
 #include "SquidString.h"
 #include "SquidTime.h"
@@ -2320,7 +2319,7 @@ ftpReadTransferDone(Ftp::Gateway * ftpState)
 void
 Ftp::Gateway::handleRequestBodyProducerAborted()
 {
-    ServerStateData::handleRequestBodyProducerAborted();
+    Client::handleRequestBodyProducerAborted();
     debugs(9, 3, HERE << "ftpState=" << this);
     failed(ERR_READ_ERROR, 0);
 }
@@ -2622,7 +2621,7 @@ Ftp::Gateway::appendSuccessHeader()
 void
 Ftp::Gateway::haveParsedReplyHeaders()
 {
-    ServerStateData::haveParsedReplyHeaders();
+    Client::haveParsedReplyHeaders();
 
     StoreEntry *e = entry;
 
@@ -2713,7 +2712,7 @@ Ftp::Gateway::completeForwarding()
     }
 
     flags.completed_forwarding = true;
-    ServerStateData::completeForwarding();
+    Client::completeForwarding();
 }
 
 /**
index 22794d9f04fa90f967f79a9753fe00fbd08f3a2c..5c11a23d6e141be5d253c489dbbefff25d116411 100644 (file)
@@ -18,7 +18,6 @@
 #include "HttpHdrCc.h"
 #include "HttpRequest.h"
 #include "SBuf.h"
-#include "Server.h"
 #include "servers/FtpServer.h"
 #include "SquidTime.h"
 #include "Store.h"
@@ -46,7 +45,7 @@ protected:
     virtual void failed(err_type error = ERR_NONE, int xerrno = 0);
     virtual void dataChannelConnected(const CommConnectCbParams &io);
 
-    /* ServerStateData API */
+    /* Client API */
     virtual void serverComplete();
     virtual void handleControlReply();
     virtual void processReplyBody();
@@ -152,7 +151,7 @@ Ftp::Relay::Relay(FwdState *const fwdState):
 
 Ftp::Relay::~Relay()
 {
-    closeServer(); // TODO: move to Server.cc?
+    closeServer(); // TODO: move to clients/Client.cc?
     if (savedReply.message)
         wordlistDestroy(&savedReply.message);
 
@@ -327,7 +326,7 @@ Ftp::Relay::handleControlReply()
 void
 Ftp::Relay::handleRequestBodyProducerAborted()
 {
-    ::ServerStateData::handleRequestBodyProducerAborted();
+    ::Client::handleRequestBodyProducerAborted();
 
     failed(ERR_READ_ERROR);
 }
index 2e39afabece8f7ad7fcf42be333ddd5ea6e82013..7391e252a5971a640b45cb95307f5f25342f7c8e 100644 (file)
@@ -11,6 +11,8 @@ include $(top_srcdir)/src/TestHeaders.am
 noinst_LTLIBRARIES = libclients.la
 
 libclients_la_SOURCES = \
+       Client.cc \
+       Client.h \
        FtpClient.cc \
        FtpClient.h \
        FtpGateway.cc \
index 9e5e694f3e467d28bcb0b393e052ad9962c61482..0e3a91434e4beebdc948f04399e159379f72ef72 100644 (file)
@@ -82,7 +82,7 @@ static void copyOneHeaderFromClientsideRequestToUpstreamRequest(const HttpHeader
 //Declared in HttpHeaderTools.cc
 void httpHdrAdd(HttpHeader *heads, HttpRequest *request, const AccessLogEntryPointer &al, HeaderWithAclList &headers_add);
 
-HttpStateData::HttpStateData(FwdState *theFwdState) : AsyncJob("HttpStateData"), ServerStateData(theFwdState),
+HttpStateData::HttpStateData(FwdState *theFwdState) : AsyncJob("HttpStateData"), Client(theFwdState),
         lastChunk(0), header_bytes_read(0), reply_bytes_read(0),
         body_bytes_truncated(0), httpChunkDecoder(NULL)
 {
@@ -126,7 +126,7 @@ HttpStateData::HttpStateData(FwdState *theFwdState) : AsyncJob("HttpStateData"),
 HttpStateData::~HttpStateData()
 {
     /*
-     * don't forget that ~ServerStateData() gets called automatically
+     * don't forget that ~Client() gets called automatically
      */
 
     if (!readBuf->isNull())
@@ -896,7 +896,7 @@ bool HttpStateData::peerSupportsConnectionPinning() const
 void
 HttpStateData::haveParsedReplyHeaders()
 {
-    ServerStateData::haveParsedReplyHeaders();
+    Client::haveParsedReplyHeaders();
 
     Ctx ctx = ctx_enter(entry->mem_obj->urlXXX());
     HttpReply *rep = finalReply();
@@ -2224,7 +2224,7 @@ HttpStateData::getMoreRequestBody(MemBuf &buf)
 {
     // parent's implementation can handle the no-encoding case
     if (!flags.chunked_request)
-        return ServerStateData::getMoreRequestBody(buf);
+        return Client::getMoreRequestBody(buf);
 
     MemBuf raw;
 
@@ -2333,7 +2333,7 @@ HttpStateData::finishingChunkedRequest()
 void
 HttpStateData::doneSendingRequestBody()
 {
-    ServerStateData::doneSendingRequestBody();
+    Client::doneSendingRequestBody();
     debugs(11,5, HERE << serverConnection);
 
     // do we need to write something after the last body byte?
@@ -2380,7 +2380,7 @@ HttpStateData::handleMoreRequestBodyAvailable()
 void
 HttpStateData::handleRequestBodyProducerAborted()
 {
-    ServerStateData::handleRequestBodyProducerAborted();
+    Client::handleRequestBodyProducerAborted();
     if (entry->isEmpty()) {
         debugs(11, 3, "request body aborted: " << serverConnection);
         // We usually get here when ICAP REQMOD aborts during body processing.
@@ -2402,7 +2402,7 @@ HttpStateData::sentRequestBody(const CommIoCbParams &io)
     if (io.size > 0)
         kb_incr(&statCounter.server.http.kbytes_out, io.size);
 
-    ServerStateData::sentRequestBody(io);
+    Client::sentRequestBody(io);
 }
 
 // Quickly abort the transaction
index f74cd99b2e16c8744a147f815b5bf94815c6e886..a710c366013f836f1366c95e250909828d2af28e 100644 (file)
@@ -9,15 +9,15 @@
 #ifndef SQUID_HTTP_H
 #define SQUID_HTTP_H
 
+#include "clients/Client.h"
 #include "comm.h"
 #include "HttpStateFlags.h"
-#include "Server.h"
 
 class ChunkedCodingParser;
 class FwdState;
 class HttpHeader;
 
-class HttpStateData : public ServerStateData
+class HttpStateData : public Client
 {
 
 public: