WineHQ: More service CGI work

Dimitrie O. Paun dimi at intelliware.ca
Wed May 5 13:07:40 CDT 2004


Jer,

I may also need a bit your help and expertise for this one.
I seem have problems with the CGI module, even though I'm
using it in the same manner as winetest.cgi (which works
perfectly!). It doesn't seem to recognize any parameters
on the URL. Any help much appreciated.

ChangeLog
    Dimitrie O. Paun <dpaun at rogers.com>
    Switch from the object style to the functional style
    for the CGI.pm module for consistency with the other CGIs.
    Fix the error reporting part to read the file properly.

-- 
Dimi.
-------------- next part --------------
Index: winetest/service.cgi
===================================================================
RCS file: /home/wine/tools/winetest/service.cgi,v
retrieving revision 1.16
diff -u -r1.16 service.cgi
--- winetest/service.cgi	4 May 2004 22:00:12 -0000	1.16
+++ winetest/service.cgi	5 May 2004 18:03:23 -0000
@@ -40,10 +40,9 @@
 #			winrash clients can download, must be writable
 
 use Digest::MD5;
-use CGI;
+use CGI qw(:standard);
 $CGI::POST_MAX = 50 * 1024;
 
-$query = new CGI;
 $data_root="/home/winehq/opt/winetest";
 $lynx="/usr/bin/lynx";
 @valid_programs=("winrash", "winetest");
@@ -53,18 +52,15 @@
 sub main {
     my $build, $urls, $cookies;
 
+    print "Content-type: text/plain\n\n";
+
     # first check for errors
-    my $error = $query->cgi_error;
+    my $error = cgi_error ();
     if ($error) {
-	print $query->header(-status=>$error),
-	      $query->start_html('Problems'),
-              $query->h2('Request not processed'),
-	      $query->strong($error);
-        exit 0;
+	print $error;
+        exit;
     }
 
-    print "Content-type: text/plain\n\n";
-
     # this next bit is strictly for winrash clients doing error reporting
     # we could build it into a separate script but it's not really worth it
     if ($ENV{"REQUEST_URI"} =~ "error=true" && 
@@ -74,7 +70,7 @@
         exit;
     }
 
-    my $publish = $query->param('publish');
+    my $publish = param('publish');
     if ($publish) {
         my $response = &releases_make($publish);
         print "$response\n";
@@ -84,9 +80,9 @@
     # for each of the programs we know about, see if they need an update
     foreach $program (@valid_programs) {
         ($build, $urls, $cookies) = &releases_read($program);
-        if ($query->param($program)) {
-	    my @history = split(/,/, $query->param("$program" . "_history"));
-	    push (@history, $query->param($program));
+        if (param($program)) {
+	    my @history = split(/,/, param("$program" . "_history"));
+	    push (@history, param($program));
 	    foreach (@history) {
 	        delete $$urls{$_};
 	        delete $$cookies{$_};
@@ -267,7 +263,7 @@
 	print "unzip $name\n";
 	$name =~ s/zip/exe/g;
     }
-    $id = $query->param('id');
+    $id = param('id');
     print "run $name -c -t $id -u $url\n";
 
     # wait just 5min, we may have other stuff to execute right away
@@ -282,7 +278,10 @@
     print MAIL "Reply-To: wine-devel\@winehq.org\n";
     print MAIL "Subject: [ERROR] winetest error report\n";
     print MAIL "\n";
-    print MAIL $query->param('POSTDATA');
+    my $fh = upload('reportfile');
+    while (<$fh>) {
+	print;
+    }
     close(MAIL);
 }
 
@@ -295,7 +294,7 @@
 
 # print a message if debugging is enabled
 sub debug {
-    if ($query->param('debug')) {
+    if (param('debug')) {
         print "$_[0]\n";
     }
 }


More information about the wine-patches mailing list