}
void
-httpHdrAdd(HttpHeader *heads, HttpRequest *request, HeaderWithAclList &headersAdd)
+httpHdrAdd(HttpHeader *heads, HttpRequest *request, const AccessLogEntryPointer &al, HeaderWithAclList &headersAdd)
{
ACLFilledChecklist checklist(NULL, request, NULL);
const char *fieldValue = NULL;
MemBuf mb;
if (hwa->quoted) {
- if (request->al != NULL) {
+ if (al != NULL) {
mb.init();
- hwa->valueFormat->assemble(mb, request->al, 0);
+ hwa->valueFormat->assemble(mb, al, 0);
fieldValue = mb.content();
}
} else {
// main property is which connection the request was received on (if any)
clientConnectionManager = aReq->clientConnectionManager;
- al = aReq->al;
return true;
}
class HttpHdrRange;
class DnsLookupDetails;
-class AccessLogEntry;
-typedef RefCount<AccessLogEntry> AccessLogEntryPointer;
class HttpRequest: public HttpMsg
{
*/
CbcPointer<ConnStateData> clientConnectionManager;
- /**
- * The AccessLogEntry for the current ClientHttpRequest/Server HttpRequest
- * pair, if known;
- */
- AccessLogEntryPointer al;
-
int64_t getRangeOffsetLimit(); /* the result of this function gets cached in rangeOffsetLimit */
private:
}
request->clientConnectionManager = conn;
- request->al = http->al;
request->flags.accelerated = http->flags.accel;
request->flags.sslBumped = conn->switchedToHttps();
* this clientReplyContext does
*/
Comm::ConnectionPointer conn = http->getConn() != NULL ? http->getConn()->clientConnection : NULL;
- FwdState::fwdStart(conn, http->storeEntry(), http->request);
+ FwdState::Start(conn, http->storeEntry(), http->request, http->al);
/* Register with storage manager to receive updates when data comes in. */
/** Start forwarding to get the new object from network */
Comm::ConnectionPointer conn = http->getConn() != NULL ? http->getConn()->clientConnection : NULL;
- FwdState::fwdStart(conn, http->storeEntry(), r);
+ FwdState::Start(conn, http->storeEntry(), r, http->al);
}
}
#include "squid-old.h"
#include "forward.h"
+#include "AccessLogEntry.h"
#include "acl/FilledChecklist.h"
#include "acl/Gadgets.h"
#include "anyp/PortCfg.h"
/**** PUBLIC INTERFACE ********************************************************/
-FwdState::FwdState(const Comm::ConnectionPointer &client, StoreEntry * e, HttpRequest * r)
+FwdState::FwdState(const Comm::ConnectionPointer &client, StoreEntry * e, HttpRequest * r, const AccessLogEntryPointer &alp):
+ al(alp)
{
debugs(17, 2, HERE << "Forwarding client request " << client << ", url=" << e->url() );
entry = e;
* allocate a FwdState.
*/
void
-FwdState::fwdStart(const Comm::ConnectionPointer &clientConn, StoreEntry *entry, HttpRequest *request)
+FwdState::Start(const Comm::ConnectionPointer &clientConn, StoreEntry *entry, HttpRequest *request, const AccessLogEntryPointer &al)
{
/** \note
* client_addr == no_addr indicates this is an "internal" request
return;
default:
- FwdState::Pointer fwd = new FwdState(clientConn, entry, request);
+ FwdState::Pointer fwd = new FwdState(clientConn, entry, request, al);
fwd->start(fwd);
return;
}
/* NOTREACHED */
}
+void
+FwdState::fwdStart(const Comm::ConnectionPointer &clientConn, StoreEntry *entry, HttpRequest *request)
+{
+ // Hides AccessLogEntry.h from code that does not supply ALE anyway.
+ Start(clientConn, entry, request, NULL);
+}
+
void
FwdState::startConnectionOrFail()
{
/* forward decls */
+class AccessLogEntry;
+typedef RefCount<AccessLogEntry> AccessLogEntryPointer;
class ErrorState;
class HttpRequest;
~FwdState();
static void initModule();
+ /// Initiates request forwarding to a peer or origin server.
+ static void Start(const Comm::ConnectionPointer &client, StoreEntry *, HttpRequest *, const AccessLogEntryPointer &alp);
+ /// Same as Start() but no master xaction info (AccessLogEntry) available.
static void fwdStart(const Comm::ConnectionPointer &client, StoreEntry *, HttpRequest *);
/// This is the real beginning of server connection. Call it whenever
private:
// hidden for safer management of self; use static fwdStart
- FwdState(const Comm::ConnectionPointer &client, StoreEntry *, HttpRequest *);
+ FwdState(const Comm::ConnectionPointer &client, StoreEntry *, HttpRequest *, const AccessLogEntryPointer &alp);
void start(Pointer aSelf);
void selectPeerForIntercepted();
public:
StoreEntry *entry;
HttpRequest *request;
+ AccessLogEntryPointer al; ///< info for the future access.log entry
+
static void abort(void*);
private:
stuff.S.method = (char *) RequestMethodStr(req->method);
stuff.S.uri = (char *) e->url();
stuff.S.version = vbuf;
- HttpStateData::httpBuildRequestHeader(req, e, &hdr, flags);
+ HttpStateData::httpBuildRequestHeader(req, e, NULL, &hdr, flags);
mb.init();
packerToMemInit(&pa, &mb);
hdr.packInto(&pa);
}
stuff.S.version = vbuf;
if (reason != HTCP_CLR_INVALIDATION) {
- HttpStateData::httpBuildRequestHeader(req, e, &hdr, flags);
+ HttpStateData::httpBuildRequestHeader(req, e, NULL, &hdr, flags);
mb.init();
packerToMemInit(&pa, &mb);
hdr.packInto(&pa);
static void copyOneHeaderFromClientsideRequestToUpstreamRequest(const HttpHeaderEntry *e, const String strConnection, const HttpRequest * request,
HttpHeader * hdr_out, const int we_do_ranges, const http_state_flags);
//Declared in HttpHeaderTools.cc
-void httpHdrAdd(HttpHeader *heads, HttpRequest *request, HeaderWithAclList &headers_add);
+void httpHdrAdd(HttpHeader *heads, HttpRequest *request, const AccessLogEntryPointer &al, HeaderWithAclList &headers_add);
HttpStateData::HttpStateData(FwdState *theFwdState) : AsyncJob("HttpStateData"), ServerStateData(theFwdState),
lastChunk(0), header_bytes_read(0), reply_bytes_read(0),
void
HttpStateData::httpBuildRequestHeader(HttpRequest * request,
StoreEntry * entry,
+ const AccessLogEntryPointer &al,
HttpHeader * hdr_out,
const http_state_flags flags)
{
httpHdrMangleList(hdr_out, request, ROR_REQUEST);
if (Config.request_header_add && !Config.request_header_add->empty())
- httpHdrAdd(hdr_out, request, *Config.request_header_add);
+ httpHdrAdd(hdr_out, request, al, *Config.request_header_add);
strConnection.clean();
}
{
HttpHeader hdr(hoRequest);
Packer p;
- httpBuildRequestHeader(request, entry, &hdr, flags);
+ httpBuildRequestHeader(request, entry, fwd->al, &hdr, flags);
if (request->flags.pinned && request->flags.connection_auth)
request->flags.auth_sent = 1;
static void httpBuildRequestHeader(HttpRequest * request,
StoreEntry * entry,
+ const AccessLogEntryPointer &al,
HttpHeader * hdr_out,
const http_state_flags flags);
mb.Printf("CONNECT %s HTTP/1.1\r\n", tunnelState->url);
HttpStateData::httpBuildRequestHeader(tunnelState->request,
NULL, /* StoreEntry */
+ NULL, /* AccessLogEntry */
&hdr_out,
flags); /* flags */
packerToMemInit(&p, &mb);