Manages a connection from an HTTP/1 or HTTP/0.9 client. More...

#include <Http1Server.h>

Inheritance diagram for Http::One::Server:
Collaboration diagram for Http::One::Server:

Public Types

typedef CbcPointer< AsyncJobPointer
typedef CbcPointer< BodyProducerPointer

Public Member Functions

 Server (const MasterXaction::Pointer &xact, const bool beHttpsServer)
virtual ~Server ()
void readSomeHttpData ()
bool reading () const
 whether Comm::Read() is scheduled More...
virtual void receivedFirstByte ()
 Update flags and timeout after the first byte received. More...
virtual bool handleReadData ()
virtual void afterClientRead ()
 processing to be done after a Comm::Read() More...
virtual void afterClientWrite (size_t)
 processing to sync state after a Comm::Write() More...
virtual void sendControlMsg (HttpControlMsg)
 called to send the 1xx message and notify the Source More...
virtual void doneWithControlMsg ()
bool clientParseRequests ()
 Traffic parsing. More...
void readNextRequest ()
void kick ()
 try to make progress on a transaction or read more I/O More...
bool isOpen () const
int64_t mayNeedToReadMoreBody () const
const Auth::UserRequest::PointergetAuth () const
void setAuth (const Auth::UserRequest::Pointer &aur, const char *cause)
bool transparent () const
const char * stoppedReceiving () const
 true if we stopped receiving the request More...
const char * stoppedSending () const
 true if we stopped sending the response More...
void stopReceiving (const char *error)
 note request receiving error and close as soon as we write the response More...
void stopSending (const char *error)
 note response sending error and close as soon as we read the request More...
void expectNoForwarding ()
 cleans up virgin request [body] forwarding state More...
BodyPipe::Pointer expectRequestBody (int64_t size)
bool handleRequestBodyData ()
void notePinnedConnectionBecameIdle (PinnedIdleContext pic)
 Called when a pinned connection becomes available for forwarding the next request. More...
void pinBusyConnection (const Comm::ConnectionPointer &pinServerConn, const HttpRequest::Pointer &request)
void unpinConnection (const bool andClose)
 Undo pinConnection() and, optionally, close the pinned connection. More...
CachePeerpinnedPeer () const
bool pinnedAuth () const
virtual void notePeerConnection (Comm::ConnectionPointer)
 called just before a FwdState-dispatched job starts using connection More...
virtual void clientPinnedConnectionClosed (const CommCloseCbParams &io)
 Our close handler called by Comm when the pinned connection is closed. More...
void clientReadFtpData (const CommIoCbParams &io)
void connStateClosed (const CommCloseCbParams &io)
void requestTimeout (const CommTimeoutCbParams &params)
virtual bool doneAll () const
 whether positive goal has been reached More...
virtual void swanSong ()
void quitAfterError (HttpRequest *request)
void stopPinnedConnectionMonitoring ()
 The caller assumes responsibility for connection closure detection. More...
void postHttpsAccept ()
 the second part of old httpsAccept, waiting for future HttpsServer home More...
void startPeekAndSplice ()
 Initializes and starts a peek-and-splice negotiation with the SSL client. More...
void doPeekAndSpliceStep ()
void httpsPeeked (PinnedIdleContext pic)
 called by FwdState when it is done bumping the server More...
bool splice ()
 Splice a bumped client connection on peek-and-splice mode. More...
void getSslContextStart ()
 Start to create dynamic Security::ContextPointer for host or uses static port SSL context. More...
void getSslContextDone (Security::ContextPointer &)
 finish configuring the newly created SSL context" More...
void sslCrtdHandleReply (const Helper::Reply &reply)
 Proccess response from ssl_crtd. More...
void switchToHttps (ClientHttpRequest *, Ssl::BumpMode bumpServerMode)
void parseTlsHandshake ()
bool switchedToHttps () const
Ssl::ServerBumpserverBump ()
void setServerBump (Ssl::ServerBump *srvBump)
const SBufsslCommonName () const
void resetSslCommonName (const char *name)
const SBuftlsClientSni () const
void buildSslCertGenerationParams (Ssl::CertificateProperties &certProperties)
bool serveDelayedError (Http::Stream *)
char * prepareTlsSwitchingURL (const Http1::RequestParserPointer &hp)
void consumeInput (const size_t byteCount)
 remove no longer needed leading bytes from the input buffer More...
Http::StreamabortRequestParsing (const char *const errUri)
 stop parsing the request and create context for relaying error info More...
bool fakeAConnectRequest (const char *reason, const SBuf &payload)
bool initiateTunneledRequest (HttpRequest::Pointer const &cause, Http::MethodType const method, const char *reason, const SBuf &payload)
 generates and sends to a fake request with a given payload More...
bool shouldPreserveClientData () const
bool tunnelOnError (const HttpRequestMethod &, const err_type)
 initiate tunneling if possible or return false otherwise More...
ClientHttpRequestbuildFakeRequest (Http::MethodType const method, SBuf &useHost, unsigned short usePort, const SBuf &payload)
 build a fake http request More...
virtual void startShutdown ()
virtual void endingShutdown ()
NotePairs::Pointer notes ()
bool hasNotes () const
const ProxyProtocol::HeaderPointerproxyProtocolHeader () const
void readSomeData ()
 maybe grow the inBuf and schedule Comm::Read() More...
void stopReading ()
 cancels Comm::Read() if it is scheduled More...
