#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"
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 StoreEntry * | findPreviouslyCachedEntry (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 | ) |
Function Documentation
◆ assembleVaryKey()
|
static |
Definition at line 552 of file http.cc.
References SBuf::append(), String::clean(), HttpHeader::getByName(), Http::Message::header, SBuf::isEmpty(), rfc1738_escape_part, strListGetItem(), String::termedBuf(), and SBuf::toLower().
Referenced by httpMakeVaryMark().
◆ copyOneHeaderFromClientsideRequestToUpstreamRequest()
|
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()
|
static |
Definition at line 158 of file http.cc.
References assert, RefCount< C >::getRaw(), StoreEntry::mem_obj, MemObject::method, MemObject::request, storeGetPublic(), storeGetPublicByRequest(), and MemObject::storeId().
Referenced by HttpStateData::haveParsedReplyHeaders(), and httpMaybeRemovePublic().
◆ httpFixupAuthentication()
|
static |
Definition at line 1724 of file http.cc.
References RequestFlags::auth_no_keytab, HttpRequest::auth_user_request, Http::AUTHORIZATION, base64_encode_final(), base64_encode_init(), base64_encode_len, base64_encode_update(), HttpRequest::extacl_passwd, HttpRequest::extacl_user, HttpRequest::flags, HttpHeader::getStr(), HttpHeader::has(), httpHeaderPutStrf(), MAX_LOGIN_SZ, HttpRequest::peer_host, HttpRequest::peer_login, PEER_PROXY_NEGOTIATE_NOKEYTAB, Http::StateFlags::peering, Http::PROXY_AUTHORIZATION, HttpHeader::putStr(), String::rawBuf(), String::size(), String::termedBuf(), Http::StateFlags::toOrigin, Http::StateFlags::tunneling, and Auth::UserRequest::username().
Referenced by HttpStateData::httpBuildRequestHeader().
◆ httpMakeVaryMark()
SBuf httpMakeVaryMark | ( | HttpRequest * | request, |
HttpReply const * | reply | ||
) |
Definition at line 588 of file http.cc.
References assembleVaryKey(), String::clean(), debugs, HttpHeader::getList(), Http::HDR_X_ACCELERATOR_VARY, Http::Message::header, and Http::VARY.
Referenced by StoreEntry::adjustVary(), HttpStateData::haveParsedReplyHeaders(), and varyEvaluateMatch().
◆ httpMaybeRemovePublic()
|
static |
Remove an existing public store entry if the incoming response (to be stored in a currently private entry) is going to invalidate it.
- Also remove any cached HEAD response in case the object has changed.
Definition at line 168 of file http.cc.
References assert, RequestFlags::cachable, EBIT_TEST, findPreviouslyCachedEntry(), HttpRequest::flags, StoreEntry::flags, RefCount< C >::getRaw(), HTCP_CLR_INVALIDATION, KEY_PRIVATE, StoreEntry::mem_obj, MemObject::method, Http::METHOD_HEAD, neighborsHtcpClear(), StoreEntry::release(), MemObject::request, Http::scForbidden, Http::scFound, Http::scGone, Http::scMethodNotAllowed, Http::scMovedPermanently, Http::scMultipleChoices, Http::scNonAuthoritativeInformation, Http::scNotFound, Http::scOkay, Http::scSeeOther, Http::scUnauthorized, storeGetPublic(), storeGetPublicByRequestMethod(), and MemObject::storeId().
Referenced by HttpStateData::haveParsedReplyHeaders().
◆ httpStart()
void httpStart | ( | FwdState * | fwd | ) |
Definition at line 2459 of file http.cc.
References debugs, FwdState::entry, HttpRequest::method, FwdState::request, AsyncJob::Start(), and StoreEntry::url().
Referenced by FwdState::dispatch().
◆ operator<<()
std::ostream & operator<< | ( | std::ostream & | os, |
const HttpStateData::ReuseDecision & | d | ||
) |
Definition at line 2633 of file http.cc.
References HttpStateData::ReuseDecision::answer, assert, HttpStateData::ReuseDecision::doNotCacheButShare, HttpStateData::ReuseDecision::entry, HttpStateData::ReuseDecision::reason, HttpStateData::ReuseDecision::reuseNot, and HttpStateData::ReuseDecision::statusCode.
Variable Documentation
◆ crlf
|
static |
Definition at line 72 of file http.cc.
Referenced by HttpStateData::buildRequestPrefix().