Re: [Cppcms-users] HTTPS CGI variable retrieving function
Brought to you by:
artyom-beilis
From: Artyom <art...@ya...> - 2010-07-01 08:51:35
|
> If I can remember correctly it was possible in the old cppcms version to > find out easily if a request came over http or https. HTTPs check function was available via CgiCC library, but its implementation is Apache specific. See: http://httpd.apache.org/docs/2.0/mod/mod_ssl.html What this function does, it checks that HTTPS environment variable is set or (under Windows) it is set to "ON". This is generally not correct solution and should not be used in portable software. You may use getenv but you should understand that this is Apache specific. The only portable way I think you can do this is to check server_port()==431 or other predefined value that you know that web server uses for https protocol. But as you understand this require from the developer to be aware of web server port. You may just put it into you configuration and check like this: if(server_port() == settings().get<int>("my_application.web_servers_https_port")) { // we on https } So, this CgiCC "feature" is rather "bug" as its implementation is incorrect and may mislead you. Regards, Artyom |