Here are two patches.
Patch 1> Fixes seg fault condition in byCPU().
Patch 2> Allows using mod_backhand with SSL enabled web servers.
Patch #1
The byCPU funtion uses MAXSERVERS when it should probably use
the number of servers in the cluster. This was seg faulting
under Solaris 2.8 without this change.
--- cut here ---
*** builtins.c Fri Apr 6 16:46:29 2001
--- builtins.c.new Mon Apr 9 17:50:22 2001
***************
*** 123,129 ****
Idle(i) >= Idle(j) for all j in n and i in x */
int highidle, mycount, i;
! for(i=0;i<MAXSERVERS;i++)
if(serverstats[servers[i].id].cpu > highidle)
highidle=serverstats[servers[i].id].cpu;
mycount=0;
--- 123,129 ----
Idle(i) >= Idle(j) for all j in n and i in x */
int highidle, mycount, i;
! for(i=0;i<*n;i++)
if(serverstats[servers[i].id].cpu > highidle)
highidle=serverstats[servers[i].id].cpu;
mycount=0;
--- cut here ---
Patch #2
Here's a feature that probably needs to be accounted for. The case
where you want to redirect between secure web servers.
--- cut here ---
*** mod_backhand.c Tue Sep 5 19:16:58 2000
--- mod_backhand.c.new Mon Apr 9 16:07:03 2001
***************
*** 510,515 ****
--- 510,516 ----
if(remote_machine.redirect) {
char portstring[6] = "\0";
+ char protocol[6] = "\0";
unsigned short port;
int n;
if(loglevel & MBLL_DCSN3)
***************
*** 527,541 ****
}
/* now do the redirection */
port = ntohs(serverstats[remote_machine.id].contact.sin_port);
! if(port!=80) ap_snprintf(portstring, 6, ":%d", port);
if(remote_machine.hosttype == MB_HOSTTYPE_IP) {
! ap_snprintf(buffer, RBUFLEN, "http://%s%s%s",
inet_ntoa(serverstats[remote_machine.id].contact.sin_addr),
portstring, r->filename);
} else {
const char *rhost = ap_table_get(r->notes, "Backhand-Redirect-Host");
if(!rhost) rhost=serverstats[remote_machine.id].hostname;
! ap_snprintf(buffer, RBUFLEN, "http://%s%s%s", rhost, portstring,
r->filename);
}
ap_table_setn(r->headers_out, "Location", buffer);
--- 528,546 ----
}
/* now do the redirection */
port = ntohs(serverstats[remote_machine.id].contact.sin_port);
! if(port!=80 && port!=443) ap_snprintf(portstring, 6, ":%d", port);
! if(port==443)
! strcpy(protocol, "https");
! else
! strcpy(protocol, "http");
if(remote_machine.hosttype == MB_HOSTTYPE_IP) {
! ap_snprintf(buffer, RBUFLEN, "%s://%s%s%s", protocol
inet_ntoa(serverstats[remote_machine.id].contact.sin_addr),
portstring, r->filename);
} else {
const char *rhost = ap_table_get(r->notes, "Backhand-Redirect-Host");
if(!rhost) rhost=serverstats[remote_machine.id].hostname;
! ap_snprintf(buffer, RBUFLEN, "%s://%s%s%s", protocol, rhost, portstring,
r->filename);
}
ap_table_setn(r->headers_out, "Location", buffer);
--- cut here ---
-----------------------------------------------------------------
Senior Systems Administrator -- Rice University -- dlane@rice.edu
-----------------------------------------------------------------
Patch 1> Fixes seg fault condition in byCPU().
Patch 2> Allows using mod_backhand with SSL enabled web servers.
Patch #1
The byCPU funtion uses MAXSERVERS when it should probably use
the number of servers in the cluster. This was seg faulting
under Solaris 2.8 without this change.
--- cut here ---
*** builtins.c Fri Apr 6 16:46:29 2001
--- builtins.c.new Mon Apr 9 17:50:22 2001
***************
*** 123,129 ****
Idle(i) >= Idle(j) for all j in n and i in x */
int highidle, mycount, i;
! for(i=0;i<MAXSERVERS;i++)
if(serverstats[servers[i].id].cpu > highidle)
highidle=serverstats[servers[i].id].cpu;
mycount=0;
--- 123,129 ----
Idle(i) >= Idle(j) for all j in n and i in x */
int highidle, mycount, i;
! for(i=0;i<*n;i++)
if(serverstats[servers[i].id].cpu > highidle)
highidle=serverstats[servers[i].id].cpu;
mycount=0;
--- cut here ---
Patch #2
Here's a feature that probably needs to be accounted for. The case
where you want to redirect between secure web servers.
--- cut here ---
*** mod_backhand.c Tue Sep 5 19:16:58 2000
--- mod_backhand.c.new Mon Apr 9 16:07:03 2001
***************
*** 510,515 ****
--- 510,516 ----
if(remote_machine.redirect) {
char portstring[6] = "\0";
+ char protocol[6] = "\0";
unsigned short port;
int n;
if(loglevel & MBLL_DCSN3)
***************
*** 527,541 ****
}
/* now do the redirection */
port = ntohs(serverstats[remote_machine.id].contact.sin_port);
! if(port!=80) ap_snprintf(portstring, 6, ":%d", port);
if(remote_machine.hosttype == MB_HOSTTYPE_IP) {
! ap_snprintf(buffer, RBUFLEN, "http://%s%s%s",
inet_ntoa(serverstats[remote_machine.id].contact.sin_addr),
portstring, r->filename);
} else {
const char *rhost = ap_table_get(r->notes, "Backhand-Redirect-Host");
if(!rhost) rhost=serverstats[remote_machine.id].hostname;
! ap_snprintf(buffer, RBUFLEN, "http://%s%s%s", rhost, portstring,
r->filename);
}
ap_table_setn(r->headers_out, "Location", buffer);
--- 528,546 ----
}
/* now do the redirection */
port = ntohs(serverstats[remote_machine.id].contact.sin_port);
! if(port!=80 && port!=443) ap_snprintf(portstring, 6, ":%d", port);
! if(port==443)
! strcpy(protocol, "https");
! else
! strcpy(protocol, "http");
if(remote_machine.hosttype == MB_HOSTTYPE_IP) {
! ap_snprintf(buffer, RBUFLEN, "%s://%s%s%s", protocol
inet_ntoa(serverstats[remote_machine.id].contact.sin_addr),
portstring, r->filename);
} else {
const char *rhost = ap_table_get(r->notes, "Backhand-Redirect-Host");
if(!rhost) rhost=serverstats[remote_machine.id].hostname;
! ap_snprintf(buffer, RBUFLEN, "%s://%s%s%s", protocol, rhost, portstring,
r->filename);
}
ap_table_setn(r->headers_out, "Location", buffer);
--- cut here ---
-----------------------------------------------------------------
Senior Systems Administrator -- Rice University -- dlane@rice.edu
-----------------------------------------------------------------