views:

31

answers:

0

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.

related questions