http.cc File Reference
#include "squid.h"
#include "acl/FilledChecklist.h"
#include "base/AsyncJobCalls.h"
#include "base/DelayedAsyncCalls.h"
#include "base/Raw.h"
#include "base/TextException.h"
#include "base64.h"
#include "CachePeer.h"
#include "client_side.h"
#include "comm/Connection.h"
#include "comm/Read.h"
#include "comm/Write.h"
#include "error/Detail.h"
#include "errorpage.h"
#include "fd.h"
#include "fde.h"
#include "globals.h"
#include "http.h"
#include "http/one/ResponseParser.h"
#include "http/one/TeChunkedParser.h"
#include "http/StatusCode.h"
#include "http/Stream.h"
#include "HttpControlMsg.h"
#include "HttpHdrCc.h"
#include "HttpHdrContRange.h"
#include "HttpHdrSc.h"
#include "HttpHdrScTarget.h"
#include "HttpHeaderTools.h"
#include "HttpReply.h"
#include "HttpRequest.h"
#include "HttpUpgradeProtocolAccess.h"
#include "log/access_log.h"
#include "MemBuf.h"
#include "MemObject.h"
#include "neighbors.h"
#include "pconn.h"
#include "peer_proxy_negotiate_auth.h"
#include "refresh.h"
#include "RefreshPattern.h"
#include "rfc1738.h"
#include "SquidConfig.h"
#include "StatCounters.h"
#include "Store.h"
#include "StrList.h"
#include "tools.h"
#include "util.h"
#include "auth/UserRequest.h"
#include "DelayPools.h"
Include dependency graph for http.cc:

Go to the source code of this file.

Macros

#define REFRESH_OVERRIDE(flag)
 
#define BBUF_SZ   (MAX_URL+32)
 

Functions

static void httpMaybeRemovePublic (StoreEntry *, Http::StatusCode)
 
static void copyOneHeaderFromClientsideRequestToUpstreamRequest (const HttpHeaderEntry *e, const String strConnection, const HttpRequest *request, HttpHeader *hdr_out, const int we_do_ranges, const Http::StateFlags &)
 
static StoreEntryfindPreviouslyCachedEntry (StoreEntry *newEntry)
 
static void assembleVaryKey (String &vary, SBuf &vstr, const HttpRequest &request)
 assemble a variant key (vary-mark) from the given Vary header and HTTP request More...
 
SBuf httpMakeVaryMark (HttpRequest *request, HttpReply const *reply)
 
static void httpFixupAuthentication (HttpRequest *request, const HttpHeader *hdr_in, HttpHeader *hdr_out, const Http::StateFlags &flags)
 
void httpStart (FwdState *fwd)
 
std::ostream & operator<< (std::ostream &os, const HttpStateData::ReuseDecision &d)
 

Variables

static const char *const crlf = "\r\n"
 

Macro Definition Documentation

◆ BBUF_SZ

#define BBUF_SZ   (MAX_URL+32)

◆ REFRESH_OVERRIDE

#define REFRESH_OVERRIDE (   flag)
Value:
((R = (R ? R : refreshLimits(entry->mem_obj->storeId()))) , \
(R && R->flags.flag))
const RefreshPattern * refreshLimits(const char *url)
Definition: refresh.cc:92

Function Documentation

◆ assembleVaryKey()

static void assembleVaryKey ( String vary,
SBuf vstr,
const HttpRequest request 
)
static

◆ copyOneHeaderFromClientsideRequestToUpstreamRequest()

void copyOneHeaderFromClientsideRequestToUpstreamRequest ( const HttpHeaderEntry e,
const String  strConnection,
const HttpRequest request,
HttpHeader hdr_out,
const int  we_do_ranges,
const Http::StateFlags flags 
)
static

Decides whether a particular header may be cloned from the received Clients request to our outgoing fetch request.

