On Mon, Oct 05, 2009 at 12:51:07AM +0200, Krzysztof Oledzki wrote:
> >>Non ascii or HTML control characters are masked.
> >
> >I don't see the reason for masking HTML characters, since the output
> >is sent over syslog. I'm OK for masking non-ascii characters however.
> 
> Because the output is presented on html page - it is added to a popup 
> generated by "td title". But you are right - we should also add it to 
> syslog.

I'd prefer that we correctly encode at the destination, which means
to do this in the html stats functions. If necessary I can write an
HTML encoder which would take two chunks for instance.

> >>Feature can be disabled by defining HCHK_DESC_LEN to 0.
> >
> >What could be the reason for disabling this feature ? After
> >all, if people enable log-health-checks, it means they want
> >more verbose info.
> 
> To save HCHK_DESC_LEN==128 bytes for each server. If you found it 
> unnecessary I'm more than happy to remove this check.

I don't care much about a proxy or a server size. I don't like to
waste, but overall it does not change much the memory usage. Even
large configs with 1000 servers will still only be hit by 128 kB.
You can bet that those running 1000 servers are not counting their
RAM in kilobytes ;-)

What I care about however, is that most of the "hot" struct members
are grouped so that they remain hot in the CPU caches. The other
important thing is to avoid increasing the session size.

> >Here we should also check for '\n' alone, let's add this function
> >to standard.h to find and replace CR/LFs with a zero. It's small
> >and efficient enough to be reused for generic uses :
> >
> >static inline char *cut_crlf(char *s)
> >{
> >       do {
> >               if (*s == '\n' || *s == '\r')
> >                       *s = 0;
> >       } while (*s++);
> >     return s;
> >}
> >
> >Then :
> >                     desc = trash;
> >                     cut_crlf(desc);
> 
> Sure. How about adding a "break" after a first match?

Hmm my bad, this is one I use to cut and skip cr+lf. In fact for this
usage it does not change anything but it's handy when the cursor remains
on the zero once it has been reached. This one is more versatile :

/* return either pointer to zero of to char following CR/LF and
 * replace them with zero.
 */
static inline char *cut_crlf(char *s)
{
        while (*s != '\n' && *s != '\r') {
                char *p = s++;
                if (!*p)
                        return p;
        }
        *s++ = 0;
        return s;
}

I think the more we'll implement "applets", the more we'll need to
implement small and easy to use primitives like this do basic string
processing.

> >I think that if the outputs are small enough, we'll be able to
> >make them appear as automatic "popups" in the HTML stats page
> >when the check column is highlighted.
> 
> Yep, this is exactly the place where you can find them currently. ;)

Oh, maybe it's time for bed for me then :-/

Regards,
Willy


Reply via email to