|
Glenn Hochberg
gah at research.att.com
Tue Apr 25 12:21:25 EDT 2006
One (admittedly somewhat klugey) solution is to add:
PythonOption ssl on
to your ssl VirtualHost container (i.e. typically in ssl.conf), and
then test for this option in your mod_python code, e.g.:
url = 'http://'
if req.get_options().has_key('ssl'): url = 'https://'
This is what I've been using for some time, but it's great to know
that something less config-intrusive will be available in future.
--Glenn
On 4/24/06, Deron Meranda <deron.meranda at gmail.com> wrote:
> On 4/24/06, Dan Eloff <dan.eloff at gmail.com> wrote:
>
>> How can you determine if the request is associated with an http
>> request or an https request?
>>
>> I thought maybe one could use unparsed_uri, but I don't think it has
>> to begin with http or https.
>>
>
> When 3.2.9 is released it will have more direct support for all things
> TLS/SSL, including a function req.is_https(). You can read up on
> what's coming (as well as some info on workarounds until then) by
> reading:
> http://issues.apache.org/jira/browse/MODPYTHON-94
>
> Until then you must devise your own methods. If you're working
> in the content phase you can probably just look for the HTTPS
> environment variable.
>
> if req.subprocess_env.get('HTTPS') == 'on':
>
> You may need to call req.add_common_vars() first. Experiment.
>
> If you're doing this in an auth phase you can't use the above.
> --
> Deron Meranda
>
|