RFC 2616 sect 13.5.1 - Hop-by-Hop headers which Squid should not pass on.
Proxy-Authorization:
Only pass on proxy authentication to peers for which authentication forwarding is explicitly enabled
RFC 2616 sect 13.5.1 - Hop-by-Hop headers which Squid does not pass on.
Connection:
TE:
Keep-Alive:
Proxy-Authenticate:
Trailer:
Transfer-Encoding:
Upgrade is hop-by-hop but forwardUpgrade() may send a filtered one
OTHER headers I haven't bothered to track down yet.
WWW-Authorization:
Pass on WWW authentication
Note
Assume that talking to a cache_peer originserver makes us a reverse proxy and only forward authentication if enabled (see also httpFixupAuthentication for special cases)
Host:
Normally Squid rewrites the Host: header. However, there is one case when we don't: If the URL went through our redirector and the admin configured 'redir_rewrites_host' to be off.
If-Modified-Since:
append unless we added our own, but only if cache_miss_revalidate is enabled, or the request is not cacheable, or the request contains authentication credentials.
Note
at most one client's If-Modified-Since header can pass through
If-None-Match:
append if the wildcard '*' special case value is present, or cache_miss_revalidate is disabled, or the request is not cacheable in this proxy, or the request contains authentication credentials.
Note
this header lists a set of responses for the server to elide sending. Squid added values are extending that set.
Max-Forwards:
pass only on TRACE or OPTIONS requests
Via:
If Via is disabled then forward any received header as-is. Otherwise leave for explicit updated addition later.
Range:, If-Range:, Request-Range:
Only pass if we accept ranges
X-Forwarded-For:, Cache-Control:
handled specially by Squid, so leave off for now. append these after the loop if needed
Front-End-Https:
Pass thru only if peer is configured with front-end-https
default.
pass on all other header fields which are NOT listed by the special Connection: header.

Definition at line 2086 of file http.cc.

References HttpHeader::addEntry(), RequestFlags::auth, AnyP::Uri::authority(), Http::AUTHORIZATION, SBuf::c_str(), RequestFlags::cachable, Http::CACHE_CONTROL, SquidConfig::cache_miss_revalidate, Http::StateFlags::chunked_request, HttpHeaderEntry::clone(), Config, Http::CONNECTION, Http::CONTENT_LENGTH, debugs, HttpRequest::flags, Http::FRONT_END_HTTPS, Http::StateFlags::front_end_https, HttpHeaderEntry::getInt64(), HttpHeader::has(), HttpHeader::hasListMember(), Http::HOST, HttpHeaderEntry::id, Http::IF_MATCH, Http::IF_MODIFIED_SINCE, Http::IF_NONE_MATCH, Http::IF_RANGE, Http::KEEP_ALIVE, Http::MAX_FORWARDS, HttpRequest::method, Http::METHOD_OPTIONS, Http::METHOD_TRACE, HttpHeaderEntry::name, SquidConfig::onoff, HttpRequest::peer_domain, HttpRequest::peer_login, Http::PROXY_AUTHENTICATE, Http::PROXY_AUTHORIZATION, Http::PROXY_CONNECTION, HttpHeader::putInt64(), HttpHeader::putStr(), Http::RANGE, SquidConfig::redir_rewrites_host, RequestFlags::redirected, Http::REQUEST_RANGE, String::size(), strListIsMember(), Http::TE, Http::StateFlags::toOrigin, Http::StateFlags::toOriginPeer(), Http::TRAILER, Http::TRANSFER_ENCODING, Http::UPGRADE, HttpRequest::url, HttpHeaderEntry::value, Http::VIA, SquidConfig::via, and Http::X_FORWARDED_FOR.

Referenced by HttpStateData::httpBuildRequestHeader().

◆ findPreviouslyCachedEntry()

◆ httpFixupAuthentication()

◆ httpMakeVaryMark()

◆ httpMaybeRemovePublic()

◆ httpStart()

void httpStart ( FwdState fwd)

◆ operator<<()

Variable Documentation

◆ crlf

const char* const crlf = "\r\n"
static

Definition at line 72 of file http.cc.

Referenced by HttpStateData::buildRequestPrefix().

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors