nocache(0), ims(0), auth(0), cachable(0),
hierarchical(0), loopdetect(0), proxy_keepalive(0), proxying(0),
refresh(0), redirected(0), need_validation(0),
- fail_on_validation_err(0), stale_if_hit(0), nocache_hack(0), accelerated(0),
+ fail_on_validation_err(0), stale_if_hit(0), nocache_hack(false), accelerated_(false),
ignore_cc(false), intercepted_(false), hostVerified_(false), spoof_client_ip(false),
internal(false), internalclient(false), must_keepalive(false), connection_auth_wanted(false), connection_auth_disabled(false), connection_proxy_auth(false), pinned_(false),
canRePin_(false), authSent_(false), noDirect_(false), chunkedReply_(false),
unsigned int fail_on_validation_err :1; ///< whether we should fail if validation fails
unsigned int stale_if_hit :1; ///< reply is stale if it is a hit
/* for changing/ignoring no-cache requests. Unused unless USE_HTTP_VIOLATIONS */
- unsigned int nocache_hack :1;
- unsigned int accelerated :1;
// When adding new flags, please update cloneAdaptationImmune() as needed.
bool resetTCP() const;
bool ignoringCacheControl() const { return ignore_cc; }
void ignoreCacheControl() { ignore_cc=true; }
+
+ bool accelerated() const { return accelerated_; }
+ void markAccelerated() { accelerated_ = true; }
+
+ /* nocache_hack is only enabled if USE_HTTP_VIOLATIONS is set at build-time.
+ * Compilers will have an easy time optimizing to a NOP otherwise. */
+ void hackNocache() { if (USE_HTTP_VIOLATIONS) nocache_hack=true; }
+ bool noCacheHackEnabled() const { return USE_HTTP_VIOLATIONS && nocache_hack; }
private:
- bool ignore_cc :1;
+ bool nocache_hack :1;
+ bool accelerated_ :1; ///<request is accelerated
+ bool ignore_cc :1; ///< ignore Cache-Control
bool intercepted_ :1; ///< intercepted request
bool hostVerified_ :1; ///< whether the Host: header passed verification
- bool spoof_client_ip :1; /**< spoof client ip if possible */
+ bool spoof_client_ip :1; ///< spoof client ip if possible
bool internal :1;
bool internalclient :1;
bool must_keepalive :1;
return ACCESS_ALLOWED;
else
return ACCESS_DENIED;
- } else if (request->flags.accelerated) {
+ } else if (request->flags.accelerated()) {
/* WWW authorization on accelerated requests */
headertype = HDR_AUTHORIZATION;
} else if (request->flags.intercepted() || request->flags.spoofClientIp()) {
request->clientConnectionManager = conn;
- request->flags.accelerated = http->flags.accel;
+ if (http->flags.accel)
+ request->flags.markAccelerated();
request->flags.setSslBumped(conn->switchedToHttps());
if (request->flags.sslBumped() && conn->pinning.pinned)
request->flags.allowRepinning();
if (conn->port->ignore_cc)
request->flags.ignoreCacheControl();
// TODO: decouple http->flags.accel from request->flags.sslBumped
- if (request->flags.accelerated && !request->flags.sslBumped())
+ if (request->flags.accelerated() && !request->flags.sslBumped())
if (!conn->port->allow_direct)
request->flags.setNoDirect();
#if USE_AUTH
return;
}
- if (e->checkNegativeHit()
-#if USE_HTTP_VIOLATIONS
- && !r->flags.nocache_hack
-#endif
+ if (e->checkNegativeHit() && !r->flags.noCacheHackEnabled()
) {
http->logType = LOG_TCP_NEGATIVE_HIT;
sendMoreData(result);
continue;
}
request->flags.setMustKeepalive();
- if (!request->flags.accelerated && !request->flags.intercepted()) {
+ if (!request->flags.accelerated() && !request->flags.intercepted()) {
httpHeaderPutStrf(hdr, HDR_PROXY_SUPPORT, "Session-Based-Authentication");
/*
We send "[Proxy-]Connection: Proxy-Support" header to mark
}
-#if USE_HTTP_VIOLATIONS
-
- else if (r->flags.nocache_hack) {
-
+ else if (r->flags.noCacheHackEnabled()) {
#if USE_DNSHELPER
ipcacheInvalidate(r->GetHost());
#else
ipcacheInvalidateNegative(r->GetHost());
#endif /* USE_DNSHELPER */
-
}
-
-#endif /* USE_HTTP_VIOLATIONS */
#if USE_CACHE_DIGESTS
lookup_type = http->storeEntry() ? "HIT" : "MISS";
/*
* build new header list *? TODO
*/
- request->flags.accelerated = http->flags.accel;
+ if (http->flags.accel)
+ request->flags.markAccelerated();
request->flags.setInternalClient();
#if USE_HTTP_VIOLATIONS
if (Config.onoff.reload_into_ims)
- request->flags.nocache_hack = 1;
+ request->flags.hackNocache();
else if (refresh_nocache_hack)
- request->flags.nocache_hack = 1;
+ request->flags.hackNocache();
else
#endif
void
HttpStateData::processSurrogateControl(HttpReply *reply)
{
- if (request->flags.accelerated && reply->surrogate_control) {
+ if (request->flags.accelerated() && reply->surrogate_control) {
HttpHdrScTarget *sctusable = reply->surrogate_control->getMergedTarget(Config.Accel.surrogate_id);
if (sctusable) {
debugs(11, DBG_IMPORTANT, "WARNING: HTTP: Invalid Response: Headers did not parse at all for " << entry->url() << " AKA " << request->GetHost() << request->urlpath.termedBuf() );
} else {
error = ERR_ZERO_SIZE_OBJECT;
- debugs(11, (request->flags.accelerated?DBG_IMPORTANT:2), "WARNING: HTTP: Invalid Response: No object data received for " <<
+ debugs(11, (request->flags.accelerated()?DBG_IMPORTANT:2), "WARNING: HTTP: Invalid Response: No object data received for " <<
entry->url() << " AKA " << request->GetHost() << request->urlpath.termedBuf() );
}
}
strVia.clean();
}
- if (request->flags.accelerated) {
+ if (request->flags.accelerated()) {
/* Append Surrogate-Capabilities */
String strSurrogate(hdr_in->getList(HDR_SURROGATE_CAPABILITY));
#if USE_SQUID_ESI
#if USE_HTTP_VIOLATIONS
- if (!request->flags.nocache_hack) {
+ if (!request->flags.noCacheHackEnabled()) {
(void) 0;
} else if (R->flags.ignore_reload) {
/* The clients no-cache header is ignored */