You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-dev@quetz.apache.org by Graham Dumpleton <gr...@dscpl.com.au> on 2006/02/16 22:14:25 UTC
Constructing of a URL for location redirect.
Just sending this while I remember ...
A while back there was long discussion on constructing a URL for
location
redirect. While digging through Apache stuff, I stumbled across the
function:
ap_construct_url()
This takes an absolute path and constructs a full URL based on
information
Apache knows about request.
Does this Apache function perhaps do what was wanted, or is it going to
have the same issues as was discussed before whereby certain cases
wouldn't work?
If it works, just need to expose it in the request object.
See notes about thus function in:
http://www.kuzbass.ru/docs/apache_c_mod_perl/158.htm
Graham
Re: Constructing of a URL for location redirect.
Posted by Jim Gallacher <jp...@jgassociates.ca>.
Nick wrote:
> Gregory (Grisha) Trubetskoy wrote:
>
>>SWIG in my opinion is good when you want some kind of an API made
>>available to you quickly, but in a static environment where can put some
>>thought into functionality, usability, Pythonic-ness of every approach,
>>write documentation with good examples and a meaningful test case SWIG
>>does not buy much.
>>
>>If someone just wanted to map the APR to Python - they can always use
>>SWIG, but that's not what mod_python is about.
>
>
> All true; mod_python is a layer up from the apache API, so there's no way
> the SWIGed API could come close to replacing it. I just found it generally
> more convenient to work in Python rather than C, even if it's only a thin
> layer above that, and I think there is some merit to using it in some
> places, carefully wrapped in a Python class or module.
>
> That said, I don't really see mod_python changing so radically at this point
> in the game. It's fun to think about, though. :) In a masochistic kind of way.
We could always try to convince the ASF to rewrite apache in PyPy. :)
Jim
Re: Constructing of a URL for location redirect.
Posted by Nick <ni...@dd.revealed.net>.
Gregory (Grisha) Trubetskoy wrote:
> SWIG in my opinion is good when you want some kind of an API made
> available to you quickly, but in a static environment where can put some
> thought into functionality, usability, Pythonic-ness of every approach,
> write documentation with good examples and a meaningful test case SWIG
> does not buy much.
>
> If someone just wanted to map the APR to Python - they can always use
> SWIG, but that's not what mod_python is about.
All true; mod_python is a layer up from the apache API, so there's no way
the SWIGed API could come close to replacing it. I just found it generally
more convenient to work in Python rather than C, even if it's only a thin
layer above that, and I think there is some merit to using it in some
places, carefully wrapped in a Python class or module.
That said, I don't really see mod_python changing so radically at this point
in the game. It's fun to think about, though. :) In a masochistic kind of way.
Nick
Re: Constructing of a URL for location redirect.
Posted by "Gregory (Grisha) Trubetskoy" <gr...@apache.org>.
On Thu, 16 Feb 2006, Nick wrote:
> Nicolas Lehuen wrote:
>> BTW, did we ever considered using SWIG to map the Apache API ? I know
>> it can be quite tricky to use, but it could be a real time saver.
>
> That's essentially what mod_snake did, and why I liked it so much. Though I
> don't remember if it used swig or pyrex.
It used SWIG. I'm -1 on using SWIG, I like the hand-crafted quality of
mod_python.
SWIG in my opinion is good when you want some kind of an API made
available to you quickly, but in a static environment where can put some
thought into functionality, usability, Pythonic-ness of every approach,
write documentation with good examples and a meaningful test case SWIG
does not buy much.
If someone just wanted to map the APR to Python - they can always use
SWIG, but that's not what mod_python is about.
Grisha
Re: Constructing of a URL for location redirect.
Posted by Nick <ni...@dd.revealed.net>.
Nicolas Lehuen wrote:
> BTW, did we ever considered using SWIG to map the Apache API ? I know
> it can be quite tricky to use, but it could be a real time saver.
That's essentially what mod_snake did, and why I liked it so much. Though I
don't remember if it used swig or pyrex.
Nick
Re: Constructing of a URL for location redirect.
Posted by Nicolas Lehuen <ni...@lehuen.com>.
It looks good, which proves the power of RTFM. We should test it, of
course, to make sure subtleties like virtual host are taken into
account (the doc says so but the code knows better).
BTW, did we ever considered using SWIG to map the Apache API ? I know
it can be quite tricky to use, but it could be a real time saver.
Regards,
Nicolas
2006/2/16, Graham Dumpleton <gr...@dscpl.com.au>:
> Just sending this while I remember ...
>
> A while back there was long discussion on constructing a URL for
> location
> redirect. While digging through Apache stuff, I stumbled across the
> function:
>
> ap_construct_url()
>
> This takes an absolute path and constructs a full URL based on
> information
> Apache knows about request.
>
> Does this Apache function perhaps do what was wanted, or is it going to
> have the same issues as was discussed before whereby certain cases
> wouldn't work?
>
> If it works, just need to expose it in the request object.
>
> See notes about thus function in:
>
> http://www.kuzbass.ru/docs/apache_c_mod_perl/158.htm
>
> Graham
>
>
>