Squid Web Cache wiki

Squid Web Cache documentation

πŸ”— Client Streams

πŸ”— Introduction

A clientStream is a uni-directional loosely coupled pipe. Each node consists of four methods - read, callback, detach, and status, along with the stream housekeeping variables (a dlink node and pointer to the head of the list), context data for the node, and read request parameters - readbuf, readlen and readoff (in the body). clientStream is the basic unit for scheduling, and the clientStreamRead and clientStreamCallback calls allow for deferred scheduled activity if desired. Theory on stream operation:

There is no requirement for the Read parameters from different nodes to have any correspondence, as long as the callbacks provided are correct.

πŸ”— Implementation notes

ClientStreams have been implemented for the client side reply logic, starting with either a client socket (tail of the list is clientSocketRecipient) or a custom handler for in-squid requests, and with the pipeline HEAD being clientGetMoreData, which uses clientSendMoreData to send data down the pipeline. client POST bodies do not use a pipeline currently, they use the previous code to send the data. This is a TODO when time permits.

πŸ”— Whats in a node

Each node must have:

πŸ”— Method details

The first parameter is always the β€˜this’ reference for the client stream is a clientStreamNode *.

πŸ”— Read

Parameters:

Side effects: Triggers a read of data that satisfies the httpClientRequest metainformation and (if appropriate) the offset,length and buffer parameters.

πŸ”— Callback

Parameters:

Side effects: Return data to the next node in the stream. The data may be returned immediately, or may be delayed for a later scheduling cycle.

πŸ”— Detach

Parameters:

Side effects:

πŸ”— Status

Parameters:

Side effects: Allows nodes to query the upstream nodes for :

πŸ”— Abort

Parameters:

Side effects: Detachs the tail of the stream. CURRENTLY DOES NOT clean up the tail node data - this must be done separately. Thus Abort may ONLY be called by the tail node.

Navigation: Site Search, Site Pages, Categories, πŸ”Ό go up