Perl SSL Variable

J

Josh Harlan

Hello,

I am running a perl program in an unsecure directory and I would like
to know if there is an environmental variable or equivalent that will
display the SSL path (e.g. "https://ssl.website.com" or
"ssl.website.com"). Unfortunately, "https://ssl.$ENV{'SERVER_NAME'}"
will not work as the website domain and the SSL domain are not related
since I have a shared SSL. I know how to determine the SSL path while
in a secure directory by using $ENV{'HTTP_X_FORWARDED_SERVER'}, but
not when in a unsecure directory.


Thanks for any help,
Josh
 
A

Andras Malatinszky

Josh said:
Hello,

I am running a perl program in an unsecure directory and I would like
to know if there is an environmental variable or equivalent that will
display the SSL path (e.g. "https://ssl.website.com" or
"ssl.website.com").

This really has nothing to do with Perl and everything to do with your
web server.
 
B

Big and Blue

Josh said:
I am running a perl program in an unsecure directory and I would like
to know if there is an environmental variable or equivalent

So, as has been noted, nothing to do with Perl, actually something to
do (probably) how CGI works.
that will
display the SSL path (e.g. "https://ssl.website.com" or
"ssl.website.com"). Unfortunately, "https://ssl.$ENV{'SERVER_NAME'}"
will not work as the website domain and the SSL domain are not related
since I have a shared SSL.

Shouldn't matter - the SERVER_NAME should be set to the name of the
server handling the call. If it isn't you could configure the server
(using virtual hosts) so that it is.

If you are using Apache you will probably find that the HTTP headers
are passed on, and the server name which was used by the client to get to
you will be in teh Host: header, so look for the value of $ENV{'HTTP_HOST'}.

Of course, *all* of this is dependent on the Web server you are
actually using and how it has been configured.

You could always try a simple approach and add a short script to you
Web server which just echoes all of the keys in %ENV (and their values)
(just needs to be text/plain output) and see which, if any, of them
contains the info you want.
 
A

Alan J. Flavell

So, as has been noted, nothing to do with Perl, actually something to
do (probably) how CGI works.

CGI is an interworking specification. Nothing specific to Perl,
though, as you rightly say.
Of course, *all* of this is dependent on the Web server you are
actually using and how it has been configured.

If it's part of the CGI specification, it's not allowed to be
dependent on the Web server. You'd have to be a monopoly vendor to be
able to get away with disregarding that.

So which is it? - except that the answer is also off-topic here :-}
You could always try a simple approach and add a short script to you
Web server which just echoes all of the keys in %ENV (and their values)

Well, you _could_, but if you want to develop something reliable,
perhaps you'd do better to read the interworking specification to find
out what it does (and more importantly, does not) require the server
to do.

If (for whatever reason) you want it to work not only with
interworking software but also with a certain monopoly vendor, then
you'd have a bit more work to do.

But it would be no different in principle if you were developing your
server-side software in COBOL or whatever. So we're still in the
wrong place to discuss those aspects.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
474,142
Messages
2,570,819
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top