At 08:01 PM 4/29/97 +1000, Cefiar wrote:
>On Tue, 29 Apr 1997, Henny Bekker wrote:
>
>> It works wonderfull.. I've adapted the patch for Squid v1.1.10 and
>> it's running like a charm..
>
>Any chance of the updated patch making it either to the authors or the
>list? I'd much like this sort of thing myself!
>
I think (hope..) Duane will implement it in the next release of squid..
The changes I've made for Squid v1.1.10 are minimal (re-placed the patches
for comm.c)..
I'll attach the modified patched (original from Lincoln Dale <ltd@aone.com.au>
for squid v1.1.9) ...
> I see this as useful for giving different services to different ports, and
> then if for some reason I want to use a different proxy cache (god
> forbid!) I'd simply run it on the port I specified earlier, and tell squid
> not to listen to it anymore! (In particular, I'm thinking of this in place
> of the FTP proxy, by running a fully fledged FTP proxy that accepts ftp
> and http requests).
>
I'm using this patch to gain backward compatibility with an old Netscape
proxy-server which I used to run on port 8080.. For the other stuff I
use the Automatic Proxy Configuratioin facilitie of Netscape/MSI ...
Cheers, Henny
*** src/cache_cf.c.orig Wed Apr 23 21:38:36 1997
--- src/cache_cf.c Tue Apr 29 10:39:31 1997
***************
*** 858,864 ****
GetInteger(i);
if (i < 0)
i = 0;
! Config.Port.http = (u_short) i;
}
static void
--- 858,871 ----
GetInteger(i);
if (i < 0)
i = 0;
!
! if (Config.Port.number_http == MAXHTTPPORTS) {
! sprintf(fatal_str,"Limit of %d HTTP Ports reached. Redefine MAXHTTPPORTS for more.\n",
! MAXHTTPPORTS);
! fatal(fatal_str);
! }
!
! Config.Port.http[Config.Port.number_http++] = (u_short) i;
}
static void
***************
*** 1562,1569 ****
Config.effectiveGroup = safe_xstrdup(DefaultEffectiveGroup);
Config.appendDomain = safe_xstrdup(DefaultAppendDomain);
Config.errHtmlText = safe_xstrdup(DefaultErrHtmlText);
! Config.Port.http = DefaultHttpPortNum;
Config.Port.icp = DefaultIcpPortNum;
Config.Log.log_fqdn = DefaultLogLogFqdn;
Config.Log.log = safe_xstrdup(DefaultCacheLogFile);
Config.Log.access = safe_xstrdup(DefaultAccessLogFile);
--- 1569,1577 ----
Config.effectiveGroup = safe_xstrdup(DefaultEffectiveGroup);
Config.appendDomain = safe_xstrdup(DefaultAppendDomain);
Config.errHtmlText = safe_xstrdup(DefaultErrHtmlText);
! Config.Port.http[0] = DefaultHttpPortNum;
Config.Port.icp = DefaultIcpPortNum;
+ Config.Port.number_http = 0;
Config.Log.log_fqdn = DefaultLogLogFqdn;
Config.Log.log = safe_xstrdup(DefaultCacheLogFile);
Config.Log.access = safe_xstrdup(DefaultAccessLogFile);
***************
*** 1636,1642 ****
vhost_mode = 1;
sprintf(ThisCache, "%s:%d (Squid/%s)",
getMyHostname(),
! (int) Config.Port.http,
SQUID_VERSION);
if (!Config.udpMaxHitObjsz || Config.udpMaxHitObjsz > SQUID_UDP_SO_SNDBUF)
Config.udpMaxHitObjsz = SQUID_UDP_SO_SNDBUF;
--- 1644,1650 ----
vhost_mode = 1;
sprintf(ThisCache, "%s:%d (Squid/%s)",
getMyHostname(),
! (int) Config.Port.http[0],
SQUID_VERSION);
if (!Config.udpMaxHitObjsz || Config.udpMaxHitObjsz > SQUID_UDP_SO_SNDBUF)
Config.udpMaxHitObjsz = SQUID_UDP_SO_SNDBUF;
*** src/cache_cf.h.orig Fri Mar 28 21:28:12 1997
--- src/cache_cf.h Tue Apr 29 10:39:31 1997
***************
*** 109,114 ****
--- 109,116 ----
#define DefaultDnsChildrenMax 32 /* 32 processes */
#define DefaultRedirectChildrenMax 32 /* 32 processes */
+ #define MAXHTTPPORTS 12 /* can bind to up to 12 ports */
+
typedef struct _wordlist {
char *key;
struct _wordlist *next;
***************
*** 163,170 ****
int cleanRate;
int maxRequestSize;
struct {
! u_short http;
u_short icp;
} Port;
struct {
char *log;
--- 165,173 ----
int cleanRate;
int maxRequestSize;
struct {
! u_short http[MAXHTTPPORTS];
u_short icp;
+ u_short number_http;
} Port;
struct {
char *log;
*** src/client_db.c.orig Wed Mar 26 08:29:36 1997
--- src/client_db.c Tue Apr 29 10:39:31 1997
***************
*** 73,78 ****
--- 73,79 ----
void
clientdbUpdate(struct in_addr addr, log_type log_type, u_short port)
{
+ int j;
char *key;
ClientInfo *c;
if (!Config.Options.client_db)
***************
*** 83,92 ****
c = clientdbAdd(addr);
if (c == NULL)
debug_trap("clientdbUpdate: Failed to add entry");
! if (port == Config.Port.http) {
! c->Http.n_requests++;
! c->Http.result_hist[log_type]++;
! } else if (port == Config.Port.icp) {
c->Icp.n_requests++;
c->Icp.result_hist[log_type]++;
}
--- 84,97 ----
c = clientdbAdd(addr);
if (c == NULL)
debug_trap("clientdbUpdate: Failed to add entry");
!
! for (j=0;j < Config.Port.number_http; j++) {
! if (port == Config.Port.http[j]) {
! c->Http.n_requests++;
! c->Http.result_hist[log_type]++;
! }
! }
! if (port == Config.Port.icp) {
c->Icp.n_requests++;
c->Icp.result_hist[log_type]++;
}
*** src/main.c.orig Thu Apr 24 19:41:16 1997
--- src/main.c Tue Apr 29 10:39:31 1997
***************
*** 106,112 ****
#include "squid.h"
time_t squid_starttime = 0;
! int theHttpConnection = -1;
int theInIcpConnection = -1;
int theOutIcpConnection = -1;
int vizSock = -1;
--- 106,113 ----
#include "squid.h"
time_t squid_starttime = 0;
! int theHttpConnection[MAXHTTPPORTS];
!
int theInIcpConnection = -1;
int theOutIcpConnection = -1;
int vizSock = -1;
***************
*** 338,362 ****
u_short port;
int len;
int x;
! enter_suid();
! theHttpConnection = comm_open(SOCK_STREAM,
! 0,
! Config.Addrs.tcp_incoming,
! Config.Port.http,
! COMM_NONBLOCKING,
! "HTTP Port");
! leave_suid();
! if (theHttpConnection < 0) {
! fatal("Cannot open HTTP Port");
}
- fd_note(theHttpConnection, "HTTP socket");
- comm_listen(theHttpConnection);
- commSetSelect(theHttpConnection,
- COMM_SELECT_READ,
- asciiHandleConn,
- NULL, 0);
- debug(1, 1, "Accepting HTTP connections on FD %d.\n",
- theHttpConnection);
if (!httpd_accel_mode || Config.Accel.withProxy) {
if ((port = Config.Port.icp) > (u_short) 0) {
--- 339,370 ----
u_short port;
int len;
int x;
! int i;
! char fatal_str[BUFSIZ];
!
! for (i=0; i < Config.Port.number_http; i++) {
! enter_suid();
! theHttpConnection[i] = comm_open(SOCK_STREAM,
! 0,
! Config.Addrs.tcp_incoming,
! Config.Port.http[i],
! COMM_NONBLOCKING,
! "HTTP Port");
! leave_suid();
! if (theHttpConnection[i] < 0) {
! sprintf(fatal_str, "Cannot open HTTP Port #%d (port %d)",
! i, Config.Port.http[i]);
! fatal(fatal_str);
! }
! fd_note(theHttpConnection[i], "HTTP socket");
! comm_listen(theHttpConnection[i]);
! commSetSelect(theHttpConnection[i],
! COMM_SELECT_READ,
! asciiHandleConn,
! NULL, 0);
! debug(1, 1, "Accepting HTTP connections for port %d on FD %d.\n",
! Config.Port.http[i], theHttpConnection[i]);
}
if (!httpd_accel_mode || Config.Accel.withProxy) {
if ((port = Config.Port.icp) > (u_short) 0) {
***************
*** 468,482 ****
{
/* NOTE, this function will be called repeatedly while shutdown
* is pending */
! if (theHttpConnection >= 0) {
! debug(1, 1, "FD %d Closing HTTP connection\n",
! theHttpConnection);
! comm_close(theHttpConnection);
! commSetSelect(theHttpConnection,
! COMM_SELECT_READ,
! NULL,
! NULL, 0);
! theHttpConnection = -1;
}
if (theInIcpConnection >= 0) {
/* NOTE, don't close outgoing ICP connection, we need to write to
--- 476,495 ----
{
/* NOTE, this function will be called repeatedly while shutdown
* is pending */
!
! int i;
!
! for (i=0; i < Config.Port.number_http; i++) {
! if (theHttpConnection[i] >= 0) {
! debug(1, 1, "FD %d Closing HTTP connection %d (port %d)\n",
! theHttpConnection[i],i,Config.Port.http[i]);
! comm_close(theHttpConnection[i]);
! commSetSelect(theHttpConnection[i],
! COMM_SELECT_READ,
! NULL,
! NULL, 0);
! theHttpConnection[i]= -1;
! }
}
if (theInIcpConnection >= 0) {
/* NOTE, don't close outgoing ICP connection, we need to write to
***************
*** 543,549 ****
fatal("Don't run Squid as root, set 'cache_effective_user'!");
}
if (httpPortNumOverride != 1)
! Config.Port.http = (u_short) httpPortNumOverride;
if (icpPortNumOverride != 1)
Config.Port.icp = (u_short) icpPortNumOverride;
--- 556,562 ----
fatal("Don't run Squid as root, set 'cache_effective_user'!");
}
if (httpPortNumOverride != 1)
! Config.Port.http[0] = (u_short) httpPortNumOverride;
if (icpPortNumOverride != 1)
Config.Port.icp = (u_short) icpPortNumOverride;
*** src/neighbors.c.orig Wed Apr 16 01:26:00 1997
--- src/neighbors.c Tue Apr 29 10:39:31 1997
***************
*** 833,843 ****
int mcast_ttl)
{
peer *e = NULL;
const char *me = getMyHostname();
! if (!strcmp(host, me) && http_port == Config.Port.http) {
! debug(15, 0, "neighborAdd: skipping cache_host %s %s/%d/%d\n",
! type, host, http_port, icp_port);
! return;
}
e = xcalloc(1, sizeof(peer));
e->http_port = http_port;
--- 833,849 ----
int mcast_ttl)
{
peer *e = NULL;
+ int j;
const char *me = getMyHostname();
!
! if (!strcmp(host, me)) {
! for (j=0;j < Config.Port.number_http; j++) {
! if (http_port == Config.Port.http[j]) {
! debug(15, 0, "neighborAdd: skipping cache_host %s %s/%d/%d\n",
! type, host, http_port, icp_port);
! return;
! }
! }
}
e = xcalloc(1, sizeof(peer));
e->http_port = http_port;
*** src/send-announce.c.orig Tue Feb 25 19:24:51 1997
--- src/send-announce.c Tue Apr 29 10:39:31 1997
***************
*** 62,70 ****
sndbuf[0] = '\0';
sprintf(tbuf, "cache_version SQUID/%s\n", version_string);
strcat(sndbuf, tbuf);
sprintf(tbuf, "Running on %s %d %d\n",
getMyHostname(),
! Config.Port.http,
Config.Port.icp);
strcat(sndbuf, tbuf);
if (Config.adminEmail) {
--- 62,71 ----
sndbuf[0] = '\0';
sprintf(tbuf, "cache_version SQUID/%s\n", version_string);
strcat(sndbuf, tbuf);
+ /* XXX should actually send all http ports -- ltd */
sprintf(tbuf, "Running on %s %d %d\n",
getMyHostname(),
! Config.Port.http[0],
Config.Port.icp);
strcat(sndbuf, tbuf);
if (Config.adminEmail) {
*** src/squid.h.orig Thu Apr 24 19:41:17 1997
--- src/squid.h Tue Apr 29 10:39:31 1997
***************
*** 315,321 ****
extern time_t squid_starttime; /* main.c */
extern int do_reuse; /* main.c */
! extern int theHttpConnection; /* main.c */
extern int theInIcpConnection; /* main.c */
extern int theOutIcpConnection; /* main.c */
extern int vizSock;
--- 315,321 ----
extern time_t squid_starttime; /* main.c */
extern int do_reuse; /* main.c */
! extern int theHttpConnection[MAXHTTPPORTS]; /* main.c */
extern int theInIcpConnection; /* main.c */
extern int theOutIcpConnection; /* main.c */
extern int vizSock;
*** src/tools.c.orig Thu Mar 27 07:19:02 1997
--- src/tools.c Tue Apr 29 10:39:32 1997
***************
*** 132,140 ****
static void
releaseServerSockets(void)
{
/* Release the main ports as early as possible */
! if (theHttpConnection >= 0)
! (void) close(theHttpConnection);
if (theInIcpConnection >= 0)
(void) close(theInIcpConnection);
if (theOutIcpConnection >= 0 && theOutIcpConnection != theInIcpConnection)
--- 132,144 ----
static void
releaseServerSockets(void)
{
+ int j;
+
/* Release the main ports as early as possible */
! for (j = 0; j < Config.Port.number_http; j++) {
! if (theHttpConnection[j] >= 0)
! (void) close(theHttpConnection[j]);
! }
if (theInIcpConnection >= 0)
(void) close(theInIcpConnection);
if (theOutIcpConnection >= 0 && theOutIcpConnection != theInIcpConnection)
-- ----------------------------------------------------------------------------- E-Mail: Henny.Bekker@cc.ruu.nl ! Disclaimer: The main obstacle to progress http http://www.ruu.nl/~henny ! progress is not ignorance,but PTT: Voice: +31 30 2536971 Fax: +31 30 2531633 ! the illusion of knowledge X400: /G=Henny/S=Bekker/OU=cc/O=ruu/PRMD=surf/ADMD=400net/C=nl o Paper: H.J.Bekker, Utrecht University, Computer Centre _ /- _ Po Box 80011, 3508 TA Utrecht Nederland (_) > (_) -----------------------------------------------------------------------------Received on Tue Apr 29 1997 - 02:56:17 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:35:03 MST