You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Joe Orton <jo...@redhat.com> on 2009/03/06 11:19:48 UTC

Re: ap_error_log bogisity

(cc'ing dev@apr since that's where the vformatter lives)

On Thu, Mar 05, 2009 at 12:54:13AM -0600, William Rowe wrote:
> Trying to come up with ways to process large entries without
> so much copying.
>
> My thought for 2.4 is to introduce an apr_vformatter code
> modifier, '#', into the s syntax.  e.g. %#s would normalize
> any control codes into \x## or \c syntax, as appropriate.
> And %#.10s would print a fixed 10 char string including \0
> characters (a problem I encountered trying to make dumpio
> a little more efficient).

It does sound tempting - is there a one-size-fits-all escaping logic, 
though?  Not sure where you'd stop otherwise... what about non-ASCII 
characters...  why not have the HTML-escaping logic in there too?  There 
are what, four different string-escaping routines in httpd now? It's 
quite a lot of code.

Regards, Joe

Re: ap_error_log bogisity

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Joe Orton wrote:
> (cc'ing dev@apr since that's where the vformatter lives)
> 
> On Thu, Mar 05, 2009 at 12:54:13AM -0600, William Rowe wrote:
>> Trying to come up with ways to process large entries without
>> so much copying.
>>
>> My thought for 2.4 is to introduce an apr_vformatter code
>> modifier, '#', into the s syntax.  e.g. %#s would normalize
>> any control codes into \x## or \c syntax, as appropriate.
>> And %#.10s would print a fixed 10 char string including \0
>> characters (a problem I encountered trying to make dumpio
>> a little more efficient).
> 
> It does sound tempting - is there a one-size-fits-all escaping logic, 
> though?  Not sure where you'd stop otherwise... what about non-ASCII 
> characters...  why not have the HTML-escaping logic in there too?  There 
> are what, four different string-escaping routines in httpd now? It's 
> quite a lot of code.

That's my big concern; which size is 'typical'?  I've tried to
get at two underlying concerns; efficiency, and fixed strings
which contain legitimate \0's.

In sprintf, '#' designates alternate, numerical representations.
And in this case that's exactly what we want, mapping of all of
non-printing text into numeric escapes.  Which begs the question,
what is non-printing :-?  So I'm trying not to bend things, that
much, and to conform to any sscanf attribute parser in the compiler.

But immediately offhand, you'll recognize that the single and double
hash quotation marks are common targets for \ escaping, and so the
first question to answer is; what to do with them?

It does seem like vformatter + callout would be a pretty useful
thing as we struggle with this sort of thing.

Bill


Re: ap_error_log bogisity

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Joe Orton wrote:
> (cc'ing dev@apr since that's where the vformatter lives)
> 
> On Thu, Mar 05, 2009 at 12:54:13AM -0600, William Rowe wrote:
>> Trying to come up with ways to process large entries without
>> so much copying.
>>
>> My thought for 2.4 is to introduce an apr_vformatter code
>> modifier, '#', into the s syntax.  e.g. %#s would normalize
>> any control codes into \x## or \c syntax, as appropriate.
>> And %#.10s would print a fixed 10 char string including \0
>> characters (a problem I encountered trying to make dumpio
>> a little more efficient).
> 
> It does sound tempting - is there a one-size-fits-all escaping logic, 
> though?  Not sure where you'd stop otherwise... what about non-ASCII 
> characters...  why not have the HTML-escaping logic in there too?  There 
> are what, four different string-escaping routines in httpd now? It's 
> quite a lot of code.

That's my big concern; which size is 'typical'?  I've tried to
get at two underlying concerns; efficiency, and fixed strings
which contain legitimate \0's.

In sprintf, '#' designates alternate, numerical representations.
And in this case that's exactly what we want, mapping of all of
non-printing text into numeric escapes.  Which begs the question,
what is non-printing :-?  So I'm trying not to bend things, that
much, and to conform to any sscanf attribute parser in the compiler.

But immediately offhand, you'll recognize that the single and double
hash quotation marks are common targets for \ escaping, and so the
first question to answer is; what to do with them?

It does seem like vformatter + callout would be a pretty useful
thing as we struggle with this sort of thing.

Bill