[mod_python] Distinguish http from https?

Deron Meranda deron.meranda at gmail.com
Mon Apr 24 12:48:30 EDT 2006


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



More information about the Mod_python mailing list