You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Matthew Rushton <mr...@yahoo.com> on 2009/02/21 07:57:19 UTC

uri encoding/decoding

Hi,
  Anyone know of any uri query string encoding/decoding functions that exist to module writers. I'm about to write my own which should be simple enough just didn't want to reinvent the wheel. I couldn't find any that existed. Thanks!
-Matt



      

Re: uri encoding/decoding

Posted by Matthew Rushton <mr...@yahoo.com>.
thanks...
ap_unescape_url() does make things easier. it still doesn't seem like there is an easy way of fully parsing the query string (i.e. getting a value from a field). I wrote a quick little function that does it but it would seem useful to have something there, it seems like a common need.
-Matt

--- On Sat, 2/21/09, Nick Kew <ni...@webthing.com> wrote:
From: Nick Kew <ni...@webthing.com>
Subject: Re: uri encoding/decoding
To: dev@httpd.apache.org
Date: Saturday, February 21, 2009, 4:30 PM

On Sat, 21 Feb 2009 13:48:10 +0200
Graham Leggett <mi...@sharp.fm> wrote:

> Matthew Rushton wrote:
> > Hi,
> >   Anyone know of any uri query string encoding/decoding functions
> > that exist to module writers. I'm about to write my own which
> > should be simple enough just didn't want to reinvent the wheel. I
> > couldn't find any that existed. Thanks!
> 
> One of these should do the trick:

Alternatively, look in apr_uri.  An apache module has access to
everything in apr and apr-util.

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/



      

Re: uri encoding/decoding

Posted by Nick Kew <ni...@webthing.com>.
On Sat, 21 Feb 2009 13:48:10 +0200
Graham Leggett <mi...@sharp.fm> wrote:

> Matthew Rushton wrote:
> > Hi,
> >   Anyone know of any uri query string encoding/decoding functions
> > that exist to module writers. I'm about to write my own which
> > should be simple enough just didn't want to reinvent the wheel. I
> > couldn't find any that existed. Thanks!
> 
> One of these should do the trick:

Alternatively, look in apr_uri.  An apache module has access to
everything in apr and apr-util.

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/

Re: uri encoding/decoding

Posted by Graham Leggett <mi...@sharp.fm>.
Matthew Rushton wrote:
> Hi,
>   Anyone know of any uri query string encoding/decoding functions that 
> exist to module writers. I'm about to write my own which should be 
> simple enough just didn't want to reinvent the wheel. I couldn't find 
> any that existed. Thanks!

One of these should do the trick:

httpd.h:AP_DECLARE(int) ap_unescape_url(char *url);
httpd.h:AP_DECLARE(int) ap_unescape_url_keep2f(char *url);
httpd.h:AP_DECLARE(char *) ap_escape_path_segment(apr_pool_t *p, const 
char *s);
httpd.h:AP_DECLARE(char *) ap_os_escape_path(apr_pool_t *p, const char 
*path, int partial);
httpd.h:#define ap_escape_uri(ppool,path) ap_os_escape_path(ppool,path,1)
httpd.h:AP_DECLARE(char *) ap_escape_html(apr_pool_t *p, const char *s);

Regards,
Graham
--