Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/lib/WineTestBot/Utils.pm | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
diff --git a/testbot/lib/WineTestBot/Utils.pm b/testbot/lib/WineTestBot/Utils.pm index 5315c75d4..d93a938d3 100644 --- a/testbot/lib/WineTestBot/Utils.pm +++ b/testbot/lib/WineTestBot/Utils.pm @@ -42,11 +42,38 @@ use WineTestBot::Config; # Web helpers #
+=pod +=over 12 + +=item C<SecureConnection()> + +Returns true if the user accessed the website over a secure connection. + +This relies on the web server setting the $HTTPS environment variable. + +=back +=cut + sub SecureConnection() { return defined($ENV{"HTTPS"}) && $ENV{"HTTPS"} eq "on"; }
+=pod +=over 12 + +=item C<MakeSecureURL()> + +Builds a URL that accesses this website using https if possible. +The parameter should be an absolute path that includes neither the protocol +nor the hostname. + +Note that this method uses $HTTP_HOST which may not match the official website +hostname. As such this should only be used for providing URLs back to the user +accessing the website, not for URLs sent to third-parties. + +=back +=cut sub MakeSecureURL($) { my ($URL) = @_;