Re: determine if mod called via ssl request

2010-09-24 Thread J.D. Mullin
I'll give that a try. thanks Ben.

On Tue, Sep 21, 2010 at 9:38 AM, Ben Noordhuis i...@bnoordhuis.nl wrote:

 On Tue, Sep 21, 2010 at 17:24, J.D. Mullin jeremym1...@cableone.net
 wrote:
  It seems like I am missing some very simple way to tell if the request
 was
  made via https, but I have scanned all of the structures available from
 the
  request_rec and I don't see anything obvious.

 const char *flag = getenv(HTTPS);
 if (flag  !strcmp(flag, on)) {
// HTTPS-only logic
 }



determine if mod called via ssl request

2010-09-21 Thread J.D. Mullin
I posted this question on Stack Overflow here:
http://stackoverflow.com/questions/3612957/how-can-my-apache-2-module-tell-if-it-is-being-called-via-an-ssl-request

For those not interested in using or reading SO, I'm including the question
below. Any help would be appreciated:

I have a module that needs to return a reference URI in its payload. If
called via an SSL connection, I need to build a URI that has the https
prefix. I can easily get the port number from the request, but the problem
is the user could have picked any port for SSL (and in fact this particular
Apache instance always starts out with a non-standard SSL port).

All of the parsed URI's in the request structure already have the http/https
prefix removed. I'm contemplating resorting to the r-server-defn_name
field, which actually has the conf file for the request's virtual server in
it. If I see that ends with httpd-ssl.conf, I can guess this is an SSL
connection. Still feels like a hack, and in reality the user could name that
conf file something else too, which would break this approach.

Another approach would be to read the config file and find the SSL
VirtualHost Listen port, but I haven't been able to accomplish this either.

It seems like I am missing some very simple way to tell if the request was
made via https, but I have scanned all of the structures available from the
request_rec and I don't see anything obvious.


Re: determine if mod called via ssl request

2010-09-21 Thread Ben Noordhuis
On Tue, Sep 21, 2010 at 17:24, J.D. Mullin jeremym1...@cableone.net wrote:
 It seems like I am missing some very simple way to tell if the request was
 made via https, but I have scanned all of the structures available from the
 request_rec and I don't see anything obvious.

const char *flag = getenv(HTTPS);
if (flag  !strcmp(flag, on)) {
// HTTPS-only logic
}