/*
- * $Id: acl.cc,v 1.110 1997/10/25 17:22:33 wessels Exp $
+ * $Id: acl.cc,v 1.111 1997/10/26 02:35:27 wessels Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
static int aclFromFile = 0;
static FILE *aclFile;
-static void aclDestroyAclList(struct _acl_list * list);
-static void aclDestroyTimeList(struct _acl_time_data * data);
+static void aclDestroyAclList(struct _acl_list *list);
+static void aclDestroyTimeList(struct _acl_time_data *data);
static int aclMatchAclList(const struct _acl_list *, aclCheck_t *);
static int aclMatchInteger(intlist * data, int i);
-static int aclMatchTime(struct _acl_time_data * data, time_t when);
+static int aclMatchTime(struct _acl_time_data *data, time_t when);
static int aclMatchIdent(wordlist * data, const char *ident);
static int aclMatchIp(void *dataptr, struct in_addr c);
static int aclMatchDomainList(void *dataptr, const char *);
static IPH aclLookupDstIPDone;
static FQDNH aclLookupSrcFQDNDone;
static FQDNH aclLookupDstFQDNDone;
-static int aclReadProxyAuth(struct _acl_proxy_auth * p);
+static int aclReadProxyAuth(struct _acl_proxy_auth *p);
#if defined(USE_SPLAY_TREE)
static int aclIpNetworkCompare(const void *, splayNode *);
static void aclDestroyTree(tree **);
#else /* LINKED LIST */
-static void aclDestroyIpList(struct _acl_ip_data * data);
+static void aclDestroyIpList(struct _acl_ip_data *data);
#endif /* USE_SPLAY_TREE */
/*
- * $Id: cf_gen.cc,v 1.12 1997/10/24 04:56:35 wessels Exp $
+ * $Id: cf_gen.cc,v 1.13 1997/10/26 02:35:28 wessels Exp $
*
* DEBUG: section 1 Startup and Main Loop
* AUTHOR: Max Okumoto
Line *line;
if (strcmp(entry->name, "arbtext"))
- fprintf(fp, "# TAG: %s", entry->name);
+ fprintf(fp, "# TAG: %s", entry->name);
if (entry->comment)
fprintf(fp, "\t%s", entry->comment);
fprintf(fp, "\n");
+
/*
- * $Id: client.cc,v 1.36 1997/10/25 17:58:08 wessels Exp $
+ * $Id: client.cc,v 1.37 1997/10/26 02:35:28 wessels Exp $
*
* DEBUG: section 0 WWW Client
* AUTHOR: Harvest Derived
/*
- * $Id: client_side.cc,v 1.133 1997/10/25 17:22:36 wessels Exp $
+ * $Id: client_side.cc,v 1.134 1997/10/26 02:35:29 wessels Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
}
int
-checkNegativeHit(StoreEntry *e)
+checkNegativeHit(StoreEntry * e)
{
- if (!BIT_TEST(e->flag, ENTRY_NEGCACHED))
- return 0;
- if (e->expires <= squid_curtime)
- return 0;
- if (e->store_status != STORE_OK)
- return 0;
- return 1;
+ if (!BIT_TEST(e->flag, ENTRY_NEGCACHED))
+ return 0;
+ if (e->expires <= squid_curtime)
+ return 0;
+ if (e->store_status != STORE_OK)
+ return 0;
+ return 1;
}
/*
- * $Id: errorpage.cc,v 1.86 1997/10/25 17:22:40 wessels Exp $
+ * $Id: errorpage.cc,v 1.87 1997/10/26 02:35:30 wessels Exp $
*
* DEBUG: section 4 Error Generation
* AUTHOR: Duane Wessels
{
ErrorState *err = data;
debug(4, 3) ("errorSendComplete: FD %d, size=%d\n", fd, size);
- if (err->callback)
- err->callback(fd, err->callback_data, size);
- else
- comm_close(fd);
+ if (errflag != COMM_ERR_CLOSING) {
+ if (err->callback)
+ err->callback(fd, err->callback_data, size);
+ else
+ comm_close(fd);
+ }
cbdataUnlock(err);
errorStateFree(err);
}
/*
- * $Id: ftp.cc,v 1.151 1997/10/26 02:33:16 wessels Exp $
+ * $Id: ftp.cc,v 1.152 1997/10/26 02:35:30 wessels Exp $
*
* DEBUG: section 9 File Transfer Protocol (FTP)
* AUTHOR: Harvest Derived
char *link;
} ftpListParts;
-typedef void (FTPSM)(FtpStateData *);
+typedef void (FTPSM) (FtpStateData *);
/* Local functions */
static CNCB ftpConnectDone;
/*
- * $Id: gopher.cc,v 1.104 1997/10/25 17:22:43 wessels Exp $
+ * $Id: gopher.cc,v 1.105 1997/10/26 02:35:31 wessels Exp $
*
* DEBUG: section 10 Gopher
* AUTHOR: Harvest Derived
ErrorState *err;
debug(10, 4) ("gopherTimeout: FD %d: '%s'\n", fd, entry->url);
- /* was assert */
if (entry->mem_obj->inmem_hi == 0) {
err = xcalloc(1, sizeof(ErrorState));
err->type = ERR_READ_TIMEOUT;
comm_close(fd);
}
} else if (len == 0 && entry->mem_obj->inmem_hi == 0) {
- /* was assert */
ErrorState *err;
err = xcalloc(1, sizeof(ErrorState));
err->type = ERR_ZERO_SIZE_OBJECT;
debug(10, 5) ("gopherSendComplete: FD %d size: %d errflag: %d\n",
fd, size, errflag);
if (errflag) {
- /* was assert */
ErrorState *err;
err = xcalloc(1, sizeof(ErrorState));
err->type = ERR_CONNECT_FAIL;
/* Parse url. */
if (gopher_url_parser(url, gopherState->host, &gopherState->port,
&gopherState->type_id, gopherState->request)) {
- /* was assert */
ErrorState *err;
err = xcalloc(1, sizeof(ErrorState));
err->type = ERR_INVALID_URL;
url);
if (fd == COMM_ERROR) {
debug(10, 4) ("gopherStart: Failed because we're out of sockets.\n");
- /* was assert */
err = xcalloc(1, sizeof(ErrorState));
err->type = ERR_SOCKET_FAILURE;
err->xerrno = errno;
ErrorState *err;
if (status == COMM_ERR_DNS) {
debug(10, 4) ("gopherConnectDone: Unknown host: %s\n", gopherState->host);
- /* was assert */
err = xcalloc(1, sizeof(ErrorState));
err->type = ERR_DNS_FAIL;
err->dnsserver_msg = xstrdup(dns_error_message);
storeAbort(gopherState->entry, 0);
comm_close(fd);
} else if (status != COMM_OK) {
- /* was assert */
ErrorState *err;
err = xcalloc(1, sizeof(ErrorState));
err->type = ERR_CONNECT_FAIL;
/*
- * $Id: http.cc,v 1.201 1997/10/25 17:22:44 wessels Exp $
+ * $Id: http.cc,v 1.202 1997/10/26 02:35:32 wessels Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
ErrorState *err;
debug(11, 5) ("httpSendComplete: FD %d: size %d: errflag %d.\n",
fd, size, errflag);
+ if (errflag == COMM_ERR_CLOSING)
+ return;
if (errflag) {
err = xcalloc(1, sizeof(ErrorState));
err->type = ERR_WRITE_ERROR;
/*
- * $Id: icmp.cc,v 1.45 1997/10/26 01:46:09 wessels Exp $
+ * $Id: icmp.cc,v 1.46 1997/10/26 02:35:33 wessels Exp $
*
* DEBUG: section 37 ICMP Routines
* AUTHOR: Duane Wessels
char *msg;
int len;
struct _icmpQueueData *next;
- void (*free_func)(void *);
+ void (*free_func) (void *);
} icmpQueueData;
static icmpQueueData *IcmpQueueHead = NULL;
static PF icmpRecv;
-static void icmpQueueSend (pingerEchoData * pkt, int len, FREE *free_func);
+static void icmpQueueSend(pingerEchoData * pkt, int len, FREE * free_func);
static PF icmpSend;
-static void icmpHandleSourcePing(const struct sockaddr_in * from, const char *buf);
+static void icmpHandleSourcePing(const struct sockaddr_in *from, const char *buf);
static void
icmpSendEcho(struct in_addr to, int opcode, const char *payload, int len)
}
static void
-icmpQueueSend(pingerEchoData * pkt, int len, FREE *free_func)
+icmpQueueSend(pingerEchoData * pkt, int len, FREE * free_func)
{
icmpQueueData *q = NULL;
icmpQueueData **H = NULL;
/*
- * $Id: main.cc,v 1.178 1997/10/25 17:22:49 wessels Exp $
+ * $Id: main.cc,v 1.179 1997/10/26 02:35:35 wessels Exp $
*
* DEBUG: section 1 Startup and Main Loop
* AUTHOR: Harvest Derived
#include "squid.h"
/* for error reporting from xmalloc and friends */
-extern void (*failure_notify)(const char *);
+extern void (*failure_notify) (const char *);
static int opt_send_signal = -1;
static volatile int rotate_pending = 0; /* set by SIGUSR1 handler */
/*
- * $Id: neighbors.cc,v 1.162 1997/10/25 17:22:50 wessels Exp $
+ * $Id: neighbors.cc,v 1.163 1997/10/26 02:35:36 wessels Exp $
*
* DEBUG: section 15 Neighbor Routines
* AUTHOR: Harvest Derived
static int peerHTTPOkay(const peer *, request_t *);
static int peerWouldBePinged(const peer *, request_t *);
static void neighborRemove(peer *);
-static peer *whichPeer(const struct sockaddr_in * from);
+static peer *whichPeer(const struct sockaddr_in *from);
static void neighborAlive(peer *, const MemObject *, const icp_common_t *);
static void neighborCountIgnored(peer *, icp_opcode op_unused);
static void peerRefreshDNS(void *);
/*
- * $Id: pconn.cc,v 1.6 1997/10/25 17:22:53 wessels Exp $
+ * $Id: pconn.cc,v 1.7 1997/10/26 02:35:36 wessels Exp $
*
* DEBUG: section 48 Persistent Connections
* AUTHOR: Duane Wessels
static const char *pconnKey(const char *host, u_short port);
static hash_table *table = NULL;
static struct _pconn *pconnNew(const char *key);
-static void pconnDelete(struct _pconn * p);
-static void pconnRemoveFD(struct _pconn * p, int fd);
+static void pconnDelete(struct _pconn *p);
+static void pconnRemoveFD(struct _pconn *p, int fd);
static const char *
extern void hierarchyNote(HierarchyLogEntry *, hier_code, icp_ping_data *, const char *);
extern aclCheck_t *aclChecklistCreate(const struct _acl_access *,
- request_t *,
- struct in_addr src,
- char *ua,
- char *id);
+ request_t *,
+ struct in_addr src,
+ char *ua,
+ char *id);
extern void aclNBCheck(aclCheck_t *, PF *, void *);
-extern int aclCheckFast(const struct _acl_access * A, aclCheck_t *);
+extern int aclCheckFast(const struct _acl_access *A, aclCheck_t *);
extern void aclChecklistFree(aclCheck_t *);
extern int aclMatchAcl(struct _acl *, aclCheck_t *);
-extern void aclDestroyAccessList(struct _acl_access ** list);
+extern void aclDestroyAccessList(struct _acl_access **list);
extern void aclDestroyAcls(acl **);
extern void aclParseAccessLine(struct _acl_access **);
extern void aclParseAclLine(acl **);
extern char *aclGetDenyInfoUrl(struct _acl_deny_info_list **, const char *name);
extern void aclParseDenyInfoLine(struct _acl_deny_info_list **);
extern void aclDestroyDenyInfoList(struct _acl_deny_info_list **);
-extern void aclDestroyRegexList(struct _relist * data);
+extern void aclDestroyRegexList(struct _relist *data);
extern int aclMatchRegex(relist * data, const char *word);
extern void aclParseRegexList(void *curlist);
extern int comm_udp_send(int fd, const char *host, u_short port, const char *buf, int len);
extern int comm_udp_sendto(int fd, const struct sockaddr_in *, int size, const char *buf, int len);
extern void comm_write(int fd,
- char *buf,
- int size,
- CWCB * handler,
- void *handler_data,
- FREE *);
+ char *buf,
+ int size,
+ CWCB * handler,
+ void *handler_data,
+ FREE *);
extern void commCallCloseHandlers(int fd);
extern int commSetTimeout(int fd, int, PF *, void *);
extern void commSetDefer(int fd, DEFER * func, void *);
extern int file_open(const char *path, int mode, FOCB *, void *callback_data);
extern void file_close(int fd);
extern int file_write(int fd,
- char *buf,
- int len,
- DWCB * handle,
- void *handle_data,
- FREE *);
+ char *buf,
+ int len,
+ DWCB * handle,
+ void *handle_data,
+ FREE *);
extern int file_read(int fd,
- char *buf,
- int req_len,
- int offset,
- DRCB * handler,
- void *client_data);
+ char *buf,
+ int req_len,
+ int offset,
+ DRCB * handler,
+ void *client_data);
extern int file_walk(int fd, FILE_WALK_HD *, void *, FILE_WALK_LHD *, void *);
extern int disk_init(void);
extern int diskWriteIsComplete(int);
extern void httpProcessReplyHeader(HttpStateData *, const char *, int);
extern void httpReplyHeaderStats(StoreEntry *);
extern size_t httpBuildRequestHeader(request_t * request,
- request_t * orig_request,
- StoreEntry * entry,
- size_t * in_len,
- char *hdr_out,
- size_t out_sz,
- int cfd,
- int flags);
+ request_t * orig_request,
+ StoreEntry * entry,
+ size_t * in_len,
+ char *hdr_out,
+ size_t out_sz,
+ int cfd,
+ int flags);
extern int httpAnonAllowed(const char *line);
extern int httpAnonDenied(const char *line);
extern char *httpReplyHeader(double ver,
- http_status status,
- char *ctype,
- int clen,
- time_t lmt,
- time_t expires);
+ http_status status,
+ char *ctype,
+ int clen,
+ time_t lmt,
+ time_t expires);
extern void icmpOpen(void);
extern void *icpCreateMessage(icp_opcode opcode,
- int flags,
- const char *url,
- int reqnum,
- int pad);
+ int flags,
+ const char *url,
+ int reqnum,
+ int pad);
extern void icpUdpSend(int fd,
- const struct sockaddr_in *,
- icp_common_t * msg,
- log_type,
- protocol_t);
+ const struct sockaddr_in *,
+ icp_common_t * msg,
+ log_type,
+ protocol_t);
extern PF icpHandleUdp;
extern PF httpAccept;
extern DEFER httpAcceptDefer;
extern PF snmpAccept;
#endif /* SQUID_SNMP */
extern void icpSendERROR(int fd,
- log_type errorCode,
- const char *text,
- clientHttpRequest *,
- int httpCode);
+ log_type errorCode,
+ const char *text,
+ clientHttpRequest *,
+ int httpCode);
extern void AppendUdp(icpUdpData *);
extern void icpParseRequestHeaders(clientHttpRequest *);
extern void icpProcessRequest(int, clientHttpRequest *);
extern void ipcache_nbgethostbyname(const char *name,
- IPH * handler,
- void *handlerData);
+ IPH * handler,
+ void *handlerData);
extern EVH ipcache_purgelru;
extern const ipcache_addrs *ipcache_gethostbyname(const char *, int flags);
extern void ipcacheInvalidate(const char *);
extern peer *getSingleParent(request_t *);
extern int neighborsCount(request_t *);
extern int neighborsUdpPing(request_t *,
- StoreEntry *,
- IRCB * callback,
- void *data,
- int *exprep);
+ StoreEntry *,
+ IRCB * callback,
+ void *data,
+ int *exprep);
extern void neighborAddAcl(const char *, const char *);
extern void neighborsUdpAck(int, const char *, icp_common_t *, const struct sockaddr_in *, StoreEntry *, char *, int);
extern void neighborAdd(const char *, const char *, int, int, int, int, int);
extern char *neighborTypeStr(const peer * e);
extern void peerCheckConnectStart(peer *);
-extern void netdbHandlePingReply(const struct sockaddr_in * from, int hops, int rtt);
+extern void netdbHandlePingReply(const struct sockaddr_in *from, int hops, int rtt);
extern void netdbPingSite(const char *hostname);
extern void netdbInit(void);
extern void netdbDump(StoreEntry *);
extern const char *storeGeneratePublicKey(const char *, method_t);
extern const char *storeGeneratePrivateKey(const char *, method_t, int);
extern void storeClientCopy(StoreEntry * e,
- off_t seen_offset,
- off_t copy_offset,
- size_t size,
- char *buf,
- STCB * callback,
- void *data);
+ off_t seen_offset,
+ off_t copy_offset,
+ size_t size,
+ char *buf,
+ STCB * callback,
+ void *data);
extern int storePendingNClients(const StoreEntry *);
extern int storeWriteCleanLogs(int reopen);
extern HASHCMP urlcmp;
extern int percent(int, int);
extern void squid_signal(int sig, SIGHDLR *, int flags);
extern pid_t readPidFile(void);
-extern struct in_addr inaddrFromHostent(const struct hostent * hp);
+extern struct in_addr inaddrFromHostent(const struct hostent *hp);
extern int intAverage(int, int, int, int);
extern double doubleAverage(double, double, int, int);
extern void debug_trap(const char *);
/*
- * $Id: store.cc,v 1.313 1997/10/25 17:23:01 wessels Exp $
+ * $Id: store.cc,v 1.314 1997/10/26 02:35:39 wessels Exp $
*
* DEBUG: section 20 Storeage Manager
* AUTHOR: Harvest Derived
struct storeCleanList *next;
} storeCleanList;
-typedef void (VCB)(void *);
+typedef void (VCB) (void *);
typedef struct valid_ctrl_t {
struct stat *sb;
static MemObject *new_MemObject(const char *);
static StoreEntry *new_StoreEntry(int, const char *);
static StoreEntry *storeAddDiskRestore(const char *,
- int,
- int,
- time_t,
- time_t,
- time_t,
- time_t,
- u_num32,
- u_num32,
- int);
+ int,
+ int,
+ time_t,
+ time_t,
+ time_t,
+ time_t,
+ u_num32,
+ u_num32,
+ int);
static unsigned int storeGetBucketNum(void);
static void destroy_MemObject(MemObject *);
static void destroy_MemObjectData(MemObject *);
static VCB storeCleanupComplete;
static void storeValidate(StoreEntry *, VCB *, void *);
static AIOCB storeValidateComplete;
-static void storeRebuiltFromDisk(struct storeRebuildState * data);
+static void storeRebuiltFromDisk(struct storeRebuildState *data);
static unsigned int getKeyCounter(void);
static void storePutUnusedFileno(int fileno);
static int storeGetUnusedFileno(void);
/*
- * $Id: tools.cc,v 1.126 1997/10/25 17:23:02 wessels Exp $
+ * $Id: tools.cc,v 1.127 1997/10/26 02:35:40 wessels Exp $
*
* DEBUG: section 21 Misc Functions
* AUTHOR: Harvest Derived
}
void
-squid_signal(int sig, SIGHDLR *func, int flags)
+squid_signal(int sig, SIGHDLR * func, int flags)
{
#if HAVE_SIGACTION
struct sigaction sa;
/*
- * $Id: wais.cc,v 1.89 1997/10/24 18:10:41 wessels Exp $
+ * $Id: wais.cc,v 1.90 1997/10/26 02:35:41 wessels Exp $
*
* DEBUG: section 24 WAIS Relay
* AUTHOR: Harvest Derived
ErrorState *err;
StoreEntry *entry = waisState->entry;
debug(24, 4) ("waisTimeout: FD %d: '%s'\n", fd, entry->url);
- /* was assert */
err = xcalloc(1, sizeof(ErrorState));
err->type = ERR_READ_TIMEOUT;
err->http_status = HTTP_GATEWAY_TIMEOUT;
ErrorState *err;
BIT_RESET(entry->flag, ENTRY_CACHABLE);
storeReleaseRequest(entry);
- /* was assert */
-
err = xcalloc(1, sizeof(ErrorState));
err->type = ERR_READ_ERROR;
err->http_status = HTTP_INTERNAL_SERVER_ERROR;
comm_close(fd);
}
} else if (len == 0 && entry->mem_obj->inmem_hi == 0) {
- /* was assert */
ErrorState *err;
err = xcalloc(1, sizeof(ErrorState));
err->type = ERR_ZERO_SIZE_OBJECT;
StoreEntry *entry = waisState->entry;
debug(24, 5) ("waisSendComplete: FD %d size: %d errflag: %d\n",
fd, size, errflag);
+ if (errflag == COMM_ERR_CLOSING)
+ return;
if (errflag) {
- /* was assert */
ErrorState *err;
err = xcalloc(1, sizeof(ErrorState));
err->type = ERR_CONNECT_FAIL;
err->http_status = HTTP_SERVICE_UNAVAILABLE;
err->request = urlParse(METHOD_CONNECT, waisState->request);
errorAppendEntry(entry, err);
-
storeAbort(entry, 0);
comm_close(fd);
} else {
if (!Config.Wais.relayHost) {
ErrorState *err;
debug(24, 0) ("waisStart: Failed because no relay host defined!\n");
- /* was assert */
err = xcalloc(1, sizeof(ErrorState));
err->type = ERR_NO_RELAY;
err->http_status = HTTP_INTERNAL_SERVER_ERROR;
if (fd == COMM_ERROR) {
ErrorState *err;
debug(24, 4) ("waisStart: Failed because we're out of sockets.\n");
- /* was assert */
err = xcalloc(1, sizeof(ErrorState));
err->type = ERR_SOCKET_FAILURE;
err->http_status = HTTP_INTERNAL_SERVER_ERROR;
ErrorState *err;
if (status == COMM_ERR_DNS) {
- /* was assert */
err = xcalloc(1, sizeof(ErrorState));
err->type = ERR_DNS_FAIL;
err->http_status = HTTP_SERVICE_UNAVAILABLE;
storeAbort(waisState->entry, 0);
comm_close(fd);
} else if (status != COMM_OK) {
- /* was assert */
err = xcalloc(1, sizeof(ErrorState));
err->type = ERR_CONNECT_FAIL;
err->http_status = HTTP_SERVICE_UNAVAILABLE;