error.clear();
peer_login = nullptr; // not allocated/deallocated by this class
peer_domain = nullptr; // not allocated/deallocated by this class
- peer_host = nullptr;
vary_headers = SBuf();
myportname = null_string;
tag = null_string;
char *peer_login; /* Configured peer login:password */
- char *peer_host; /* Selected peer host*/
-
time_t lastmod; /* Used on refreshes */
/// The variant second-stage cache key. Generated from Vary header pattern for this request.
nullptr, // StoreEntry
al,
&hdr_out,
+ connection->getPeer(),
flags);
hdr_out.packInto(&mb);
hdr_out.clean();
stuff.S.method = sb.c_str();
stuff.S.uri = (char *) e->url();
stuff.S.version = vbuf;
- HttpStateData::httpBuildRequestHeader(req, e, nullptr, &hdr, flags);
+ HttpStateData::httpBuildRequestHeader(req, e, nullptr, &hdr, p, flags);
MemBuf mb;
mb.init();
hdr.packInto(&mb);
stuff.S.uri = uri.c_str();
stuff.S.version = vbuf;
if (reason != HTCP_CLR_INVALIDATION) {
- HttpStateData::httpBuildRequestHeader(req, e, nullptr, &hdr, flags);
+ HttpStateData::httpBuildRequestHeader(req, e, nullptr, &hdr, p, flags);
mb.init();
hdr.packInto(&mb);
hdr.clean();
* Fixup authentication request headers for special cases
*/
static void
-httpFixupAuthentication(HttpRequest * request, const HttpHeader * hdr_in, HttpHeader * hdr_out, const Http::StateFlags &flags)
+httpFixupAuthentication(HttpRequest * request, const HttpHeader * hdr_in, HttpHeader * hdr_out, const CachePeer * const peer, const Http::StateFlags &flags)
{
/* Nothing to do unless we are forwarding to a peer */
if (!flags.peering)
return;
+ // do nothing if our cache_peer was reconfigured away
+ if (!peer)
+ return;
+
// This request is going "through" rather than "to" our _peer.
if (flags.tunneling)
return;
if (request->flags.auth_no_keytab) {
negotiate_flags |= PEER_PROXY_NEGOTIATE_NOKEYTAB;
}
- Token = peer_proxy_negotiate_auth(PrincipalName, request->peer_host, negotiate_flags);
+ Token = peer_proxy_negotiate_auth(PrincipalName, peer->host, negotiate_flags);
if (Token) {
httpHeaderPutStrf(hdr_out, header, "Negotiate %s",Token);
}
StoreEntry * entry,
const AccessLogEntryPointer &al,
HttpHeader * hdr_out,
+ const CachePeer * const peer,
const Http::StateFlags &flags)
{
/* building buffer for complex strings */
}
/* Fixup (Proxy-)Authorization special cases. Plain relaying dealt with above */
- httpFixupAuthentication(request, hdr_in, hdr_out, flags);
+ httpFixupAuthentication(request, hdr_in, hdr_out, peer, flags);
/* append Cache-Control, add max-age if not there already */
{
{
HttpHeader hdr(hoRequest);
forwardUpgrade(hdr); // before httpBuildRequestHeader() for CONNECTION
- httpBuildRequestHeader(request.getRaw(), entry, fwd->al, &hdr, flags);
+ const auto peer = cbdataReferenceValid(_peer) ? _peer : nullptr;
+ httpBuildRequestHeader(request.getRaw(), entry, fwd->al, &hdr, peer, flags);
if (request->flags.pinned && request->flags.connectionAuth)
request->flags.authSent = true;
}
mb.init();
- request->peer_host=_peer?_peer->host:nullptr;
buildRequestPrefix(&mb);
debugs(11, 2, "HTTP Server " << serverConnection);
StoreEntry * entry,
const AccessLogEntryPointer &al,
HttpHeader * hdr_out,
+ const CachePeer *peer,
const Http::StateFlags &flags);
const Comm::ConnectionPointer & dataConnection() const override;
* peer_proxy_negotiate_auth gets a GSSAPI token for principal_name
* and base64 encodes it.
*/
-char *peer_proxy_negotiate_auth(char *principal_name, char *proxy, int flags) {
+char *peer_proxy_negotiate_auth(char *principal_name, const char * const proxy, int flags) {
int rc = 0;
OM_uint32 major_status, minor_status;
gss_ctx_id_t gss_context = GSS_C_NO_CONTEXT;
#if HAVE_AUTH_MODULE_NEGOTIATE && HAVE_KRB5 && HAVE_GSSAPI
/* upstream proxy authentication */
-char *peer_proxy_negotiate_auth(char *principal_name, char *proxy, int flags);
+char *peer_proxy_negotiate_auth(char *principal_name, const char *proxy, int flags);
#endif
#endif /* SQUID_SRC_PEER_PROXY_NEGOTIATE_AUTH_H */
netdbPingSite(request->url.host());
- request->peer_host = conn->getPeer() ? conn->getPeer()->host : nullptr;
-
bool toOrigin = false; // same semantics as StateFlags::toOrigin
if (const auto * const peer = conn->getPeer()) {
request->prepForPeering(*peer);
tunnelState->server.setDelayId(DelayId::DelayClient(context->http));
#endif
- request->peer_host = srvConn->getPeer() ? srvConn->getPeer()->host : nullptr;
-
debugs(26, 4, "determine post-connect handling pathway.");
if (const auto peer = srvConn->getPeer())
request->prepForPeering(*peer);