From f900607e6e86edc4a1fd354c339fe529f0830d68 Mon Sep 17 00:00:00 2001 From: wessels <> Date: Tue, 27 Aug 1996 01:16:05 +0000 Subject: [PATCH] added ipcacheInvalidate() and -i option --- src/ftp.cc | 6 +++++- src/gopher.cc | 4 +++- src/http.cc | 6 +++++- src/ipcache.cc | 14 +++++++++++++- src/ssl.cc | 6 +++++- src/tunnel.cc | 6 +++++- src/wais.cc | 7 ++++++- 7 files changed, 42 insertions(+), 7 deletions(-) diff --git a/src/ftp.cc b/src/ftp.cc index 09f259faf2..4f23b075d0 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -1,6 +1,6 @@ /* - * $Id: ftp.cc,v 1.49 1996/07/26 17:18:21 wessels Exp $ + * $Id: ftp.cc,v 1.50 1996/08/26 19:16:05 wessels Exp $ * * DEBUG: section 9 File Transfer Protocol (FTP) * AUTHOR: Harvest Derived @@ -565,6 +565,8 @@ void ftpConnInProgress(fd, data) COMM_SELECT_WRITE, (PF) ftpSendRequest, (void *) data); + if (opt_no_ipcache) + ipcacheInvalidate(data->request->host); } @@ -670,6 +672,8 @@ int ftpStart(unusedfd, url, request, entry) COMM_SELECT_LIFETIME, (PF) ftpLifetimeExpire, (void *) data); + if (opt_no_ipcache) + ipcacheInvalidate(data->request->host); return COMM_OK; } diff --git a/src/gopher.cc b/src/gopher.cc index 92e10348cd..1ceb783395 100644 --- a/src/gopher.cc +++ b/src/gopher.cc @@ -1,5 +1,5 @@ /* - * $Id: gopher.cc,v 1.38 1996/07/26 17:18:23 wessels Exp $ + * $Id: gopher.cc,v 1.39 1996/08/26 19:16:05 wessels Exp $ * * DEBUG: section 10 Gopher * AUTHOR: Harvest Derived @@ -1000,6 +1000,8 @@ int gopherStart(unusedfd, url, entry) } } /* Install connection complete handler. */ + if (opt_no_ipcache) + ipcacheInvalidate(data->host); comm_set_select_handler(sock, COMM_SELECT_LIFETIME, (PF) gopherLifetimeExpire, diff --git a/src/http.cc b/src/http.cc index f584d37c5b..37fd6ddf70 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,5 +1,5 @@ /* - * $Id: http.cc,v 1.67 1996/07/26 17:18:23 wessels Exp $ + * $Id: http.cc,v 1.68 1996/08/26 19:16:06 wessels Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -656,6 +656,8 @@ static void httpConnInProgress(fd, httpState) } } /* Call the real write handler, now that we're fully connected */ + if (opt_no_ipcache) + ipcacheInvalidate(entry->mem_obj->request->host); comm_set_select_handler(fd, COMM_SELECT_WRITE, (PF) httpSendRequest, (void *) httpState); } @@ -746,6 +748,8 @@ static int httpConnect(fd, hp, data) } } /* Install connection complete handler. */ + if (opt_no_ipcache) + ipcacheInvalidate(request->host); fd_note(fd, entry->url); comm_set_select_handler(fd, COMM_SELECT_LIFETIME, (PF) httpLifetimeExpire, (void *) httpState); diff --git a/src/ipcache.cc b/src/ipcache.cc index 2b8738d044..4180853976 100644 --- a/src/ipcache.cc +++ b/src/ipcache.cc @@ -1,5 +1,5 @@ /* - * $Id: ipcache.cc,v 1.40 1996/08/21 05:50:08 wessels Exp $ + * $Id: ipcache.cc,v 1.41 1996/08/26 19:16:07 wessels Exp $ * * DEBUG: section 14 IP Cache * AUTHOR: Harvest Derived @@ -1109,3 +1109,15 @@ void ipcacheReleaseInvalid(name) return; ipcache_release(i); } + +void ipcacheInvalidate(name) + char *name; +{ + ipcache_entry *i; + if ((i = ipcache_get(name)) == NULL) + return; + if (i->status != IP_CACHED) + i->ttl = 0; + else + ipcache_release(i); +} diff --git a/src/ssl.cc b/src/ssl.cc index fa9c6b058d..803ef5f528 100644 --- a/src/ssl.cc +++ b/src/ssl.cc @@ -1,6 +1,6 @@ /* - * $Id: ssl.cc,v 1.10 1996/07/26 19:28:51 wessels Exp $ + * $Id: ssl.cc,v 1.11 1996/08/26 19:16:08 wessels Exp $ * * DEBUG: section 26 Secure Sockets Layer Proxy * AUTHOR: Duane Wessels @@ -346,6 +346,8 @@ static void sslConnInProgress(fd, sslState) return; } } + if (opt_no_ipcache) + ipcacheInvalidate(sslState->host); /* We are now fully connected */ if (Config.sslProxy.host) sslProxyConnected(fd, sslState); @@ -421,6 +423,8 @@ static int sslConnect(fd, hp, sslState) (void *) sslState); return COMM_OK; } + if (opt_no_ipcache) + ipcacheInvalidate(sslState->host); } if (Config.sslProxy.host) sslProxyConnected(sslState->server.fd, sslState); diff --git a/src/tunnel.cc b/src/tunnel.cc index 8a6c6ad357..d5e64d6c2f 100644 --- a/src/tunnel.cc +++ b/src/tunnel.cc @@ -1,6 +1,6 @@ /* - * $Id: tunnel.cc,v 1.10 1996/07/26 19:28:51 wessels Exp $ + * $Id: tunnel.cc,v 1.11 1996/08/26 19:16:08 wessels Exp $ * * DEBUG: section 26 Secure Sockets Layer Proxy * AUTHOR: Duane Wessels @@ -346,6 +346,8 @@ static void sslConnInProgress(fd, sslState) return; } } + if (opt_no_ipcache) + ipcacheInvalidate(sslState->host); /* We are now fully connected */ if (Config.sslProxy.host) sslProxyConnected(fd, sslState); @@ -421,6 +423,8 @@ static int sslConnect(fd, hp, sslState) (void *) sslState); return COMM_OK; } + if (opt_no_ipcache) + ipcacheInvalidate(sslState->host); } if (Config.sslProxy.host) sslProxyConnected(sslState->server.fd, sslState); diff --git a/src/wais.cc b/src/wais.cc index 7f9de55c4d..eb3b5e3c90 100644 --- a/src/wais.cc +++ b/src/wais.cc @@ -1,5 +1,6 @@ + /* - * $Id: wais.cc,v 1.35 1996/07/25 07:10:45 wessels Exp $ + * $Id: wais.cc,v 1.36 1996/08/26 19:16:08 wessels Exp $ * * DEBUG: section 24 WAIS Relay * AUTHOR: Harvest Derived @@ -360,6 +361,8 @@ static void waisConnInProgress(fd, waisState) } } /* Call the real write handler, now that we're fully connected */ + if (opt_no_ipcache) + ipcacheInvalidate(waisState->relayhost); comm_set_select_handler(fd, COMM_SELECT_WRITE, (PF) waisSendRequest, (void *) waisState); } @@ -440,6 +443,8 @@ static int waisConnect(fd, hp, waisState) } } /* Install connection complete handler. */ + if (opt_no_ipcache) + ipcacheInvalidate(host); comm_set_select_handler(fd, COMM_SELECT_LIFETIME, (PF) waisLifetimeExpire, -- 2.47.3