/*
- * $Id: asn.cc,v 1.39 1998/06/04 18:57:07 wessels Exp $
+ * $Id: asn.cc,v 1.40 1998/07/14 06:12:58 wessels Exp $
*
* DEBUG: section 53 AS Number handling
* AUTHOR: Duane Wessels, Kostas Anagnostakis
if ((e = storeGet(k)) == NULL) {
e = storeCreateEntry(asres, asres, 0, METHOD_GET);
storeClientListAdd(e, asState);
- fwdStart(-1, e, asState->request);
+ fwdStart(-1, e, asState->request, any_addr);
} else {
storeLockObject(e);
storeClientListAdd(e, asState);
/*
- * $Id: client_side.cc,v 1.344 1998/07/09 19:21:00 rousskov Exp $
+ * $Id: client_side.cc,v 1.345 1998/07/14 06:12:58 wessels Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
entry->refcount++; /* EXPIRED CASE */
http->entry = entry;
http->out.offset = 0;
- fwdStart(http->conn->fd, http->entry, http->request);
+ fwdStart(http->conn->fd, http->entry, http->request,
+ http->conn->peer.sin_addr);
/* Register with storage manager to receive updates when data comes in. */
if (entry->store_status == STORE_ABORTED)
debug(33, 0) ("clientProcessExpired: entry->swap_status == STORE_ABORTED\n");
errorAppendEntry(http->entry, err);
return;
}
- /*
- * Check if this host is allowed to fetch MISSES from us (miss_access)
- */
- memset(&ch, '\0', sizeof(aclCheck_t));
- ch.src_addr = http->conn->peer.sin_addr;
- ch.request = r;
- answer = aclCheckFast(Config.accessList.miss, &ch);
- if (answer == 0) {
- http->al.http.code = HTTP_FORBIDDEN;
- err = errorCon(ERR_FORWARDING_DENIED, HTTP_FORBIDDEN);
- err->request = requestLink(r);
- err->src_addr = http->conn->peer.sin_addr;
- http->entry = clientCreateStoreEntry(http, r->method, 0);
- errorAppendEntry(http->entry, err);
- return;
- }
assert(http->out.offset == 0);
http->entry = clientCreateStoreEntry(http, r->method, r->flags);
http->entry->refcount++;
if (http->flags.internal)
r->protocol = PROTO_INTERNAL;
- fwdStart(http->conn->fd, http->entry, r);
+ fwdStart(http->conn->fd, http->entry, r, http->conn->peer.sin_addr);
}
static clientHttpRequest *
/*
- * $Id: forward.cc,v 1.16 1998/07/13 21:37:15 wessels Exp $
+ * $Id: forward.cc,v 1.17 1998/07/14 06:12:59 wessels Exp $
*
* DEBUG: section 17 Request Forwarding
* AUTHOR: Duane Wessels
/* PUBLIC FUNCTIONS */
void
-fwdStart(int fd, StoreEntry * entry, request_t * request)
+fwdStart(int fd, StoreEntry * e, request_t * r, struct in_addr peer_addr)
{
FwdState *fwdState;
- debug(17, 3) ("fwdStart: '%s'\n", storeUrl(entry));
- entry->mem_obj->request = requestLink(request);
- entry->mem_obj->fd = fd;
- switch (request->protocol) {
+ aclCheck_t ch;
+ int answer;
+ ErrorState *err;
+ /*
+ * Check if this host is allowed to fetch MISSES from us (miss_access)
+ */
+ memset(&ch, '\0', sizeof(aclCheck_t));
+ ch.src_addr = peer_addr;
+ ch.request = r;
+ answer = aclCheckFast(Config.accessList.miss, &ch);
+ if (answer == 0) {
+ err = errorCon(ERR_FORWARDING_DENIED, HTTP_FORBIDDEN);
+ err->request = requestLink(r);
+ err->src_addr = peer_addr;
+ errorAppendEntry(e, err);
+ return;
+ }
+ debug(17, 3) ("fwdStart: '%s'\n", storeUrl(e));
+ e->mem_obj->request = requestLink(r);
+ e->mem_obj->fd = fd;
+ switch (r->protocol) {
/*
* Note, don't create fwdState for these requests
*/
case PROTO_INTERNAL:
- internalStart(request, entry);
+ internalStart(r, e);
return;
case PROTO_CACHEOBJ:
- cachemgrStart(fd, request, entry);
+ cachemgrStart(fd, r, e);
return;
default:
break;
}
fwdState = memAllocate(MEM_FWD_STATE);
cbdataAdd(fwdState, MEM_FWD_STATE);
- fwdState->entry = entry;
+ fwdState->entry = e;
fwdState->client_fd = fd;
fwdState->server_fd = -1;
- fwdState->request = requestLink(request);
+ fwdState->request = requestLink(r);
fwdState->start = squid_curtime;
- storeLockObject(entry);
- storeRegisterAbort(entry, fwdAbort, fwdState);
- peerSelect(request,
- entry,
- fwdStartComplete,
- fwdStartFail,
- fwdState);
+ storeLockObject(e);
+ storeRegisterAbort(e, fwdAbort, fwdState);
+ peerSelect(r, e, fwdStartComplete, fwdStartFail, fwdState);
}
/* This is called before reading data from the server side to
/*
- * $Id: net_db.cc,v 1.115 1998/06/04 19:50:48 wessels Exp $
+ * $Id: net_db.cc,v 1.116 1998/07/14 06:13:00 wessels Exp $
*
* DEBUG: section 37 Network Measurement Database
* AUTHOR: Duane Wessels
storeClientCopy(ex->e, ex->seen, ex->used, ex->buf_sz,
ex->buf, netdbExchangeHandleReply, ex);
EBIT_SET(ex->r->flags, REQ_LOOPDETECT); /* cheat! -- force direct */
- fwdStart(-1, ex->e, ex->r);
+ fwdStart(-1, ex->e, ex->r, any_addr);
#endif
}
/*
- * $Id: peer_digest.cc,v 1.39 1998/06/30 15:08:10 rousskov Exp $
+ * $Id: peer_digest.cc,v 1.40 1998/07/14 06:13:00 wessels Exp $
*
* DEBUG: section 72 Peer Digest Routines
* AUTHOR: Alex Rousskov
fetch->offset = 0;
debug(72, 3) ("peerDigestRequest: forwarding to fwdStart...\n");
/* push towards peer cache */
- fwdStart(-1, e, req);
+ fwdStart(-1, e, req, any_addr);
storeClientCopy(e, 0, 0, SM_PAGE_SIZE, memAllocate(MEM_4K_BUF),
peerDigestFetchReply, fetch);
}
extern EVH peerDigestInit;
/* forward.c */
-extern void fwdStart(int, StoreEntry *, request_t *);
+extern void fwdStart(int, StoreEntry *, request_t *, struct in_addr);
extern int fwdAbortFetch(StoreEntry * entry);
extern DEFER fwdCheckDeferRead;
extern void fwdFail(FwdState *, int, http_status, int);
/*
*
- * $Id: urn.cc,v 1.36 1998/06/05 21:25:52 rousskov Exp $
+ * $Id: urn.cc,v 1.37 1998/07/14 06:13:01 wessels Exp $
*
* DEBUG: section 52 URN Parsing
* AUTHOR: Kostas Anagnostakis
if ((urlres_e = storeGet(k)) == NULL) {
urlres_e = storeCreateEntry(urlres, urlres, 0, METHOD_GET);
storeClientListAdd(urlres_e, urnState);
- fwdStart(-1, urlres_e, urlres_r);
+ fwdStart(-1, urlres_e, urlres_r, any_addr);
} else {
storeLockObject(urlres_e);
storeClientListAdd(urlres_e, urnState);