You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Frank Jones <jo...@gmail.com> on 2007/06/01 16:53:30 UTC

URL encoding/decoding

Is there a function in the APR or elsewhere that performs URL
encoding/decoding (aka percent-encoding)? I've searched all over for
one but haven't found anything. mod_security has these functions but
it doesn't export them for some reason.

Re: URL encoding/decoding

Posted by Frank Jones <jo...@gmail.com>.
On 6/1/07, Brian McQueen <mc...@gmail.com> wrote:
> I use it all the time with 2.2.3:
>
> http://httpd.apache.org/apreq/
>
> Its libapreq2.

OK. I just downloaded and installed libapreq2 on Ubuntu and Windows
XP. Despite the installation being a lot more "exciting" than I hoped
it would be (numerous dependencies, weird cpan hangups on Windows,
etc) I appear to have a working mod_apreq2 on both platforms.
Altogether I'm guessing that I have invested about 2 hours, so I
sincerely hope that mod_apreq2 turns out to be a worthwhile
investment!

Re: URL encoding/decoding

Posted by Brian McQueen <mc...@gmail.com>.
I use it all the time with 2.2.3:

http://httpd.apache.org/apreq/

Its libapreq2.

On 6/1/07, Frank Jones <jo...@gmail.com> wrote:
> On 6/1/07, Brian McQueen <mc...@gmail.com> wrote:
> > The Apache apreq libraries have that stuff:
> >
> > include/apreq2/apreq_util.h:APREQ_DECLARE(apr_size_t) apreq_encode(char *dest...
> >
> > include/apreq2/apreq_util.h:APREQ_DECLARE(apr_status_t)
> > apreq_decode(char *dest...
> >
> > The apreq tools are pretty useful.
>
> Thanks! This is exactly what I have been looking for. Unfortunately it
> appears not to be available for Apache 2.2.x yet. Oh well.
>

Re: URL encoding/decoding

Posted by Frank Jones <jo...@gmail.com>.
On 6/1/07, Brian McQueen <mc...@gmail.com> wrote:
> The Apache apreq libraries have that stuff:
>
> include/apreq2/apreq_util.h:APREQ_DECLARE(apr_size_t) apreq_encode(char *dest...
>
> include/apreq2/apreq_util.h:APREQ_DECLARE(apr_status_t)
> apreq_decode(char *dest...
>
> The apreq tools are pretty useful.

Thanks! This is exactly what I have been looking for. Unfortunately it
appears not to be available for Apache 2.2.x yet. Oh well.

Re: URL encoding/decoding

Posted by Brian McQueen <mc...@gmail.com>.
The Apache apreq libraries have that stuff:

include/apreq2/apreq_util.h:APREQ_DECLARE(apr_size_t) apreq_encode(char *dest...

include/apreq2/apreq_util.h:APREQ_DECLARE(apr_status_t)
apreq_decode(char *dest...

The apreq tools are pretty useful.

On 6/1/07, Frank Jones <jo...@gmail.com> wrote:
> On 6/1/07, Tim Bray <Ti...@sun.com> wrote:
> >
> > On Jun 1, 2007, at 7:53 AM, Frank Jones wrote:
> >
> > > Is there a function in the APR or elsewhere that performs URL
> > > encoding/decoding (aka percent-encoding)? I've searched all over for
> > > one but haven't found anything. mod_security has these functions but
> > > it doesn't export them for some reason.
> >
> > It takes about 20 lines of code to implement.  -Tim
>
> Yeah, I know. I almost put a disclaimer on my original question that I
> knew this was an easy function to write. strlen is also a very easy
> function to write, but I prefer not to reinvent wheels, even very
> small ones :)
>
> It just seems a little strange to me that this kind of functionality,
> which I suppose most module developers need, and which you correctly
> point out is so easily implemented, is not provided by the APR.
>

Re: URL encoding/decoding

Posted by Frank Jones <jo...@gmail.com>.
On 6/1/07, Tim Bray <Ti...@sun.com> wrote:
>
> On Jun 1, 2007, at 7:53 AM, Frank Jones wrote:
>
> > Is there a function in the APR or elsewhere that performs URL
> > encoding/decoding (aka percent-encoding)? I've searched all over for
> > one but haven't found anything. mod_security has these functions but
> > it doesn't export them for some reason.
>
> It takes about 20 lines of code to implement.  -Tim

Yeah, I know. I almost put a disclaimer on my original question that I
knew this was an easy function to write. strlen is also a very easy
function to write, but I prefer not to reinvent wheels, even very
small ones :)

It just seems a little strange to me that this kind of functionality,
which I suppose most module developers need, and which you correctly
point out is so easily implemented, is not provided by the APR.

Re: URL encoding/decoding

Posted by Tim Bray <Ti...@Sun.COM>.
On Jun 1, 2007, at 7:53 AM, Frank Jones wrote:

> Is there a function in the APR or elsewhere that performs URL
> encoding/decoding (aka percent-encoding)? I've searched all over for
> one but haven't found anything. mod_security has these functions but
> it doesn't export them for some reason.

It takes about 20 lines of code to implement.  -Tim