/*
- * $Id: DelayId.cc,v 1.10 2003/05/20 12:17:38 robertc Exp $
+ * $Id: DelayId.cc,v 1.11 2003/07/10 11:04:06 robertc Exp $
*
* DEBUG: section 77 Delay Pools
* AUTHOR: Robert Collins <robertc@squid-cache.org>
ch.my_addr = r->my_addr;
ch.my_port = r->my_port;
- if (http->conn)
- ch.conn(cbdataReference(http->conn));
+ if (http->getConn())
+ ch.conn(cbdataReference(http->getConn()));
ch.request = requestLink(r);
/*
- * $Id: client_side.cc,v 1.646 2003/07/06 21:50:55 hno Exp $
+ * $Id: client_side.cc,v 1.647 2003/07/10 11:04:06 robertc Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
ClientSocketContext::fd() const
{
assert (http);
- assert (http->conn);
- return http->conn->fd;
+ assert (http->getConn());
+ return http->getConn()->fd;
}
clientStreamNode *
{
assert (!connRegistered_);
assert (http);
- assert (http->conn);
+ assert (http->getConn());
connRegistered_ = true;
- http->conn->addContextToQueue(this);
+ http->getConn()->addContextToQueue(this);
}
void
ClientSocketContext::deRegisterWithConn()
{
assert (connRegistered_);
- removeFromConnectionList(http->conn);
+ removeFromConnectionList(http->getConn());
connRegistered_ = false;
}
ClientSocketContext::connIsFinished()
{
assert (http);
- assert (http->conn);
+ assert (http->getConn());
deRegisterWithConn();
/* we can't handle any more stream data - detach */
clientStreamDetach(getTail(), http);
al.http.content_type = memObject()->getReply()->content_type.buf();
}
- al.cache.caddr = conn ? conn->log_addr : no_addr;
+ al.cache.caddr = getConn() ? getConn()->log_addr : no_addr;
al.cache.size = out.size;
al.cache.code = logType;
al.cache.msec = tvSubMsec(start, current_time);
if (request)
clientPrepareLogWithRequestDetails(request, &al);
- if (conn && conn->rfc931[0])
- al.cache.rfc931 = conn->rfc931;
+ if (getConn() && getConn()->rfc931[0])
+ al.cache.rfc931 = getConn()->rfc931;
#if USE_SSL
- if (conn)
- al.cache.ssluser = sslGetUserEmail(fd_table[conn->fd].ssl);
+ if (getConn())
+ al.cache.ssluser = sslGetUserEmail(fd_table[getConn()->fd].ssl);
#endif
accessLogLog(&al, checklist);
updateCounters();
- if (conn)
- clientdbUpdate(conn->peer.sin_addr, logType, PROTO_HTTP, out.size);
+ if (getConn())
+ clientdbUpdate(getConn()->peer.sin_addr, logType, PROTO_HTTP, out.size);
}
delete checklist;
ClientSocketContext::Pointer context = getCurrentContext();
while (context.getRaw()) {
- if (context->http->conn != this)
+ if (context->http->getConn() != this)
return false;
context = context->next;
assert(node->node.next == NULL);
ClientSocketContext::Pointer context = dynamic_cast<ClientSocketContext *>(node->data.getRaw());
assert(context.getRaw() != NULL);
- assert(connIsUsable(http->conn));
- fd = http->conn->fd;
+ assert(connIsUsable(http->getConn()));
+ fd = http->getConn()->fd;
/* TODO: check offset is what we asked for */
- if (context != http->conn->getCurrentContext()) {
+ if (context != http->getConn()->getCurrentContext()) {
context->deferRecipientForLater(node, rep, recievedData);
return;
}
void
ClientSocketContext::keepaliveNextRequest()
{
- ConnStateData *conn = http->conn;
+ ConnStateData *conn = http->getConn();
debug(33, 3) ("ClientSocketContext::keepaliveNextRequest: FD %d\n", conn->fd);
connIsFinished();
ClientSocketContext *context;
StoreIOBuffer tempBuffer;
http = new ClientHttpRequest;
- http->conn = conn;
+ http->setConn(conn);
http->req_sz = conn->in.notYetUsed;
http->uri = xstrdup(uri);
setLogUri (http, uri);
int url_sz = strlen(url) + 32 + Config.appendDomainLen;
http->uri = (char *)xcalloc(url_sz, 1);
snprintf(http->uri, url_sz, "%s://%s:%d%s",
- http->conn->port->protocol,
- inet_ntoa(http->conn->me.sin_addr),
- ntohs(http->conn->me.sin_port), url);
+ http->getConn()->port->protocol,
+ inet_ntoa(http->getConn()->me.sin_addr),
+ ntohs(http->getConn()->me.sin_port), url);
debug(33, 5) ("ACCEL VPORT REWRITE: '%s'\n", http->uri);
} else if (vport > 0) {
/* Put the local socket IP address as the hostname, but static port */
int url_sz = strlen(url) + 32 + Config.appendDomainLen;
http->uri = (char *)xcalloc(url_sz, 1);
snprintf(http->uri, url_sz, "%s://%s:%d%s",
- http->conn->port->protocol,
- inet_ntoa(http->conn->me.sin_addr),
+ http->getConn()->port->protocol,
+ inet_ntoa(http->getConn()->me.sin_addr),
vport, url);
debug(33, 5) ("ACCEL VPORT REWRITE: '%s'\n", http->uri);
}
int url_sz = strlen(url) + 32 + Config.appendDomainLen;
http->uri = (char *)xcalloc(url_sz, 1);
snprintf(http->uri, url_sz, "%s://%s:%d%s",
- http->conn->port->protocol,
- inet_ntoa(http->conn->me.sin_addr),
- ntohs(http->conn->me.sin_port), url);
+ http->getConn()->port->protocol,
+ inet_ntoa(http->getConn()->me.sin_addr),
+ ntohs(http->getConn()->me.sin_port), url);
debug(33, 5) ("TRANSPARENT REWRITE: '%s'\n", http->uri);
}
}
http->http_ver = http_ver;
- http->conn = conn;
+ http->setConn(conn);
http->req_sz = prefix_sz;
if (conn->in.notYetUsed != conn->body.size_left) {
/* != 0 when no request body */
/* Partial request received. Abort client connection! */
- debug(33, 3) ("clientAfterReadingRequests: FD %d aborted, partial request\n",+ fd);
+ debug(33, 3) ("clientAfterReadingRequests: FD %d aborted, partial request\n", fd);
comm_close(fd);
return;
}
clientLifetimeTimeout(int fd, void *data)
{
clientHttpRequest *http = (clientHttpRequest *)data;
- ConnStateData *conn = http->conn;
+ ConnStateData *conn = http->getConn();
debug(33,
1) ("WARNING: Closing client %s connection due to lifetime timeout\n",
inet_ntoa(conn->peer.sin_addr));
}
ACLChecklist *
-clientAclChecklistCreate(const acl_access * acl, const clientHttpRequest * http)
+clientAclChecklistCreate(const acl_access * acl, clientHttpRequest * http)
{
ACLChecklist *ch;
- ConnStateData *conn = http->conn;
+ ConnStateData *conn = http->getConn();
ch = aclChecklistCreate(acl, http->request, conn ? conn->rfc931 : dash_str);
/*
/*
- * $Id: client_side_reply.cc,v 1.56 2003/07/06 21:50:56 hno Exp $
+ * $Id: client_side_reply.cc,v 1.57 2003/07/10 11:04:06 robertc Exp $
*
* DEBUG: section 88 Client-side Reply Routines
* AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c)
(long int) entry->lastmod);
http->storeEntry(entry);
assert(http->out.offset == 0);
- fwdStart(http->conn ? http->conn->fd : -1, http->storeEntry(), http->request);
+ fwdStart(http->getConn() ? http->getConn()->fd : -1, http->storeEntry(), http->request);
/* Register with storage manager to receive updates when data comes in. */
if (EBIT_TEST(entry->flags, ENTRY_ABORTED))
http->al.http.code = HTTP_FORBIDDEN;
err =
clientBuildError(ERR_ACCESS_DENIED, HTTP_FORBIDDEN, NULL,
- &http->conn->peer.sin_addr, http->request);
+ &http->getConn()->peer.sin_addr, http->request);
createStoreEntry(r->method, request_flags());
errorAppendEntry(http->storeEntry(), err);
triggerInitialStoreRead();
if (http->flags.internal)
r->protocol = PROTO_INTERNAL;
- fwdStart(http->conn ? http->conn->fd : -1, http->storeEntry(), r);
+ fwdStart(http->getConn() ? http->getConn()->fd : -1, http->storeEntry(), r);
}
}
RequestMethodStr[http->request->method], http->uri);
http->al.http.code = HTTP_GATEWAY_TIMEOUT;
err = clientBuildError(ERR_ONLY_IF_CACHED_MISS, HTTP_GATEWAY_TIMEOUT, NULL,
- &http->conn->peer.sin_addr, http->request);
+ &http->getConn()->peer.sin_addr, http->request);
removeClientStoreReference(&sc, http);
startError(err);
}
http->logType = LOG_TCP_DENIED;
ErrorState *err =
clientBuildError(ERR_ACCESS_DENIED, HTTP_FORBIDDEN, NULL,
- &http->conn->peer.sin_addr, http->request);
+ &http->getConn()->peer.sin_addr, http->request);
startError(err);
return;
}
debug(88, 1) ("WARNING: closing FD %d to prevent counter overflow\n",
fd);
debug(88, 1) ("\tclient %s\n",
- inet_ntoa(http->conn ? http->conn->peer.sin_addr : no_addr));
+ inet_ntoa(http->getConn() ? http->getConn()->peer.sin_addr : no_addr));
debug(88, 1) ("\treceived %d bytes\n", (int) http->out.size);
debug(88, 1) ("\tURI %s\n", http->log_uri);
return 1;
debug(88, 1) ("WARNING: closing FD %d to prevent counter overflow\n",
fd);
debug(88, 1) ("\tclient %s\n",
- inet_ntoa(http->conn ? http->conn->peer.sin_addr : no_addr));
+ inet_ntoa(http->getConn() ? http->getConn()->peer.sin_addr : no_addr));
debug(88, 1) ("\treceived %d bytes (offset %d)\n", (int) http->out.size,
(int) http->out.offset);
debug(88, 1) ("\tURI %s\n", http->log_uri);
if (http->isReplyBodyTooLarge(rep->content_length)) {
ErrorState *err =
clientBuildError(ERR_TOO_BIG, HTTP_FORBIDDEN, NULL,
- http->conn ? &http->conn->peer.sin_addr : &no_addr,
+ http->getConn() ? &http->getConn()->peer.sin_addr : &no_addr,
http->request);
removeClientStoreReference(&sc, http);
startError(err);
ErrorState *err;
err =
clientBuildError(ERR_ACCESS_DENIED, HTTP_FORBIDDEN, NULL,
- http->conn ? &http->conn->peer.sin_addr : &no_addr,
+ http->getConn() ? &http->getConn()->peer.sin_addr : &no_addr,
http->request);
removeClientStoreReference(&sc, http);
startError(err);
StoreEntry *entry = http->storeEntry();
- ConnStateData *conn = http->conn;
+ ConnStateData *conn = http->getConn();
int fd = conn ? conn->fd : -1;
/*
- * $Id: client_side_request.cc,v 1.25 2003/07/06 21:43:36 hno Exp $
+ * $Id: client_side_request.cc,v 1.26 2003/07/10 11:04:06 robertc Exp $
*
* DEBUG: section 85 Client-side Request Routines
* AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c)
request_t *request;
StoreIOBuffer tempBuffer;
http->http_ver = http_ver;
- http->conn = NULL;
+ http->setConn(NULL);
http->start = current_time;
/* this is only used to adjust the connection offset in client_side.c */
http->req_sz = 0;
RequestMethodStr[http->request->method], http->uri,
answer == ACCESS_ALLOWED ? "ALLOWED" : "DENIED",
AclMatchedName ? AclMatchedName : "NO ACL's");
- proxy_auth_msg = authenticateAuthUserRequestMessage((http->conn
- && http->conn->auth_user_request) ? http->conn->
+ proxy_auth_msg = authenticateAuthUserRequestMessage((http->getConn()
+ && http->getConn()->auth_user_request) ? http->getConn()->
auth_user_request : http->request->auth_user_request);
if (answer == ACCESS_ALLOWED) {
assert (repContext);
repContext->setReplyToError(page_id, status,
http->request->method, NULL,
- http->conn ? &http->conn->peer.sin_addr : &no_addr, http->request,
- NULL, http->conn
- && http->conn->auth_user_request ? http->conn->
+ http->getConn() ? &http->getConn()->peer.sin_addr : &no_addr, http->request,
+ NULL, http->getConn()
+ && http->getConn()->auth_user_request ? http->getConn()->
auth_user_request : http->request->auth_user_request);
node = (clientStreamNode *)http->client_stream.tail->data;
clientStreamRead(node, http, node->readBuffer);
#if USE_USERAGENT_LOG
if ((str = httpHeaderGetStr(req_hdr, HDR_USER_AGENT)))
- logUserAgent(fqdnFromAddr(http->conn ? http->conn->log_addr : no_addr), str);
+ logUserAgent(fqdnFromAddr(http->getConn() ? http->getConn()->log_addr : no_addr), str);
#endif
#if USE_REFERER_LOG
if ((str = httpHeaderGetStr(req_hdr, HDR_REFERER)))
- logReferer(fqdnFromAddr(http->conn ? http->conn->log_addr : no_addr), str, http->log_uri);
+ logReferer(fqdnFromAddr(http->getConn() ? http->getConn()->log_addr : no_addr), str, http->log_uri);
#endif
#if FORW_VIA_DB
#endif
/* FIXME PIPELINE: This is innacurate during pipelining */
- if (http->conn)
- fd_note(http->conn->fd, http->uri);
+ if (http->getConn())
+ fd_note(http->getConn()->fd, http->uri);
assert(http->uri);
/*
- * $Id: client_side_request.cci,v 1.1 2003/06/20 01:01:05 robertc Exp $
+ * $Id: client_side_request.cci,v 1.2 2003/07/10 11:04:06 robertc Exp $
*
* DEBUG: section 85 Client-side Request Routines
* AUTHOR: Robert Collins
return NULL;
}
+ConnStateData *
+ClientHttpRequest::getConn()
+{
+ return conn_;
+}
+
+ConnStateData const *
+ClientHttpRequest::getConn() const
+{
+ return conn_;
+}
+
+void
+ClientHttpRequest::setConn(ConnStateData *aConn)
+{
+ assert (!conn_ || !aConn);
+ conn_ = aConn;
+}
/*
- * $Id: client_side_request.h,v 1.12 2003/06/20 12:36:35 robertc Exp $
+ * $Id: client_side_request.h,v 1.13 2003/07/10 11:04:06 robertc Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
_SQUID_INLINE_ StoreEntry *storeEntry() const;
void storeEntry(StoreEntry *);
- ConnStateData *conn;
+ _SQUID_INLINE_ ConnStateData *getConn();
+ _SQUID_INLINE_ ConnStateData const *getConn() const;
+ _SQUID_INLINE_ void setConn(ConnStateData *);
request_t *request; /* Parsed URL ... */
char *uri;
char *log_uri;
CBDATA_CLASS(ClientHttpRequest);
ssize_t maxReplyBodySize_;
StoreEntry *entry_;
+ ConnStateData *conn_;
};
/* client http based routines */
SQUIDCEXTERN char *clientConstructTraceEcho(clientHttpRequest *);
-SQUIDCEXTERN ACLChecklist *clientAclChecklistCreate(const acl_access * acl, const clientHttpRequest * http);
+SQUIDCEXTERN ACLChecklist *clientAclChecklistCreate(const acl_access * acl,ClientHttpRequest * http);
SQUIDCEXTERN int clientHttpRequestStatus(int fd, clientHttpRequest const *http);
SQUIDCEXTERN void clientAccessCheck(ClientHttpRequest *);
/*
- * $Id: redirect.cc,v 1.98 2003/05/29 15:54:08 hno Exp $
+ * $Id: redirect.cc,v 1.99 2003/07/10 11:04:06 robertc Exp $
*
* DEBUG: section 61 Redirector
* AUTHOR: Duane Wessels
void
redirectStart(clientHttpRequest * http, RH * handler, void *data)
{
- ConnStateData *conn = http->conn;
+ ConnStateData *conn = http->getConn();
redirectStateData *r = NULL;
const char *fqdn;
char buf[8192];
if (Config.accessList.redirector) {
ACLChecklist ch;
- ch.src_addr = http->conn->peer.sin_addr;
- ch.my_addr = http->conn->me.sin_addr;
- ch.my_port = ntohs(http->conn->me.sin_port);
+ ch.src_addr = http->getConn()->peer.sin_addr;
+ ch.my_addr = http->getConn()->me.sin_addr;
+ ch.my_port = ntohs(http->getConn()->me.sin_port);
ch.request = requestLink(http->request);
if (!aclCheckFast(Config.accessList.redirector, &ch)) {
/*
- * $Id: stat.cc,v 1.376 2003/06/22 21:31:24 wessels Exp $
+ * $Id: stat.cc,v 1.377 2003/07/10 11:04:06 robertc Exp $
*
* DEBUG: section 18 Cache Manager Statistics
* AUTHOR: Harvest Derived
for (i = ClientActiveRequests.head; i; i = i->next) {
http = static_cast<clientHttpRequest *>(i->data);
assert(http);
- conn = http->conn;
+ conn = http->getConn();
storeAppendPrintf(s, "Connection: %p\n", conn);
if (conn) {
/*
- * $Id: tunnel.cc,v 1.141 2003/03/04 01:40:31 robertc Exp $
+ * $Id: tunnel.cc,v 1.142 2003/07/10 11:04:07 robertc Exp $
*
* DEBUG: section 26 Secure Sockets Layer Proxy
* AUTHOR: Duane Wessels
int sock;
ErrorState *err = NULL;
int answer;
- int fd = http->conn->fd;
+ int fd = http->getConn()->fd;
request_t *request = http->request;
char *url = http->uri;
/*