Commit Graph

16 Commits

Author SHA1 Message Date
Willy Tarreau
a0d37b69ef [MINOR] implement a time parsing function
This new function accepts inputs in various default units, from
the microsecond to the day. It detects suffixes after numbers
and performs the appropriate conversions between the user's unit
and the program's unit, considering a unit-less number in the
default unit.
2007-12-02 22:00:35 +01:00
Willy Tarreau
2e74c3f202 [MEDIUM] restrict the set of allowed characters for identifiers
In order to avoid issues in the future, we want to restrict
the set of allowed characters for identifiers. Starting from
now, only A-Z, a-z, 0-9, '-', '_', '.' and ':' will be allowed
for a proxy, a server or an ACL name.

A test file has been added to check the restriction.
2007-12-02 18:45:09 +01:00
Alexandre Cassen
5eb1a9033a [MEDIUM] New option http_proxy
Hello,

You will find attached an updated release of previously submitted patch.
It polish some part and extend ACL engine to match IP and PORT parsed in
HTTP request. (and take care of comments made by Willy ! ;))

Best regards,
Alexandre
2007-11-29 15:43:32 +01:00
Willy Tarreau
91092e5739 [MINOR] provide easy-to-use limit_r and LIM2A* macros
This is in fact the same as ultoa() except that it's possible to
pass the string to be returned in case the value is NULL. This is
useful to report limits in printf calls.
2007-10-25 16:59:40 +02:00
Willy Tarreau
72d759c9c1 [MINOR] provide easier-to-use ultoa_* functions
Current ultoa() function is limited to one use per expression or
function call. Sometimes this is limitating. Change this in favor
of an array of 10 return values and shorter macros U2A0..U2A9
which respectively call the function with the 10 different buffers.
2007-10-25 16:59:40 +02:00
Willy Tarreau
fe94460d53 [BUG] fix calls to localtime()
localtime() was called with pointers to tv_sec, which is time_t on
some platforms and long on others. A problem was encountered on
Sparc64 under OpenBSD where tv_sec is long (64 bits) and time_t is
32 bits. Since this architecture is big-endian, it exhibited the
bug because localtime() always worked with the high part of the
value which is always zero. This problem was identified and debugged
by Thierry Fournier.

The correct solution is to pass the date by value and not by pointer,
through an intermediate function. The use of localtime_r() instead of
localtime() also made it possible to get rid of the first call to
localtime() since it does not need to allocate memory anymore.
2007-10-25 10:34:16 +02:00
Willy Tarreau
3f0c976135 [BUG] fix error checking in strl2ic/strl2uic()
The strl2ic() and strl2uic() primitives used to convert string to
integers could return 10 times the value read if they stopped on
non-digit because of a mis-placed loop exit.
2007-10-25 09:42:24 +02:00
Willy Tarreau
938b303a04 [BUILD] fixed build of files including standard.h on OpenBSD
The file standard.h included netinet/in.h without including
sys/types.h. This broke build on OpenBSD.
2007-05-10 06:39:03 +02:00
Willy Tarreau
d077a8e67c [MINOR] fixed useless memory allocation in str2net()
It was not necessary anymore to allocate memory in str2net().
Moreover, some calls to free() were missing in case of errors.
2007-05-08 23:23:38 +02:00
Willy Tarreau
167d8b5953 [BUILD] Fix limits.h once for all
Patch #cf83df3d162687d9c74783357421bd89f596eaac was stupid. Including
limits.h is portable and easier. At least it now builds on Solaris,
FreeBSD, Linux and OpenBSD.
2007-04-09 22:16:12 +02:00
Willy Tarreau
cf83df3d16 [BUILD] fix build on FreeBSD for INT_MIN/INT_MAX
FreeBSD stores INT_MIN and INT_MAX in sys/limits.h only. Other systems
(Solaris) have it in sys/types.h and do not have sys/limits.h. Let's
include sys/limits.h only if INT_MAX is not defined.
2007-04-09 15:57:51 +02:00
Willy Tarreau
6911fa484c [MINOR] added new str2i* functions
Those functions provide faster and more flexible alternatives to atoi(),
some of which are able to work on sub-strings.
2007-03-04 18:06:08 +01:00
Willy Tarreau
ca28d1e1cb [BUILD] fix build on FreeBSD (missing fd_set declaration)
Sorin Pop reported a patch to fix build on FreeBSD.
The file common/standard.h used an fd_set in a declaration
but did not include enough headers for it to be known.
2007-01-24 18:20:50 +01:00
Willy Tarreau
7d58a63071 [MINOR] added the Linux-style likely/unlikely macros
Recent GCC versions support the __builtin_expect() macro which
is undecipherable. Let's use likely()/unlikely() like it's done
in Linux.
2007-01-13 23:06:06 +01:00
Willy Tarreau
e3ba5f0aaa [CLEANUP] included common/version.h everywhere 2006-06-29 18:54:54 +02:00
Willy Tarreau
2dd0d4799e [CLEANUP] renamed include/haproxy to include/common 2006-06-29 17:53:05 +02:00