BUG: fix httplog trailing LF

commit a1cc3811 introduced an undesirable \0\n ending on HTTP log messages. This
is because of an extra character count passed to __send_log() which causes the LF
to be appended past the \0. Some syslog daemons thus log an extra empty line. The
fix is obvious. Fix the function comments to remind what they expect on their input.

This is past 1.5-dev7 regression so there's no backport needed.
This commit is contained in:
Willy Tarreau 2012-02-24 11:46:54 +01:00
parent f09c6603d3
commit 53bf6af3f9
2 changed files with 3 additions and 2 deletions

View File

@ -519,7 +519,7 @@ char *hdr_log(char *dst)
/*
* This function adds a header to the message and sends the syslog message
* using a printf format string
* using a printf format string. It expects an LF-terminated message.
*/
void send_log(struct proxy *p, int level, const char *format, ...)
{
@ -546,6 +546,7 @@ void send_log(struct proxy *p, int level, const char *format, ...)
/*
* This function sends a syslog message.
* It doesn't care about errors nor does it report them.
* It overrides the last byte (message[size-1]) with an LF character.
*/
void __send_log(struct proxy *p, int level, char *message, size_t size)
{

View File

@ -1241,7 +1241,7 @@ void http_sess_log(struct session *s)
if (tmplog == NULL) // if previous error
tmplog = logline + MAX_SYSLOG_LEN - 1;
__send_log(prx_log, level, logline, tmplog - logline + 2);
__send_log(prx_log, level, logline, tmplog - logline + 1);
s->logs.logwait = 0;
}