crossroads

Git mirror of https://crossroads.e-tunity.com/
git clone git://git.finwo.net/app/crossroads
Log | Files | Refs | LICENSE

commit 66aa5acb0b214814915a973a0c4a4476107692ca
parent ea4b26120600483f2f318e0fcdf1887244955ed7
Author: finwo <finwo@pm.me>
Date:   Sat,  3 Jan 2026 19:34:27 +0100

1.69

Diffstat:
MChangeLog | 5+++++
Mdoc/crossroads.html | 4++--
Mdoc/crossroads.pdf | 0
Metc/Makefile.def | 2+-
Metc/svnrev.txt | 2+-
Msrc/crossroads-daemon/main.c | 2+-
Msrc/crossroads.h | 3++-
Msrc/crossroads/main.c | 2+-
Msrc/lib/allocreporter.c | 2+-
Msrc/lib/ansistamp.c | 2+-
Msrc/lib/backendavailable.c | 2+-
Msrc/lib/backendconnect.c | 2+-
Msrc/lib/backendcount.c | 2+-
Msrc/lib/checkservice.c | 2+-
Msrc/lib/choosebackend.c | 2+-
Msrc/lib/cmdconfigtest.c | 2+-
Msrc/lib/cmdrestart.c | 2+-
Msrc/lib/cmdservices.c | 2+-
Msrc/lib/cmdstart.c | 2+-
Msrc/lib/cmdstatus.c | 2+-
Msrc/lib/cmdstop.c | 2+-
Msrc/lib/cmdtell.c | 2+-
Msrc/lib/configread.c | 2+-
Msrc/lib/configwrite.c | 2+-
Msrc/lib/copysockets.c | 2+-
Msrc/lib/createcommandlinespace.c | 2+-
Msrc/lib/data.c | 2+-
Msrc/lib/deallocreporter.c | 2+-
Msrc/lib/decrclientcount.c | 2+-
Msrc/lib/dns.c | 4++--
Msrc/lib/error.c | 2+-
Msrc/lib/gmtstamp.c | 2+-
Msrc/lib/hashpjw.c | 2+-
Msrc/lib/httpcopy.c | 2+-
Msrc/lib/httperror.c | 2+-
Msrc/lib/httpheaderaddheader.c | 2+-
Msrc/lib/httpheaderappendheader.c | 2+-
Msrc/lib/httpheaderconnectiontype.c | 2+-
Msrc/lib/httpheaderfree.c | 2+-
Msrc/lib/httpheaderhascookie.c | 2+-
Msrc/lib/httpheaderhttpver.c | 2+-
Msrc/lib/httpheadernew.c | 2+-
Msrc/lib/httpheaderread.c | 114++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
Msrc/lib/httpheaderremoveheader.c | 2+-
Msrc/lib/httpheadersetheader.c | 2+-
Msrc/lib/httpheaderval.c | 2+-
Msrc/lib/httpheaderwrite.c | 4+++-
Msrc/lib/httpinsertheader.c | 2+-
Msrc/lib/httpserve.c | 2+-
Msrc/lib/httpserversocket.c | 2+-
Msrc/lib/httpwrite.c | 2+-
Msrc/lib/incrclientcount.c | 2+-
Msrc/lib/initsockaddr.c | 2+-
Msrc/lib/interrupt.c | 2+-
Msrc/lib/ipfaddallow.c | 2+-
Msrc/lib/ipfadddeny.c | 2+-
Msrc/lib/ipfallowed.c | 2+-
Msrc/lib/ipfdenied.c | 2+-
Msrc/lib/ipfloadfile.c | 2+-
Msrc/lib/ipfmatch.c | 2+-
Msrc/lib/ipfparse.c | 2+-
Msrc/lib/ishexdigit.c | 2+-
Msrc/lib/isspace.c | 2+-
Msrc/lib/lexer.c | 2+-
Msrc/lib/lockreporter.c | 2+-
Msrc/lib/logactivityany.c | 2+-
Msrc/lib/logactivitycontinuation.c | 2+-
Msrc/lib/logactivityend.c | 2+-
Msrc/lib/logactivitystart.c | 2+-
Msrc/lib/makesocket.c | 2+-
Msrc/lib/markactivity.c | 2+-
Msrc/lib/msg.c | 2+-
Msrc/lib/msgdumpbuf.c | 2+-
Asrc/lib/netallocbufs.c | 19+++++++++++++++++++
Msrc/lib/netbuffer.c | 2+-
Msrc/lib/netbufread.c | 11+++--------
Msrc/lib/netcopy.c | 2+-
Msrc/lib/netread.c | 6++++--
Msrc/lib/netwrite.c | 2+-
Msrc/lib/parser.c | 2+-
Msrc/lib/parserclose.c | 2+-
Msrc/lib/parserfilename.c | 2+-
Msrc/lib/parserinput.c | 4++--
Msrc/lib/parseropen.c | 2+-
Msrc/lib/parserrun.c | 2+-
Msrc/lib/parserskipchar.c | 2+-
Msrc/lib/parserskipline.c | 2+-
Msrc/lib/runservice.c | 2+-
Msrc/lib/setproctitle.c | 2+-
Msrc/lib/showconfig.c | 2+-
Msrc/lib/stagetostring.c | 2+-
Msrc/lib/statetostring.c | 2+-
Msrc/lib/strcasestr.c | 2+-
Msrc/lib/strexpandformat.c | 2+-
Msrc/lib/stringtostate.c | 2+-
Msrc/lib/strlcat.c | 2+-
Msrc/lib/strprintf.c | 2+-
Msrc/lib/strupr.c | 2+-
Msrc/lib/strvprintf.c | 2+-
Msrc/lib/symtabend.c | 2+-
Msrc/lib/symtablookup.c | 2+-
Msrc/lib/symtabset.c | 2+-
Msrc/lib/symtabstart.c | 2+-
Msrc/lib/sysrun.c | 31++++++++++++++++++++++++++-----
Msrc/lib/tcpserve.c | 2+-
Msrc/lib/thruputlog.c | 2+-
Msrc/lib/trafficlog.c | 2+-
Msrc/lib/uidassume.c | 2+-
Msrc/lib/uidrestore.c | 2+-
Msrc/lib/unlockreporter.c | 2+-
Msrc/lib/usage.c | 2+-
Msrc/lib/vsyslog.c | 2+-
Msrc/lib/wakeuphandler.c | 9++++++---
Msrc/lib/warning.c | 2+-
Msrc/lib/writelog.c | 2+-
Msrc/lib/xcalloc.c | 2+-
Msrc/lib/xmalloc.c | 2+-
Msrc/lib/xrealloc.c | 2+-
Msrc/lib/xstrcat.c | 2+-
Msrc/lib/xstrcatch.c | 2+-
Msrc/lib/xstrdup.c | 2+-
Mtest/extcheck.conf | 8++++----
122 files changed, 297 insertions(+), 141 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,6 +1,11 @@ ChangeLog for Crossroads ------------------------------------------------------------------------------ +1.69 [KK 2008-01-11] + - The HTTP header processing was rewritten to work with octet + chunks. Previously TCP buffers would be processed byte by byte + to match headers. Hopefully this will speed up HTTP processing. + 1.68 [KK 2008-01-10] - "crossroads status" now also reports the PID of each service listener process (in both plain text and XML). Thanks Felix Ostmann diff --git a/doc/crossroads.html b/doc/crossroads.html @@ -1,12 +1,12 @@ <a name="../crossroads-defs"></a><a name="defs"></a><html><head> -<title>Crossroads 1.68</title> +<title>Crossroads 1.69</title> <link rel="stylesheet" type="text/css" href="http://www.e-tunity.com/css/yodl.css"> <link rel="stylesheet" type="text/css" href="http://www.e-tunity.com/css/yodl.css"> <link rev="made" href="mailto:info@e-tunity.com"> </head> <body> <hr> -<h1>Crossroads 1.68</h1> +<h1>Crossroads 1.69</h1> <h2>Karel Kubat <br> Maintained by Karel Kubat (karel@kubat.nl)</h2> diff --git a/doc/crossroads.pdf b/doc/crossroads.pdf Binary files differ. diff --git a/etc/Makefile.def b/etc/Makefile.def @@ -6,7 +6,7 @@ # Versioning. This defines the overall version ID and must match the topmost # entry in the ChangeLog. -VER = 1.68 +VER = 1.69 # Years that Crossroads has been 'round. YEARS = 2005-2007 diff --git a/etc/svnrev.txt b/etc/svnrev.txt @@ -1 +1 @@ -210 +212 diff --git a/src/crossroads-daemon/main.c b/src/crossroads-daemon/main.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/crossroads.h b/src/crossroads.h @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -425,6 +425,7 @@ extern int net_copy (int clientsock, int serversock, int maxbytes, unsigned char *buf); extern int net_read (int sock, int maxbytes, unsigned char *buf, int is_client); +extern void net_allocbufs (void); extern unsigned char *net_buffer (CopyDirection dir, int *sz); extern unsigned char *net_bufread (int sock, int maxbytes, int *nreadp, int is_client); diff --git a/src/crossroads/main.c b/src/crossroads/main.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/allocreporter.c b/src/lib/allocreporter.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/ansistamp.c b/src/lib/ansistamp.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/backendavailable.c b/src/lib/backendavailable.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/backendconnect.c b/src/lib/backendconnect.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/backendcount.c b/src/lib/backendcount.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/checkservice.c b/src/lib/checkservice.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/choosebackend.c b/src/lib/choosebackend.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/cmdconfigtest.c b/src/lib/cmdconfigtest.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/cmdrestart.c b/src/lib/cmdrestart.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/cmdservices.c b/src/lib/cmdservices.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/cmdstart.c b/src/lib/cmdstart.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/cmdstatus.c b/src/lib/cmdstatus.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/cmdstop.c b/src/lib/cmdstop.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/cmdtell.c b/src/lib/cmdtell.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/configread.c b/src/lib/configread.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/configwrite.c b/src/lib/configwrite.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/copysockets.c b/src/lib/copysockets.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/createcommandlinespace.c b/src/lib/createcommandlinespace.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/data.c b/src/lib/data.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/deallocreporter.c b/src/lib/deallocreporter.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/decrclientcount.c b/src/lib/decrclientcount.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/dns.c b/src/lib/dns.c @@ -1,12 +1,12 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ #include "../crossroads.h" -// #define DEBUG +/* #define DEBUG */ static int noncache_resolve (char const *hostname, struct in_addr *res) { struct hostent *hent; diff --git a/src/lib/error.c b/src/lib/error.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/gmtstamp.c b/src/lib/gmtstamp.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/hashpjw.c b/src/lib/hashpjw.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpcopy.c b/src/lib/httpcopy.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httperror.c b/src/lib/httperror.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpheaderaddheader.c b/src/lib/httpheaderaddheader.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpheaderappendheader.c b/src/lib/httpheaderappendheader.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpheaderconnectiontype.c b/src/lib/httpheaderconnectiontype.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpheaderfree.c b/src/lib/httpheaderfree.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpheaderhascookie.c b/src/lib/httpheaderhascookie.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpheaderhttpver.c b/src/lib/httpheaderhttpver.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpheadernew.c b/src/lib/httpheadernew.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpheaderread.c b/src/lib/httpheaderread.c @@ -1,17 +1,20 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ #include "../crossroads.h" +/* For more debugging information, undefine the following and set + * "verbosity on" in the configuration file. */ /* #define DEBUG */ #ifdef DEBUG + static void debughdr (HttpHeader *h) { int i; - msg ("http header read: %d headers so far", h->nheader); + msg ("http_header_read: %d headers so far", h->nheader); for (i = 0; i < h->nheader; i++) msg ("http header read: header[%d] '%s'", i, h->header[i]); @@ -20,8 +23,111 @@ static void debughdr (HttpHeader *h) { #define SHOWHEADERS(h) debughdr((h)) #else #define SHOWHEADERS(h) + #endif +/* Match a header (part) in a buffer. Return the header length. + * Stop at [\r]\n, or when the buffer length is reached. */ +int matchheader (unsigned char *const buf, int max) { + int i, len = 0; + + /* Loop over buffer */ + for (i = 0; i < max; i++) { + if (buf[i] == '\r' || buf[i] == '\n') + break; + len++; + } +# ifdef DEBUG + msg ("Next header length: %d", len); +# endif + + return (len); +} + +void http_header_read (HttpHeader *h, int sock, CopyDirection dir) { + unsigned char *buf; + int *curp, *maxp, hlen, append = 0, orglen; + + /* Make sure buffers are there. */ + net_allocbufs (); + + /* Set the dst ptrs */ + if (dir == dir_client_to_server) { + buf = clbuf; + curp = &clbufpos; + maxp = &clbufmax; + } + else { + buf = srbuf; + curp = &srbufpos; + maxp = &srbufmax; + } + + /* Get TCP octets until the headers are in. */ + while (1) { + /* No buffer contents? TCP read. */ + if (! *maxp) { + *maxp = net_read (sock, tcp_bufsz, buf, + dir == dir_client_to_server); + msg ("Service %s: Got %d bytes for headers", + activeservice->name, *maxp); + } + + /* Match a header (or a part of it). */ + if (! (hlen = matchheader (buf + *curp, *maxp - *curp)) ) { + /* Headers finished! */ + if (buf[*curp] == '\r') + (*curp)++; + if (buf[*curp] == '\n') + (*curp)++; + if (*curp == *maxp) { + *maxp = 0; + *curp = 0; + } + break; + } + + /* We have a header. Add it. */ + if (!append || h->nheader == 0) { + /* This part goes into a new header. */ + h->header = xrealloc (h->header, (h->nheader + 1) * sizeof (char*)); + h->header[h->nheader] = xmalloc (hlen + 1); + memcpy (h->header[h->nheader], buf + *curp, hlen); + h->header[h->nheader][hlen] = 0; + h->nheader++; + } else { + /* This part goes at the end of the current header. */ + orglen = strlen(h->header [h->nheader - 1]); + h->header[h->nheader - 1] = + xrealloc (h->header[h->nheader - 1], orglen + hlen + 1); + memcpy (h->header[h->nheader - 1] + orglen, buf + *curp, hlen); + h->header[h->nheader - 1][orglen + hlen] = 0; + } + *curp += hlen; + + SHOWHEADERS(h); + + /* Skip over [\r]\n. If they occur then we won't append the next + * time around. */ + if (buf[*curp] == '\r') + (*curp)++; + if (buf[*curp] == '\n') { + (*curp)++; + append = 0; + } + if (*curp == *maxp) { + *maxp = 0; + *curp = 0; + } + } +} + +/* THE FOLLOWING IS THE PRE-1.69 CODE. IT WORKS BUT IS NOT CPU + * FRIENDLY. THE ABOVE CODE IS BETTER, BUT .... ALPHA + * I AM LEAVING THE OLD CODE FOR REFERENCE BELOW. + */ +#ifdef OLDCODE + void http_header_read (HttpHeader *h, int sock, CopyDirection dir) { unsigned char *cp; int last_is_nl = 0, at_start = 1; @@ -31,7 +137,7 @@ void http_header_read (HttpHeader *h, int sock, CopyDirection dir) { dir == dir_client_to_server ? "client" : "server"); while (1) { cp = net_bufread (sock, 1, 0, dir == dir_client_to_server); - /* msg ("http header read: got char %d (%c)", *cp, *cp); */ + /* msg ("http header read: got char %d (%c)", *cp, *cp); */ /* SHOWHEADERS(h); */ if (*cp == '\r') continue; @@ -53,3 +159,5 @@ void http_header_read (HttpHeader *h, int sock, CopyDirection dir) { SHOWHEADERS(h); } + +#endif /* OLDCODE */ diff --git a/src/lib/httpheaderremoveheader.c b/src/lib/httpheaderremoveheader.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpheadersetheader.c b/src/lib/httpheadersetheader.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpheaderval.c b/src/lib/httpheaderval.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpheaderwrite.c b/src/lib/httpheaderwrite.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -15,8 +15,10 @@ void http_header_write (HttpHeader *m, int sock, CopyDirection dir) { for (i = 0; i < m->nheader; i++) { if (! m->header[i] || ! *m->header[i]) continue; + /* msg ("Service %s: sending header %d: '%s'", activeservice->name, i, m->header[i]); + */ http_write (sock, dir, (unsigned char const *) m->header[i], strlen(m->header[i])); http_write (sock, dir, (unsigned char const *) "\r\n", 2); diff --git a/src/lib/httpinsertheader.c b/src/lib/httpinsertheader.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpserve.c b/src/lib/httpserve.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpserversocket.c b/src/lib/httpserversocket.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/httpwrite.c b/src/lib/httpwrite.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/incrclientcount.c b/src/lib/incrclientcount.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/initsockaddr.c b/src/lib/initsockaddr.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/interrupt.c b/src/lib/interrupt.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/ipfaddallow.c b/src/lib/ipfaddallow.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/ipfadddeny.c b/src/lib/ipfadddeny.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/ipfallowed.c b/src/lib/ipfallowed.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/ipfdenied.c b/src/lib/ipfdenied.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/ipfloadfile.c b/src/lib/ipfloadfile.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/ipfmatch.c b/src/lib/ipfmatch.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/ipfparse.c b/src/lib/ipfparse.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/ishexdigit.c b/src/lib/ishexdigit.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/isspace.c b/src/lib/isspace.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/lexer.c b/src/lib/lexer.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/lockreporter.c b/src/lib/lockreporter.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/logactivityany.c b/src/lib/logactivityany.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/logactivitycontinuation.c b/src/lib/logactivitycontinuation.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/logactivityend.c b/src/lib/logactivityend.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/logactivitystart.c b/src/lib/logactivitystart.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/makesocket.c b/src/lib/makesocket.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/markactivity.c b/src/lib/markactivity.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/msg.c b/src/lib/msg.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/msgdumpbuf.c b/src/lib/msgdumpbuf.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/netallocbufs.c b/src/lib/netallocbufs.c @@ -0,0 +1,19 @@ +/************************************************************************* + * This file is part of Crosroads 1.69, a load balancer and fail over + * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. + * Visit http://crossroads.e-tunity.com for information. + *************************************************************************/ + +#include "../crossroads.h" + +void net_allocbufs () { + if (!clbuf) { + clbuf = xmalloc (tcp_bufsz + 1); + clbuf[tcp_bufsz] = 0; + srbuf = xmalloc (tcp_bufsz + 1); + srbuf[tcp_bufsz] = 0; + clbufmax = srbufmax = clbufpos = srbufpos = 0; + msg ("Service %s: Allocated client and server buffers", + activeservice->name); + } +} diff --git a/src/lib/netbuffer.c b/src/lib/netbuffer.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/netbufread.c b/src/lib/netbufread.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -12,14 +12,9 @@ unsigned char *net_bufread (int sock, int max, int *nread, int *bufpos, *bufmax, rest; /* Make sure we have the buffers. */ - if (!clbuf) { - clbuf = xmalloc (tcp_bufsz); - srbuf = xmalloc (tcp_bufsz); - clbufmax = srbufmax = clbufpos = srbufpos = 0; - msg ("Service %s: Allocated client and server buffers", - activeservice->name); - } + net_allocbufs(); + /* Set our own ptrs */ if (is_client) { buf = clbuf; bufpos = &clbufpos; diff --git a/src/lib/netcopy.c b/src/lib/netcopy.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/netread.c b/src/lib/netread.c @@ -1,12 +1,14 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ #include "../crossroads.h" -// #define DEBUG +/* For special-extra verbosity: add "verbose yes" to crossroads.conf + * and undefine the following line. */ +/* #define DEBUG */ #ifdef DEBUG #define LOGGIT msg ("back end %d", current_backend) diff --git a/src/lib/netwrite.c b/src/lib/netwrite.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/parser.c b/src/lib/parser.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/parserclose.c b/src/lib/parserclose.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/parserfilename.c b/src/lib/parserfilename.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/parserinput.c b/src/lib/parserinput.c @@ -1,12 +1,12 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ #include "../crossroads.h" -// #define DEBUG +/* #define DEBUG */ int parser_input (char *buf, int max) { int i, ndef = 0; diff --git a/src/lib/parseropen.c b/src/lib/parseropen.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/parserrun.c b/src/lib/parserrun.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/parserskipchar.c b/src/lib/parserskipchar.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/parserskipline.c b/src/lib/parserskipline.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/runservice.c b/src/lib/runservice.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/setproctitle.c b/src/lib/setproctitle.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/showconfig.c b/src/lib/showconfig.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/stagetostring.c b/src/lib/stagetostring.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/statetostring.c b/src/lib/statetostring.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/strcasestr.c b/src/lib/strcasestr.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/strexpandformat.c b/src/lib/strexpandformat.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/stringtostate.c b/src/lib/stringtostate.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/strlcat.c b/src/lib/strlcat.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/strprintf.c b/src/lib/strprintf.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/strupr.c b/src/lib/strupr.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/strvprintf.c b/src/lib/strvprintf.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/symtabend.c b/src/lib/symtabend.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/symtablookup.c b/src/lib/symtablookup.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/symtabset.c b/src/lib/symtabset.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/symtabstart.c b/src/lib/symtabstart.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/sysrun.c b/src/lib/sysrun.c @@ -1,11 +1,14 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ #include "../crossroads.h" +/* To see the command that runs, even in the wakeup handler, undefine: */ +/* #define DEBUG */ + int sysrun (char const *cmd) { char *expanded; int ret; @@ -14,14 +17,32 @@ int sysrun (char const *cmd) { return (0); expanded = str_expand_format (cmd); + +# ifdef DEBUG + msg ("Service %s: running command '%s'", activeservice->name, expanded); +# else if (program_stage != stage_retrying) msg ("Service %s: running command: '%s'", activeservice->name, expanded); - uid_assume(); - if ( (ret = system (expanded)) && program_stage != stage_retrying) - warning ("Service %s: command '%s' -> '%s' returned %d", - activeservice->name, cmd, expanded, ret); +# endif + + uid_assume(); + ret = system (expanded); uid_restore(); + + if (ret > 0) + warning ("Service %s: command '%s' returned %d", + activeservice->name, expanded, ret); + else if (ret < 0) + warning ("Service %s: failed to run command '%s': %s", + activeservice->name, expanded, strerror(errno)); + +# ifdef DEBUG + if (!ret) + msg ("Service %s: command '%s' returned %d", + activeservice->name, expanded, ret); +# endif + free (expanded); return (ret); diff --git a/src/lib/tcpserve.c b/src/lib/tcpserve.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/thruputlog.c b/src/lib/thruputlog.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/trafficlog.c b/src/lib/trafficlog.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/uidassume.c b/src/lib/uidassume.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/uidrestore.c b/src/lib/uidrestore.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/unlockreporter.c b/src/lib/unlockreporter.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/usage.c b/src/lib/usage.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/vsyslog.c b/src/lib/vsyslog.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/wakeuphandler.c b/src/lib/wakeuphandler.c @@ -1,11 +1,14 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ #include "../crossroads.h" +/* For more verbosity of the wake up handler, undefine: */ +/* #define DEBUG */ + void wakeup_handler () { int sock, i; Backendavail av, prev; @@ -39,12 +42,12 @@ void wakeup_handler () { (activeservice->rev_interval && prev != st_unavailable) ) continue; - /* +# ifdef DEBUG msg ("Service %s: verifying back end %s, old state %s", activeservice->name, activeservice->backend[current_backend].name, state_to_string(prev)); - */ +# endif /* Mark state as WAKING */ lock_reporter(); diff --git a/src/lib/warning.c b/src/lib/warning.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/writelog.c b/src/lib/writelog.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/xcalloc.c b/src/lib/xcalloc.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/xmalloc.c b/src/lib/xmalloc.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/xrealloc.c b/src/lib/xrealloc.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/xstrcat.c b/src/lib/xstrcat.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/xstrcatch.c b/src/lib/xstrcatch.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lib/xstrdup.c b/src/lib/xstrdup.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.68, a load balancer and fail over + * This file is part of Crosroads 1.69, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/test/extcheck.conf b/test/extcheck.conf @@ -1,7 +1,7 @@ -# This verifies an externalhandler for backend availability checks. -# After hitting XR on port 30000, the test-backend will be marked -# available. Within 5 secs, XR will decide that it's up after all, -# cuz the externalhandler says so. +/* This verifies an externalhandler for backend availability checks. + * After hitting XR on port 30000, the test-backend will be marked + * available. Within 5 secs, XR will decide that it's up after all, + * cuz the externalhandler says so. */ service test { verbosity on;