473,404 Members | 2,170 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

$_SERVER['HTTPS'] - undocumented feature?

Hi All,

I've seen many references to the $_SERVER['HTTPS'] variable, which is set to
the string 'on' when the client is connected via HTTPS rather than regular
HTTP. However, I have been unable to find any references to it in the
official PHP documentation (many times in the user contributed notes,
though).

Often, undocumented features go away with future releases, since "nobody
should have been using them anyway," etc. For this reason I am concerned
about using this variable in order to determine if the client is connected
via HTTPS. Is there a better way? Or should I not be concerned about the
variable disappearing/getting renamed?

Sincerely,
-Josh
Jul 17 '05 #1
4 10126
On Mon, 15 Nov 2004 18:16:34 +0000, Joshua Beall wrote:
Hi All,

I've seen many references to the $_SERVER['HTTPS'] variable, which is set to
the string 'on' when the client is connected via HTTPS rather than regular
HTTP. However, I have been unable to find any references to it in the
official PHP documentation (many times in the user contributed notes,
though).

Often, undocumented features go away with future releases, since "nobody
should have been using them anyway," etc. For this reason I am concerned
about using this variable in order to determine if the client is connected
via HTTPS. Is there a better way? Or should I not be concerned about the
variable disappearing/getting renamed?

Sincerely,
-Josh


Hello Josh,
Please check this page:
http://es2.php.net/reserved.variables

Quote:
"$_SERVER is an array containing information such as headers, paths, and
script locations. The entries in this array are created by the webserver.
There is no guarantee that every webserver will provide any of these;
servers may omit some, or provide others not listed here. That said, a
large number of these variables are accounted for in the CGI 1.1
specification, so you should be able to expect those."

This basically means that PHP itself has nothing to do with this variable,
since it's up to the webserver to set it or not. Apparently mod_ssl does
set this variable, so you would have to watch this module if it changes or
removes the HTTPS environment variable.

One other way would be to check on which port the user is connected to,
usually port 443 is always https--but then again, it doesn't have to be.
So if it was up to me, I would check the $_SERVER['HTTPS'] setting rather
than the port. Just make sure that your scripts are running on servers
that do use mod_ssl.

DrTebi
Jul 17 '05 #2
*** Joshua Beall wrote/escribió (Mon, 15 Nov 2004 18:16:34 GMT):
I've seen many references to the $_SERVER['HTTPS'] variable, which is set to
the string 'on' when the client is connected via HTTPS rather than regular
HTTP. However, I have been unable to find any references to it in the
official PHP documentation (many times in the user contributed notes,
though).


These environment variables are created by the SSL module:

http://www.modssl.org/docs/2.8/ssl_reference.html#ToC25
--
-- Álvaro G. Vicario - Burgos, Spain
-- Thank you for not e-mailing me your questions
--
Jul 17 '05 #3
"Joshua Beall" <jb****@donotspam.remove.me.heraldic.us> wrote in message
news:6o6md.7395$pP5.5571@trnddc05...
Hi All,

I've seen many references to the $_SERVER['HTTPS'] variable, which is set to the string 'on' when the client is connected via HTTPS rather than regular
HTTP. However, I have been unable to find any references to it in the
official PHP documentation (many times in the user contributed notes,
though).

Often, undocumented features go away with future releases, since "nobody
should have been using them anyway," etc. For this reason I am concerned
about using this variable in order to determine if the client is connected
via HTTPS. Is there a better way? Or should I not be concerned about the
variable disappearing/getting renamed?


$_SERVER entries are set by the web server. The HTTPS element is set by
Apache modssl. You can find that documented here
(http://www.modssl.org/docs/2.8/ssl_reference.html#ToC25) which I found by
looking in the notes attached to the $_SERVER variable documentation at
(http://us2.php.net/manual/en/reserve...variables.serv
er)

- Virgil
Jul 17 '05 #4
Dear sir,

https means if your host is a secure server, not the client is connected via
https. it is not undocumented and it is visible in the phpinfo().
$_SERVER['HTTPS'] merely mentions if the server is secure or not and
effectively you can use the server as a secure server.

people do use it and it is an important function. otherwise they would not
have it there.

i think if variables disappear, they are not needed in the first place. at
this moment, i do not think it is any reason to panic.

thanking you

sumeet shroff
"Joshua Beall" <jb****@donotspam.remove.me.heraldic.us> wrote in message
news:6o6md.7395$pP5.5571@trnddc05...
Hi All,

I've seen many references to the $_SERVER['HTTPS'] variable, which is set to the string 'on' when the client is connected via HTTPS rather than regular
HTTP. However, I have been unable to find any references to it in the
official PHP documentation (many times in the user contributed notes,
though).

Often, undocumented features go away with future releases, since "nobody
should have been using them anyway," etc. For this reason I am concerned
about using this variable in order to determine if the client is connected
via HTTPS. Is there a better way? Or should I not be concerned about the
variable disappearing/getting renamed?

Sincerely,
-Josh

Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Phil Powell | last post by:
echo "val = $val<P>"; list($mySection, $myDisplay) = explode('|', $val); echo "mySection = $mySection and myDisplay = $myDisplay<P>"; In using PHP 4.3.6 here are my results: I narrowed...
0
by: Darrell Sparti, MCSD | last post by:
There have been many postings about this subject on this newsgroup. Unfortunately, they're incorrect. You can't just cast a value in C# and have it work for all ASCII characters. Nor can you use...
6
by: Steven Bethard | last post by:
So I've recently been making pretty frequent use of textwrap.dedent() to allow me to use triple-quoted strings at indented levels of code without getting the extra spaces prefixed to each line. I...
30
by: Raymond Hettinger | last post by:
Proposal -------- I am gathering data to evaluate a request for an alternate version of itertools.izip() with a None fill-in feature like that for the built-in map() function: >>> map(None,...
12
by: Raymond Hettinger | last post by:
I am evaluating a request for an alternate version of itertools.izip() that has a None fill-in feature like the built-in map function: >>> map(None, 'abc', '12345') # demonstrate map's None...
8
by: Terry | last post by:
I have noiticed a change in behavior between VB6 and VB.Net (2003 and 2005) that I don't find documented anywhere. It has to do with 'causesvalidation' and the button on the Form defined to be the...
6
by: Antonio Paglia | last post by:
Hello. I have tried to insert this items into a SortedList. dic = New SortedList dic.Add("<<", "<<") dic.Add("==", "==") dic.Add(">>", ">>") dic.Add("@@", "@@") dic.Add("??", "??") ...
0
bartonc
by: bartonc | last post by:
This article documents some Boa Constructor features as I discover them. Here is the first handy feature that I find very useful: Hold down Ctrl and put the I-Beam cursor over a variable defined...
1
by: Michele Simionato | last post by:
I see that the pkgutil module has many useful functions which are however undocumented. Does anybody know why it is so? In particolar, can I safely use pkg.walk_packages without risking a change...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.