You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-dev@httpd.apache.org by Joe Schaefer <jo...@sunstarsys.com> on 2005/08/22 03:11:59 UTC

cleaning up url_decode

In its current form, the internal url_decode() function is a total mess.
Besides simple url-decoding, it does charset divination. It turns out to 
be a lot cleaner to do the divination *after* decoding (not *during*), 
so I'd like to propose a new function

apreq_charset_t apreq_divine_charset (unsigned const char *s, apr_size_t slen)

that does the same logic, but on the decoded string.

The current APIs for apreq_decode and apreq_decodev don't need to change
because of this (only one current test result needs "fixing").

-- 
Joe Schaefer


Re: cleaning up url_decode

Posted by Joe Schaefer <jo...@sunstarsys.com>.
"Philip M. Gollucci" <pg...@p6m7g8.com> writes:

> I agree with the idea...
>
> Kudos on the function name.

Oops, it doesn't follow our naming conventions tho, so I better
change it to apreq_charset_divine.  The other upshot to having
a public function available, is that we no longer have to monkey
around with charset info as an offset in the return value of 
apreq_decode(v).  Instead, the caller can just run apreq_charset_divine 
on a decoded string to get the same information in a much cleaner way.

-- 
Joe Schaefer


Re: cleaning up url_decode

Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
Joe Schaefer wrote:
> In its current form, the internal url_decode() function is a total mess.
> Besides simple url-decoding, it does charset divination. It turns out to 
> be a lot cleaner to do the divination *after* decoding (not *during*), 
> so I'd like to propose a new function
> 
> apreq_charset_t apreq_divine_charset (unsigned const char *s, apr_size_t slen)
> 
> that does the same logic, but on the decoded string.
> 
> The current APIs for apreq_decode and apreq_decodev don't need to change
> because of this (only one current test result needs "fixing").
> 
I agree with the idea...

Kudos on the function name.



-- 
END
------------------------------------------------------------
     What doesn't kill us can only make us stronger.
                 Nothing is impossible.
				
Philip M. Gollucci (pgollucci@p6m7g8.com) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
   http://www.liquidityservicesinc.com
        http://www.liquidation.com
        http://www.uksurplus.com
        http://www.govliquidation.com
        http://www.gowholesale.com