Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/lib/WineTestBot/Utils.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/testbot/lib/WineTestBot/Utils.pm b/testbot/lib/WineTestBot/Utils.pm index 309fb19ce..25c60d53f 100644 --- a/testbot/lib/WineTestBot/Utils.pm +++ b/testbot/lib/WineTestBot/Utils.pm @@ -27,7 +27,7 @@ WineTestBot::Utils - Utility functions =cut
use Exporter 'import'; -our @EXPORT = qw(MakeSecureURL SecureConnection GenerateRandomString +our @EXPORT = qw(SecureConnection MakeSecureURL GenerateRandomString OpenNewFile CreateNewFile CreateNewLink CreateNewDir GetMTime DurationToString BuildEMailRecipient IsValidFileName BuildTag SanitizeTag LocaleName NotifyAdministrator @@ -42,6 +42,11 @@ use WineTestBot::Config; # Web helpers #
+sub SecureConnection() +{ + return defined($ENV{"HTTPS"}) && $ENV{"HTTPS"} eq "on"; +} + sub MakeSecureURL($) { my ($URL) = @_; @@ -55,11 +60,6 @@ sub MakeSecureURL($) return $Protocol . "://" . $ENV{"HTTP_HOST"} . $URL; }
-sub SecureConnection() -{ - return defined($ENV{"HTTPS"}) && $ENV{"HTTPS"} eq "on"; -} - sub DurationToString($;$) { my ($Secs, $Raw) = @_;
This allows using MakeSecureURL() outside the CGI scripts.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/lib/WineTestBot/Utils.pm | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/testbot/lib/WineTestBot/Utils.pm b/testbot/lib/WineTestBot/Utils.pm index 25c60d53f..63e8f5328 100644 --- a/testbot/lib/WineTestBot/Utils.pm +++ b/testbot/lib/WineTestBot/Utils.pm @@ -51,13 +51,8 @@ sub MakeSecureURL($) { my ($URL) = @_;
- my $Protocol = "http"; - if ($UseSSL || SecureConnection()) - { - $Protocol .= "s"; - } - - return $Protocol . "://" . $ENV{"HTTP_HOST"} . $URL; + my $Protocol = ($UseSSL || SecureConnection()) ? "https://" : "http://"; + return $Protocol . ($ENV{"HTTP_HOST"} || $WebHostName) . $URL; }
sub DurationToString($;$)
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/bin/WineRunTask.pl | 4 ++-- testbot/bin/WineRunWineTest.pl | 4 ++-- testbot/lib/WineTestBot/Utils.pm | 12 +++++++++++- 3 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/testbot/bin/WineRunTask.pl b/testbot/bin/WineRunTask.pl index d987df7df..df9fcad0e 100755 --- a/testbot/bin/WineRunTask.pl +++ b/testbot/bin/WineRunTask.pl @@ -467,8 +467,8 @@ elsif ($Step->Type eq "suite") $Script .= "$FileName "; if (defined($WebHostName)) { - my $StepTask = 100 * $StepNo + $TaskNo; - $Script .= "-u "http://$WebHostName/JobDetails.pl?Key=$JobId&s$StepTask=1#k$StepTask%5C" "; + my $URL = GetTaskURL($JobId, $StepNo, $TaskNo, 1); + $Script .= "-u ". BatchQuote(MakeSecureURL($URL)) ." "; } my $Tag = $VM->Type ne "win64" ? "" : $Step->FileType eq "exe64" ? "64" : "32"; $Tag = BuildTag($VM->Name, $Tag); diff --git a/testbot/bin/WineRunWineTest.pl b/testbot/bin/WineRunWineTest.pl index 514c57cda..79d7519de 100755 --- a/testbot/bin/WineRunWineTest.pl +++ b/testbot/bin/WineRunWineTest.pl @@ -443,8 +443,8 @@ if ($Step->Type eq "suite") $Script .= "--winetest ". ShQuote($Task->Missions) ." $BaseTag "; if (defined $WebHostName) { - my $StepTask = 100 * $StepNo + $TaskNo; - $Script .= "-u "http://$WebHostName/JobDetails.pl?Key=$JobId&s$StepTask=1#k$StepTask%5C" "; + my $URL = GetTaskURL($JobId, $StepNo, $TaskNo, 1); + $Script .= "-u ". ShQuote(MakeSecureURL($URL)) ." "; } my $Info = $VM->Description ? $VM->Description : ""; if ($VM->Details) diff --git a/testbot/lib/WineTestBot/Utils.pm b/testbot/lib/WineTestBot/Utils.pm index 63e8f5328..e8ba5162d 100644 --- a/testbot/lib/WineTestBot/Utils.pm +++ b/testbot/lib/WineTestBot/Utils.pm @@ -27,7 +27,7 @@ WineTestBot::Utils - Utility functions =cut
use Exporter 'import'; -our @EXPORT = qw(SecureConnection MakeSecureURL GenerateRandomString +our @EXPORT = qw(SecureConnection MakeSecureURL GetTaskURL GenerateRandomString OpenNewFile CreateNewFile CreateNewLink CreateNewDir GetMTime DurationToString BuildEMailRecipient IsValidFileName BuildTag SanitizeTag LocaleName NotifyAdministrator @@ -55,6 +55,16 @@ sub MakeSecureURL($) return $Protocol . ($ENV{"HTTP_HOST"} || $WebHostName) . $URL; }
+sub GetTaskURL($$$;$$) +{ + my ($JobId, $StepNo, $TaskNo, $ShowScreenshot, $ShowLog) = @_; + my $StepTask = 100 * $StepNo + $TaskNo; + my $URL = "/JobDetails.pl?Key=$JobId"; + $URL .= "&s$StepTask=1" if ($ShowScreenshot); + $URL .= "&f$StepTask=$ShowLog" if ($ShowLog); + return "$URL#k$StepTask"; +} + sub DurationToString($;$) { my ($Secs, $Raw) = @_;