virtual void writeSomeData ()
 maybe find some data to send and schedule a Comm::Write() More...
void write (MemBuf *mb)
 schedule some data for a Comm::Write() More...
void write (char *buf, int len)
 schedule some data for a Comm::Write() More...
bool writing () const
 whether Comm::Write() is scheduled More...
void maybeMakeSpaceAvailable ()
 grows the available read buffer space (if possible) More...
bool canBeCalled (AsyncCall &call) const
 whether we can be called More...
void callStart (AsyncCall &call)
virtual void callEnd ()
 called right after the called job method More...
virtual void callException (const std::exception &e)
 called when the job throws during an async call More...
virtual void * toCbdata ()=0
void wroteControlMsg (const CommIoCbParams &)
 callback to handle Comm::Write completion More...

Static Public Member Functions

static Comm::ConnectionPointer BorrowPinnedConnection (HttpRequest *, const AccessLogEntryPointer &)
static void sslCrtdHandleReplyWrapper (void *data, const Helper::Reply &reply)
 Callback function. It is called when squid receive message from ssl_crtd. More...
static Pointer Start (AsyncJob *job)
 starts a freshly created job (i.e., makes the job asynchronous) More...

Public Attributes

 parses HTTP/1.1 chunked request body More...
Ip::Address log_addr
struct {
   bool   readMore
 needs comm_read (for this request or new requests) More...
   bool   swanSang
struct {
   Comm::ConnectionPointer   serverConnection
   char *   host
   int   port
   bool   pinned
   bool   auth
   bool   reading
 we are monitoring for peer connection closure More...
   bool   zeroReply
 server closed w/o response (ERR_ZERO_SIZE_OBJECT) More...
   bool   peerAccessDenied
 cache_peer_access denied pinned connection reuse More...
   CachePeer *   peer
   AsyncCall::Pointer   readHandler
 detects serverConnection closure More...
   AsyncCall::Pointer   closeHandler
Ssl::BumpMode sslBumpMode
 ssl_bump decision (Ssl::bumpEnd if n/a). More...
Security::HandshakeParser tlsParser
SBuf preservedClientData
Comm::ConnectionPointer clientConnection
AnyP::ProtocolVersion transferProtocol
SBuf inBuf
 read I/O buffer for the client connection More...
bool receivedFirstByte_
 true if at least one byte received on this connection More...
Pipeline pipeline
 set of requests waiting to be serviced More...
AsyncCall::Pointer cbControlMsgSent
 Call to schedule when the control msg has been sent. More...

Protected Member Functions

virtual Http::StreamparseOneRequest ()
virtual void processParsedRequest (Http::StreamPointer &context)
 start processing a freshly parsed request More...
virtual void handleReply (HttpReply *rep, StoreIOBuffer receivedData)
virtual bool writeControlMsgAndCall (HttpReply *rep, AsyncCall::Pointer &call)
 handle a control message received by context from a peer and call back More...
virtual time_t idleTimeout () const
 timeout to use when waiting for the next request More...
virtual void noteMoreBodySpaceAvailable (BodyPipe::Pointer)
virtual void noteBodyConsumerAborted (BodyPipe::Pointer)
virtual void start ()
 called by AsyncStart; do not call directly More...
void proceedAfterBodyContinuation (Http::StreamPointer context)
void startDechunkingRequest ()
 initialize dechunking state More...
void finishDechunkingRequest (bool withSuccess)
 put parsed content into input buffer and clean up More...
void abortChunkedRequestBody (const err_type error)
 quit on errors related to chunked request body handling More...
err_type handleChunkedRequestBody ()
 parses available chunked encoded body bytes, checks size, returns errors More...
Comm::ConnectionPointer borrowPinnedConnection (HttpRequest *, const AccessLogEntryPointer &)
 ConnStateData-specific part of BorrowPinnedConnection() More...
void startPinnedConnectionMonitoring ()
void clientPinnedConnectionRead (const CommIoCbParams &io)
bool handleIdleClientPinnedTlsRead ()
Http::StreamparseHttpRequest (const Http1::RequestParserPointer &)
virtual int pipelinePrefetchMax () const
 returning N allows a pipeline of 1+N requests (see pipeline_prefetch) More...
void whenClientIpKnown ()
void doClientRead (const CommIoCbParams &io)
void clientWriteDone (const CommIoCbParams &io)
void deleteThis (const char *aReason)
void mustStop (const char *aReason)
bool done () const
 the job is destroyed in callEnd() when done() More...
virtual const char * status () const
 internal cleanup; do not call directly More...
void stopProducingFor (RefCount< BodyPipe > &, bool atEof)

Protected Attributes

BodyPipe::Pointer bodyPipe
 set when we are reading request body More...
bool preservingClientData_
 whether preservedClientData is valid and should be kept up to date More...
AsyncCall::Pointer reader
 set when we are reading More...
AsyncCall::Pointer writer
 set when we are writing More...
const char * stopReason
 reason for forcing done() to be true More...
const char * typeName
 kid (leaf) class name, for debugging More...
AsyncCall::Pointer inCall
 the asynchronous call being handled, if any More...
const InstanceId< AsyncJobid
 job identifier More...

Private Member Functions

void processHttpRequest (Http::Stream *const context)
void handleHttpRequestData ()
bool buildHttpRequest (Http::StreamPointer &context)
void setReplyError (Http::StreamPointer &context, HttpRequest::Pointer &request, const HttpRequestMethod &method, err_type requestError, Http::StatusCode errStatusCode, const char *requestErrorBytes)

Private Attributes

Http1::RequestParserPointer parser_
HttpRequestMethod method_
 parsed HTTP method More...
const bool isHttpsServer
 temporary hack to avoid creating a true HttpsServer class More...

Detailed Description

Definition at line 20 of file Http1Server.h.

Member Typedef Documentation

◆ Pointer [1/2]

Definition at line 25 of file BodyPipe.h.

◆ Pointer [2/2]

Definition at line 34 of file AsyncJob.h.

Constructor & Destructor Documentation

◆ Server()

Server::Server ( const MasterXaction::Pointer xact,
const bool  beHttpsServer 

Definition at line 27 of file

◆ ~Server()

Member Function Documentation

◆ abortChunkedRequestBody()

◆ abortRequestParsing()

◆ afterClientRead()

void ConnStateData::afterClientRead ( )

Implements Server.

Definition at line 1967 of file

References commIsHalfClosed(), debugs, fd_note(), and isOpen().

◆ afterClientWrite()

void ConnStateData::afterClientWrite ( size_t  )

◆ BorrowPinnedConnection()

Comm::ConnectionPointer ConnStateData::BorrowPinnedConnection ( HttpRequest request,
const AccessLogEntryPointer ale 
validated pinned to-server connection, stopping its monitoring
anewly allocated ErrorState if validation fails

Definition at line 3959 of file

References ERR_CANNOT_FORWARD, ErrorState::NewForwarding(), HttpRequest::pinnedConnection(), and request().

Referenced by FwdState::usePinned(), and TunnelStateData::usePinned().

◆ borrowPinnedConnection()

◆ buildFakeRequest()

ClientHttpRequest * ConnStateData::buildFakeRequest ( Http::MethodType const  method,
SBuf useHost,
unsigned short  usePort,
const SBuf payload 

◆ buildHttpRequest()

◆ buildSslCertGenerationParams()

void ConnStateData::buildSslCertGenerationParams ( Ssl::CertificateProperties certProperties)

◆ callEnd()

void AsyncJob::callEnd ( )

◆ callException()

◆ callStart()

void AsyncJob::callStart ( AsyncCall call)

◆ canBeCalled()

bool AsyncJob::canBeCalled ( AsyncCall call) const

Definition at line 101 of file

References AsyncCall::cancel(), debugs, HERE(), AsyncJob::inCall, and NULL.

Referenced by AsyncJob::swanSong().


Http::One::Server::CBDATA_CLASS ( Server  )

◆ clientParseRequests()

bool ConnStateData::clientParseRequests ( )

Attempt to parse one or more requests from the input buffer. Returns true after completing parsing of at least one request [header]. That includes cases where parsing ended with an error (e.g., a huge request).

Definition at line 1896 of file

References assert, clientLifetimeTimeout, commCbCall(), commSetConnTimeout(), Config, debugs, HERE(), SquidConfig::lifetime, SquidConfig::maxRequestHeaderSize, Must, and SquidConfig::Timeout.

◆ clientPinnedConnectionClosed()

void ConnStateData::clientPinnedConnectionClosed ( const CommCloseCbParams io)

◆ clientPinnedConnectionRead()

void ConnStateData::clientPinnedConnectionRead ( const CommIoCbParams io)

Our read handler called by Comm when the server either closes an idle pinned connection or perhaps unexpectedly sends something on that idle (from Squid p.o.v.) connection.

Definition at line 3899 of file

References Server::clientConnection, Comm::Connection::close(), CommCommonCbParams::conn, debugs, Pipeline::empty(), Comm::ERR_CLOSING, CommCommonCbParams::flag, ConnStateData::handleIdleClientPinnedTlsRead(), Must, NULL, ConnStateData::pinning, Server::pipeline, and CommIoCbParams::size.

Referenced by ConnStateData::startPinnedConnectionMonitoring().

◆ clientReadFtpData()

void ConnStateData::clientReadFtpData ( const CommIoCbParams io)

◆ clientWriteDone()

void Server::clientWriteDone ( const CommIoCbParams io)

callback handling the Comm::Write completion

Will call afterClientWrite(size_t) to sync the I/O state. Then writeSomeData() to initiate any followup writes that could be immediately done.

Definition at line 186 of file

References Server::afterClientWrite(), Server::clientConnection, CommCommonCbParams::conn, debugs, Comm::ERR_CLOSING, Comm::Connection::fd, CommCommonCbParams::flag, Pipeline::front(), Comm::IsConnOpen(), Must, Server::pipeline, CommIoCbParams::size, Server::writer, and Server::writeSomeData().

Referenced by Server::write().

◆ connStateClosed()

void ConnStateData::connStateClosed ( const CommCloseCbParams io)

Definition at line 499 of file

Referenced by ConnStateData::start().

◆ consumeInput()

void ConnStateData::consumeInput ( const size_t  byteCount)

Definition at line 1435 of file

References assert, and debugs.

Referenced by Ftp::Server::parseOneRequest().

◆ deleteThis()

void AsyncJob::deleteThis ( const char *  aReason)

◆ doClientRead()

◆ done()

◆ doneAll()

virtual bool ConnStateData::doneAll ( ) const

Reimplemented from Server.

Definition at line 209 of file client_side.h.

References data, AsyncJob::doneAll(), and request().

◆ doneWithControlMsg()

void ConnStateData::doneWithControlMsg ( )

◆ doPeekAndSpliceStep()

void ConnStateData::doPeekAndSpliceStep ( )

Called when a peek-and-splice step finished. For example after server SSL certificates received and fake server SSL certificates generated

Definition at line 3183 of file

References assert, BIO_get_data(), Server::clientConnection, clientNegotiateSSL(), COMM_SELECT_WRITE, debugs, Comm::Connection::fd, fd_table, Ssl::ClientBio::hold(), Comm::SetSelect(), and ConnStateData::switchedToHttps_.

Referenced by ConnStateData::getSslContextStart(), and ConnStateData::sslCrtdHandleReply().

◆ endingShutdown()

void ConnStateData::endingShutdown ( )

Called after shutdown_lifetime grace period ends and before stopping the main loop. At least one main loop iteration is guaranteed after this call. Meant for cleanup and state saving that may require other modules.

Reimplemented from RegisteredRunner.

Definition at line 1042 of file

References Comm::IsConnOpen().

◆ expectNoForwarding()

void ConnStateData::expectNoForwarding ( )

◆ expectRequestBody()

BodyPipe::Pointer ConnStateData::expectRequestBody ( int64_t  size)

◆ fakeAConnectRequest()

◆ finishDechunkingRequest()

◆ getAuth()

const Auth::UserRequest::Pointer& ConnStateData::getAuth ( ) const

Fetch the user details for connection based authentication NOTE: this is ONLY connection based because NTLM and Negotiate is against HTTP spec.

Definition at line 116 of file client_side.h.

Referenced by Auth::UserRequest::authenticate(), AuthenticateAcl(), authTryGetUser(), ConnStateData::buildFakeRequest(), ClientHttpRequest::calloutsError(), clientProcessRequest(), and constructHelperQuery().

◆ getSslContextDone()

◆ getSslContextStart()

◆ handleChunkedRequestBody()

err_type ConnStateData::handleChunkedRequestBody ( )

◆ handleHttpRequestData()

void Http::One::Server::handleHttpRequestData ( )

Referenced by ~Server().

◆ handleIdleClientPinnedTlsRead()

bool ConnStateData::handleIdleClientPinnedTlsRead ( )

Handles a ready-for-reading TLS squid-to-server connection that we thought was idle.

false if and only if the connection should be closed.

Definition at line 3858 of file

References buf, DBG_IMPORTANT, debugs, error(), fd_table, Must, ConnStateData::pinning, and ConnStateData::startPinnedConnectionMonitoring().

Referenced by ConnStateData::clientPinnedConnectionRead().

◆ handleReadData()

bool ConnStateData::handleReadData ( )

called when new request data has been read from the socket

Return values
falsecalled comm_close or setReplyToError (the caller should bail)
truewe did not call comm_close or setReplyToError

Implements Server.

Definition at line 2011 of file

References NULL.

◆ handleReply()

void Server::handleReply ( HttpReply header,
StoreIOBuffer  receivedData 

◆ handleRequestBodyData()

bool ConnStateData::handleRequestBodyData ( )

called when new request body data has been buffered in inBuf may close the connection if we were closing and piped everything out

Return values
falsecalled comm_close or setReplyToError (the caller should bail)
truewe did not call comm_close or setReplyToError

Definition at line 2027 of file

References assert, debugs, error(), HERE(), and NULL.

Referenced by clientProcessRequest(), and noteMoreBodySpaceAvailable().

◆ hasNotes()

bool ConnStateData::hasNotes ( ) const

Definition at line 323 of file client_side.h.

Referenced by buildHttpRequest().

◆ httpsPeeked()

◆ idleTimeout()

time_t Server::idleTimeout ( ) const

Implements ConnStateData.

Definition at line 35 of file

References SquidConfig::clientIdlePconn, Config, and SquidConfig::Timeout.

Referenced by ~Server().

◆ initiateTunneledRequest()

◆ isOpen()

◆ kick()

void ConnStateData::kick ( )
We are done with the response, and we are either still receiving request body (early response!) or have already stopped receiving anything.

If we are still receiving, then clientParseRequest() below will fail. (XXX: but then we will call readNextRequest() which may succeed and execute a smuggled request as we are not done with the current request).

If we stopped because we got everything, then try the next request.

If we stopped receiving because of an error, then close now to avoid getting stuck and to prevent accidental request smuggling.

Attempt to parse a request from the request buffer. If we've been fed a pipelined request it may already be in our read buffer.
This needs to fall through - if we're unlucky and parse the last request from our read buffer we may never re-register for another client read.
Either we need to kick-start another read or, if we have a half-closed connection, kill it after the last request. This saves waiting for half-closed connections to finished being half-closed AND then, sometimes, spending "Timeout" time in the keepalive "Waiting for next request" state.
At this point we either have a parsed request (which we've kicked off the processing for) or not. If we have a deferred request (parsed but deferred for pipeling processing reasons) then look at processing it. If not, simply kickstart another read.

Definition at line 895 of file

References ClientSocketContextPushDeferredIfNeeded(), commIsHalfClosed(), DBG_IMPORTANT, debugs, Comm::IsConnOpen(), and MYNAME.

Referenced by ConnStateData::notePinnedConnectionBecameIdle(), Http::Stream::writeComplete(), and Ftp::Server::wroteReply().

◆ maybeMakeSpaceAvailable()

void Server::maybeMakeSpaceAvailable ( )

Prepare inBuf for I/O. This method balances several conflicting desires:

  1. Do not read too few bytes at a time.
  2. Do not waste too much buffer space.
  3. Do not [re]allocate or memmove the buffer too much.
  4. Obey Config.maxRequestBufferSize limit.

Definition at line 70 of file

References SBufReservationRequirements::allowShared, CLIENT_REQ_BUF_SZ, Config, debugs, SBufReservationRequirements::idealSpace, Server::inBuf, SBufReservationRequirements::maxCapacity, SquidConfig::maxRequestBufferSize, SBufReservationRequirements::minSpace, SBuf::reserve(), and SBuf::spaceSize().

Referenced by Server::doClientRead(), and Server::writing().

◆ mayNeedToReadMoreBody()

int64_t ConnStateData::mayNeedToReadMoreBody ( ) const

number of body bytes we need to comm_read for the "current" request

Return values
0We do not need to read any [more] body bytes
negativeMay need more but do not know how many; could be zero!
positiveNeed to read exactly that many more body bytes

Definition at line 3625 of file

References ConnStateData::bodyPipe, BodyPipe::bodySizeKnown(), Server::inBuf, SBuf::length(), and BodyPipe::unproducedSize().

◆ mustStop()

void AsyncJob::mustStop ( const char *  aReason)

Definition at line 69 of file

References debugs, AsyncJob::inCall, Must, NULL, AsyncJob::stopReason, and AsyncJob::typeName.

Referenced by HttpStateData::abortAll(), Ftp::Client::abortAll(), Comm::TcpAcceptor::acceptOne(), Adaptation::Ecap::XactionRep::adaptationAborted(), Adaptation::AccessCheck::callBack(), AsyncJob::callException(), Security::PeerConnector::connectionClosed(), HttpStateData::continueAfterParsingHeader(), Ftp::Client::ctrlClosed(), Adaptation::Iterator::handleAdaptationBlock(), Adaptation::Iterator::handleAdaptationError(), Log::TcpLogger::handleClosure(), Adaptation::Icap::Xaction::handleCommClosed(), Http::Tunneler::handleConnectionClosure(), Mgr::Forwarder::handleError(), Ipc::Forwarder::handleError(), Ipc::Forwarder::handleException(), Ipc::Inquirer::handleException(), HttpStateData::handleMoreRequestBodyAvailable(), Ipc::Inquirer::handleRemoteAck(), Ipc::Forwarder::handleTimeout(), HttpStateData::httpStateConnClosed(), HttpStateData::httpTimeout(), Comm::ConnOpener::noteAbort(), Adaptation::Icap::ModXact::noteBodyConsumerAborted(), Snmp::Forwarder::noteCommClosed(), Snmp::Inquirer::noteCommClosed(), Mgr::Inquirer::noteCommClosed(), Mgr::Forwarder::noteCommClosed(), Mgr::StoreToCommWriter::noteCommClosed(), Adaptation::Icap::Xaction::noteCommRead(), Rock::HeaderUpdater::noteDoneReading(), Adaptation::Iterator::noteInitiatorAborted(), Adaptation::Icap::Xaction::noteInitiatorAborted(), Adaptation::Ecap::XactionRep::noteInitiatorAborted(), HttpStateData::readReply(), Comm::ConnOpener::sendAnswer(), Rock::Rebuild::start(), Security::PeerConnector::start(), HttpStateData::start(), Ipc::UdsSender::timedout(), and HttpStateData::wroteLast().

◆ noteBodyConsumerAborted()

void Server::noteBodyConsumerAborted ( BodyPipe::Pointer  ptr)

Implements ConnStateData.

Definition at line 285 of file

References ConnStateData::noteBodyConsumerAborted(), and ConnStateData::stopReceiving().

Referenced by ~Server().

◆ noteMoreBodySpaceAvailable()

void Server::noteMoreBodySpaceAvailable ( BodyPipe::Pointer  )

◆ notePeerConnection()

virtual void ConnStateData::notePeerConnection ( Comm::ConnectionPointer  )

Reimplemented in Ftp::Server.

Definition at line 197 of file client_side.h.

Referenced by FwdState::successfullyConnectedToPeer().

◆ notePinnedConnectionBecameIdle()

◆ notes()

NotePairs::Pointer ConnStateData::notes ( )
existing non-empty connection annotations, creates and returns empty annotations otherwise

Definition at line 4063 of file

References ConnStateData::theNotes.

Referenced by buildHttpRequest(), and UpdateRequestNotes().

◆ parseHttpRequest()

Http::Stream * ConnStateData::parseHttpRequest ( const Http1::RequestParserPointer hp)

Parse an HTTP request

Sets result->flags.parsed_ok to 0 if failed to parse the request, to 1 if the request was correctly parsed
[in]hpan Http1::RequestParser
NULL on incomplete requests, a Http::Stream on success or failure. TODO: Move to HttpServer. Warning: Move requires large code nonchanges!

Definition at line 1280 of file

References SquidConfig::appendDomainLen, clientGetMoreData, clientReplyDetach, clientReplyStatus, clientSocketDetach(), clientSocketRecipient(), clientStreamInit(), Config, StoreIOBuffer::data, DBG_IMPORTANT, debugs, Http::Stream::flags, HTTP_REQBUF_SZ, internalCheck(), internalLocalUri(), StoreIOBuffer::length, Http::METHOD_CONNECT, Http::METHOD_NONE, Http::METHOD_PRI, Must, NULL, Http::Stream::parsed_ok, port, prepareAcceleratedURL(), prepareTransparentURL(), Http::ProtocolVersion(), Http::Stream::reqbuf, SBufToCstring(), Http::scMethodNotAllowed, Http::scRequestHeaderFieldsTooLarge, Http::scUriTooLong, xcalloc, and xstrdup.

Referenced by parseOneRequest().

◆ parseOneRequest()

Http::Stream * Server::parseOneRequest ( )

parse input buffer prefix into a single transfer protocol request return NULL to request more header bytes (after checking any limits) use abortRequestParsing() to handle parsing errors w/o creating request

Implements ConnStateData.

Definition at line 73 of file

References clientProcessRequestFinished(), clientTunnelOnError(), conn, method, ConnStateData::parseHttpRequest(), parser_, ConnStateData::preservingClientData_, PROF_start, PROF_stop, request(), and ConnStateData::shouldPreserveClientData().

Referenced by ~Server().

◆ parseTlsHandshake()

◆ pinBusyConnection()

void ConnStateData::pinBusyConnection ( const Comm::ConnectionPointer pinServerConn,
const HttpRequest::Pointer request 

Forward future client requests using the given to-server connection. The connection is still being used by the current client request.

Definition at line 3770 of file

References ConnStateData::pinConnection().

Referenced by Ftp::Server::notePeerConnection().

◆ pinnedAuth()

bool ConnStateData::pinnedAuth ( ) const

Definition at line 194 of file client_side.h.

◆ pinnedPeer()

CachePeer* ConnStateData::pinnedPeer ( ) const

returts the pinned CachePeer if exists, NULL otherwise

Definition at line 193 of file client_side.h.

◆ pipelinePrefetchMax()

int ConnStateData::pipelinePrefetchMax ( ) const

Reimplemented in Ftp::Server.

Definition at line 1766 of file

References Config, and SquidConfig::pipeline_max_prefetch.

◆ postHttpsAccept()

◆ prepareTlsSwitchingURL()

char * ConnStateData::prepareTlsSwitchingURL ( const Http1::RequestParserPointer hp)

◆ proceedAfterBodyContinuation()

void Server::proceedAfterBodyContinuation ( Http::StreamPointer  context)

Definition at line 230 of file

References clientProcessRequest(), debugs, RefCount< C >::getRaw(), and parser_.

Referenced by processParsedRequest(), and ~Server().

◆ processHttpRequest()

void Http::One::Server::processHttpRequest ( Http::Stream *const  context)

Referenced by ~Server().

◆ processParsedRequest()

◆ proxyProtocolHeader()

const ProxyProtocol::HeaderPointer& ConnStateData::proxyProtocolHeader ( ) const

Definition at line 325 of file client_side.h.

Referenced by ClientHttpRequest::ClientHttpRequest().

◆ quitAfterError()

void ConnStateData::quitAfterError ( HttpRequest request)

Changes state so that we close the connection and quit after serving the client-side-detected error response instead of getting stuck.

Definition at line 1457 of file

References debugs, HttpRequest::flags, HERE(), and RequestFlags::proxyKeepalive.

Referenced by clientProcessRequest(), Ftp::Server::parseOneRequest(), processParsedRequest(), and setReplyError().

◆ reading()

bool Server::reading ( ) const

◆ readNextRequest()

void ConnStateData::readNextRequest ( )

Set the timeout BEFORE calling readSomeData().

Please don't do anything with the FD past here!

Definition at line 855 of file

References commSetConnTimeout(), debugs, fd_note(), HERE(), JobCallback, and ConnStateData::requestTimeout().

◆ readSomeData()

◆ readSomeHttpData()

void Http::One::Server::readSomeHttpData ( )

Referenced by ~Server().

◆ receivedFirstByte()

void ConnStateData::receivedFirstByte ( )

◆ requestTimeout()

◆ resetSslCommonName()

void ConnStateData::resetSslCommonName ( const char *  name)

◆ sendControlMsg()

◆ serveDelayedError()

◆ serverBump()

◆ setAuth()

void ConnStateData::setAuth ( const Auth::UserRequest::Pointer aur,
const char *  cause 

Set the user details for connection-based authentication to use from now until connection closure.

Any change to existing credentials shows that something invalid has happened. Such as:

  • NTLM/Negotiate auth was violated by the per-request headers missing a revalidation token
  • NTLM/Negotiate auth was violated by the per-request headers being for another user
  • SSL-Bump CONNECT tunnel with persistent credentials has ended

Definition at line 506 of file

References comm_reset_close(), debugs, and NULL.

Referenced by Auth::UserRequest::authenticate(), ProxyAuthLookup::LookupDone(), and ClientHttpRequest::sslBumpEstablish().

◆ setReplyError()

void Server::setReplyError ( Http::StreamPointer context,
HttpRequest::Pointer request,
const HttpRequestMethod method,
err_type  requestError,
Http::StatusCode  errStatusCode,
const char *  requestErrorBytes 

◆ setServerBump()

void ConnStateData::setServerBump ( Ssl::ServerBump srvBump)

Definition at line 251 of file client_side.h.

References assert.

Referenced by ClientHttpRequest::doCallouts().

◆ shouldPreserveClientData()

bool ConnStateData::shouldPreserveClientData ( ) const

◆ splice()

◆ sslCommonName()

const SBuf& ConnStateData::sslCommonName ( ) const

Definition at line 257 of file client_side.h.

◆ sslCrtdHandleReply()

◆ sslCrtdHandleReplyWrapper()

void ConnStateData::sslCrtdHandleReplyWrapper ( void *  data,
const Helper::Reply reply 

Definition at line 2673 of file

References ConnStateData::sslCrtdHandleReply().

Referenced by ConnStateData::getSslContextStart().

◆ Start()

◆ start()

◆ startDechunkingRequest()

void ConnStateData::startDechunkingRequest ( )

◆ startPeekAndSplice()

◆ startPinnedConnectionMonitoring()

void ConnStateData::startPinnedConnectionMonitoring ( )

[re]start monitoring pinned connection for peer closures so that we can propagate them to an idle client pinned to that peer

Definition at line 3836 of file

References ConnStateData::clientPinnedConnectionRead(), JobCallback, NULL, ConnStateData::pinning, and Comm::Read().

Referenced by ConnStateData::handleIdleClientPinnedTlsRead(), and ConnStateData::notePinnedConnectionBecameIdle().

◆ startShutdown()

void ConnStateData::startShutdown ( )

Called after receiving a shutdown request and before stopping the main loop. At least one main loop iteration is guaranteed after this call. Meant for cleanup and state saving that may require other modules.

Reimplemented from RegisteredRunner.

Definition at line 1031 of file

◆ status()

◆ stoppedReceiving()

const char* ConnStateData::stoppedReceiving ( ) const

Definition at line 152 of file client_side.h.

Referenced by noteMoreBodySpaceAvailable(), and ConnStateData::stopReceiving().

◆ stoppedSending()

const char* ConnStateData::stoppedSending ( ) const

Definition at line 154 of file client_side.h.

References error(), and size.

Referenced by ConnStateData::stopReceiving().

◆ stopPinnedConnectionMonitoring()

void ConnStateData::stopPinnedConnectionMonitoring ( )

◆ stopProducingFor()

◆ stopReading()

void Server::stopReading ( )

◆ stopReceiving()

◆ stopSending()

void ConnStateData::stopSending ( const char *  error)

Definition at line 976 of file

References debugs, error(), and HERE().

Referenced by Http::Stream::initiateClose().

◆ swanSong()

void ConnStateData::swanSong ( )

Reimplemented from Server.

Definition at line 587 of file

References clientdbEstablished(), debugs, HERE(), NULL, and Server::swanSong().

◆ switchedToHttps()

bool ConnStateData::switchedToHttps ( ) const

◆ switchToHttps()

◆ tlsClientSni()

const SBuf& ConnStateData::tlsClientSni ( ) const

Definition at line 259 of file client_side.h.

◆ toCbdata()

virtual void* CbdataParent::toCbdata ( )
pure virtualinherited

◆ transparent()

◆ tunnelOnError()

◆ unpinConnection()

◆ whenClientIpKnown()

◆ write() [1/2]

void Server::write ( MemBuf mb)

◆ write() [2/2]

void Server::write ( char *  buf,
int  len 

◆ writeControlMsgAndCall()

◆ writeSomeData()

virtual void Server::writeSomeData ( )

Definition at line 66 of file Server.h.

Referenced by Server::clientWriteDone().

◆ writing()

bool Server::writing ( ) const

Definition at line 86 of file Server.h.

References Server::maybeMakeSpaceAvailable(), NULL, and Server::writer.

◆ wroteControlMsg()

void HttpControlMsgSink::wroteControlMsg ( const CommIoCbParams params)

Member Data Documentation

◆ auth

bool ConnStateData::auth

Definition at line 140 of file client_side.h.

Referenced by clientCheckPinning().

◆ bodyParser

◆ bodyPipe

◆ cbControlMsgSent

AsyncCall::Pointer HttpControlMsgSink::cbControlMsgSent

◆ clientConnection

Comm::ConnectionPointer Server::clientConnection

Definition at line 97 of file Server.h.

Referenced by Ftp::Server::acceptDataConnection(), Format::Format::assemble(), Auth::UserRequest::authenticate(), ConnStateData::buildFakeRequest(), buildHttpRequest(), ConnStateData::buildSslCertGenerationParams(), Ftp::Server::callException(), ClientHttpRequest::calloutsError(), IdentLookup::checkForAsync(), clientAclChecklistFill(), ClientHttpRequest::ClientHttpRequest(), clientIdentDone(), clientNegotiateSSL(), Ftp::Server::clientPinnedConnectionClosed(), ConnStateData::clientPinnedConnectionClosed(), ConnStateData::clientPinnedConnectionRead(), clientProcessRequest(), clientProcessRequestFinished(), ClientSocketContextPushDeferredIfNeeded(), clientSocketRecipient(), Server::clientWriteDone(), constructHelperQuery(), Ftp::Server::createDataConnection(), ClientHttpRequest::doCallouts(), Server::doClientRead(), Server::doneAll(), ConnStateData::doneWithControlMsg(), ConnStateData::doPeekAndSpliceStep(), ESIContext::fail(), ConnStateData::fakeAConnectRequest(), ConnStateData::getSslContextDone(), ConnStateData::getSslContextStart(), Ftp::Server::handlePasvReply(), Ftp::Server::handleRequest(), httpsCreate(), httpsEstablish(), httpsSslBumpAccessCheckDone(), httpsSslBumpStep2AccessCheckDone(), ConnStateData::initiateTunneledRequest(), Ftp::Server::listenForDataConnection(), IdentLookup::LookupDone(), HttpRequest::manager(), ACLIdent::match(), ClientHttpRequest::noteAdaptationAclCheckDone(), ClientHttpRequest::noteBodyProducerAborted(), Ftp::Server::parseOneRequest(), ConnStateData::parseTlsHandshake(), ConnStateData::pinConnection(), ConnStateData::postHttpsAccept(), prepareAcceleratedURL(), prepareTransparentURL(), clientReplyContext::processExpired(), clientReplyContext::processMiss(), clientReplyContext::processOnlyIfCachedMiss(), processParsedRequest(), clientReplyContext::processReplyAccessResult(), clientReplyContext::purgeFoundObject(), clientReplyContext::purgeRequest(), Server::readSomeData(), PeerSelector::resolveSelected(), clientReplyContext::sendBodyTooLargeError(), ConnStateData::sendControlMsg(), clientReplyContext::sendPreconditionFailedError(), setReplyError(), Ftp::Server::shovelUploadData(), ConnStateData::splice(), ClientHttpRequest::sslBumpEstablish(), ClientHttpRequest::sslBumpStart(), ConnStateData::sslCrtdHandleReply(), start(), Ftp::Server::start(), ConnStateData::start(), ConnStateData::startPeekAndSplice(), statClientRequests(), Server::stopReading(), ConnStateData::stopReceiving(), ConnStateData::storeTlsContextToCache(), Server::swanSong(), ConnStateData::switchToHttps(), tlsAttemptHandshake(), ConnStateData::transparent(), tunnelStart(), TunnelStateData::TunnelStateData(), ConnStateData::whenClientIpKnown(), Server::write(), writeControlMsgAndCall(), Ftp::Server::writeEarlyReply(), Ftp::Server::writeForwardedReplyAndCall(), and Ftp::Server::writeReply().

◆ closeHandler

AsyncCall::Pointer ConnStateData::closeHandler

Definition at line 146 of file client_side.h.

◆ flags

◆ host

char* ConnStateData::host

Definition at line 137 of file client_side.h.

◆ id

const InstanceId<AsyncJob> AsyncJob::id

Definition at line 72 of file AsyncJob.h.

◆ inBuf

◆ inCall

◆ isHttpsServer

const bool Http::One::Server::isHttpsServer

Definition at line 63 of file Http1Server.h.

Referenced by start().

◆ log_addr

Ip::Address ConnStateData::log_addr

◆ method_

HttpRequestMethod Http::One::Server::method_

Definition at line 60 of file Http1Server.h.

◆ parser_

Http1::RequestParserPointer Http::One::Server::parser_

◆ peer

CachePeer* ConnStateData::peer

Definition at line 144 of file client_side.h.

Referenced by clientHttpRequestStatus().

◆ peerAccessDenied

bool ConnStateData::peerAccessDenied

Definition at line 143 of file client_side.h.

◆ pinned

bool ConnStateData::pinned

Definition at line 139 of file client_side.h.

Referenced by HttpRequest::pinnedConnection().

◆ pinning

◆ pipeline

◆ port

◆ preservedClientData

SBuf ConnStateData::preservedClientData

From-client handshake bytes (including bytes at the beginning of a CONNECT tunnel) which we may need to forward as-is if their syntax does not match the expected TLS or HTTP protocol (on_unsupported_protocol).

Definition at line 314 of file client_side.h.

Referenced by Format::Format::assemble(), ConnStateData::parseTlsHandshake(), and ConnStateData::splice().

◆ preservingClientData_

bool ConnStateData::preservingClientData_

◆ reader

AsyncCall::Pointer Server::reader

◆ readHandler

AsyncCall::Pointer ConnStateData::readHandler

Definition at line 145 of file client_side.h.

◆ reading

bool ConnStateData::reading

Definition at line 141 of file client_side.h.

◆ readMore

bool ConnStateData::readMore

◆ receivedFirstByte_

bool Server::receivedFirstByte_

Definition at line 112 of file Server.h.

Referenced by Server::doClientRead(), and ConnStateData::switchToHttps().

◆ serverConnection

Comm::ConnectionPointer ConnStateData::serverConnection

Definition at line 136 of file client_side.h.

Referenced by clientCheckPinning().

◆ sslBumpMode

◆ stopReason

const char* AsyncJob::stopReason

◆ swanSang

bool ConnStateData::swanSang

Definition at line 133 of file client_side.h.

◆ tlsParser

Security::HandshakeParser ConnStateData::tlsParser

Tls parser to use for client HELLO messages parsing on bumped connections.

Definition at line 273 of file client_side.h.

Referenced by ConnStateData::parseTlsHandshake().

◆ transferProtocol

AnyP::ProtocolVersion Server::transferProtocol

The transfer protocol currently being spoken on this connection. HTTP/1.x CONNECT, HTTP/1.1 Upgrade and HTTP/2 SETTINGS offer the ability to change protocols on the fly.

Definition at line 104 of file Server.h.

Referenced by buildUrlFromHost(), prepareAcceleratedURL(), prepareTransparentURL(), ConnStateData::splice(), and ConnStateData::switchToHttps().

◆ typeName

◆ writer

AsyncCall::Pointer Server::writer

Definition at line 125 of file Server.h.

Referenced by Server::clientWriteDone(), Server::write(), and Server::writing().

◆ zeroReply

bool ConnStateData::zeroReply

Definition at line 142 of file client_side.h.

The documentation for this class was generated from the following files:






Web Site Translations