bagder: curl-www/dl list_entry.cgi,1.11,1.12 remcheck.pl,1.15,1.16

[email protected]
Newsgroups gmane.comp.web.curl.www.cvs
Message-ID <[email protected]>
Update of /cvsroot/curl/curl-www/dl
In directory labb:/tmp/cvs-serv8507

Modified Files:
	list_entry.cgi remcheck.pl 
Log Message:
the recent fixes


Index: remcheck.pl
===================================================================
RCS file: /cvsroot/curl/curl-www/dl/remcheck.pl,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- remcheck.pl	18 May 2005 10:40:23 -0000	1.15
+++ remcheck.pl	25 May 2005 11:11:20 -0000	1.16
@@ -63,12 +63,20 @@
 sub content_length {
     my (@doc)=@_;
     my $cl;
+    my $stat=0;
 
     if(join("", @doc) =~ /Content-Length: *(\d+)/i) {
         $cl = $1;
+        $stat = 1;
         logmsg " Content-Length: $cl found\n";
     }
-    return $cl;
+    elsif((join("", @doc) =~ /^HTTP\/\d.\d (\d+)/)  && ($1 == 200)) {
+        # still, it return 200 which indicates OK!
+        logmsg " No Content-Length but 200 response-code!\n";
+        $stat = 1;
+    }
+
+    return ($cl, $stat);
 }
 
 sub getlast5versions {
@@ -119,7 +127,7 @@
 my %urlhash;
 sub geturl {
     my ($url, $head) = @_;
-    my $curlcmd="curl -Lfsm20";
+    my $curlcmd="curl -Lfsm120";
 
     if(!$head) {
         my $t = time();
@@ -190,14 +198,12 @@
         next;
     }
     
-    logmsg sprintf "<h2>Package: $desc <a href=\"http://curl.haxx.se/dl/mod_entry.cgi?__id=%s\">edit</a></h2>", $$ref{'__id'};
-    
     my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
         gmtime(time);
     my $t = sprintf ("%02d:%02d:%02d", $hour, $min, $sec);
 
-    logmsg "Time: $t\n";
-
+    logmsg sprintf "<h2>$t $desc <a href=\"http://curl.haxx.se/dl/mod_entry.cgi?__id=%s\">edit</a></h2>", $$ref{'__id'};
+    
     if($$ref{'curl'} eq $version) {
         logmsg " Already at latest version ($version), no need to check\n";
         $uptodate++;
@@ -206,7 +212,7 @@
         logmsg " Local package, no check needed\n";
         $localpackage++;
     }
-    elsif($churl) {
+    elsif($churl && ($churl ne "-")) {
         # there's a URL to check
 
         if(!islast5versions($$ref{'curl'})) {
@@ -229,9 +235,7 @@
         # first unescape HTML encoding
         $churl = CGI::unescapeHTML($churl);
 
-        logmsg sprintf(" Check URL: <a href=\"%s\">%s</a>\n",
-                       CGI::escapeHTML($churl),
-                       CGI::escapeHTML($churl));
+        logmsg sprintf(" Check URL: %s\n", CGI::escapeHTML($churl));
 
         # expand $version!
         if($churl =~ s/\$version/$version/g) {
@@ -241,10 +245,6 @@
         }
         $churl =~ s/\$osversion/$osversion/g;
 
-        logmsg sprintf(" Use URL: <a href=\"%s\">%s</a>\n",
-                       CGI::escapeHTML($churl),
-                       CGI::escapeHTML($churl));
-
         my @data;
 
         if($chregex) {
@@ -299,7 +299,6 @@
                     }
                     else {
                         $uptodate++;
-                        logmsg " NOT updated\n";
                     }
                     last;
                 }
@@ -313,9 +312,11 @@
 
             # store version as of now
             my $ver = $version;
-            my $cl;
+            my $cl, $st;
 
-            if($versionembedded) {
+            ($cl, $st) = content_length(@data);
+
+            if(!$st && $versionembedded) {
                 #
                 # Only scan for older URLs if the $version is part of it
                 #
@@ -325,42 +326,44 @@
                 shift @five; # we already tried the latest
 
                 # while no data was received, try older versions
-                while(!($cl = content_length(@data)) && @five) {
+                while(@five && !$st) {
+
+                    if($ver eq $$ref{'curl'}) {
+                        # no need to scan for older packages than what
+                        # we already have
+                        last;
+                    }
+
                     $ver = shift @five;
                     $churl = $inurl;
                     $churl =~ s/\$version/$ver/g;
                     $churl =~ s/\$osversion/$osversion/g;
                     
-                    logmsg " Retry with version $ver: \"$churl\"\n";
                     @data = geturl($churl, 1);
-
-                    if($ver eq $$ref{'curl'}) {
-                        # no need to scan for older packages than what we
-                        # already have
-                        last;
-                    }
+                    ($cl, $st) = content_length(@data);
                 }
             }
 
-            if(!$cl) {
-                logmsg " <div class\"buildfail\">None of the 5 latest versions found!\n";
-                logmsg " NOT updated</div>\n";
+            if(!$st) {
+                logmsg " <div class=\"buildfail\">None of the 5 latest versions found!</div>\n";
                 $failedcheck++;
                 next;
             }
 
             $$ref{'remcheck'} = timestamp();
 
-            logmsg " Remote version found: $ver\n";
-            logmsg sprintf " Present database version: %s\n", $$ref{'curl'};
+            logmsg " Remote version: <b>$ver</b>\n";
 
             if($versionembedded) {
                 # the version string is embedded in the test URL
                 # so we update the download URL as well!
                 $$ref{'file'}=$churl;
             }
-            # store the size as well since we know it
-            $$ref{'size'}=$cl;
+            # store the size as well if we know it
+            if($cl) {
+                $$ref{'size'}=$cl;
+                logmsg " Store size: $cl bytes\n";
+            }
 
             if($$ref{'curl'} ne $ver) {
                 # TODO: actually store the new version here
@@ -371,7 +374,6 @@
             }
             else {
                 $uptodate++;
-                logmsg " NOT updated\n";
             }
         }
     }
@@ -379,6 +381,7 @@
         logmsg " Package lacks autocheck URL\n";
         $missing++;
     }
+    $db->save();
 }
 
 logmsg "<h1>Summary</h1>\n";

Index: list_entry.cgi
===================================================================
RCS file: /cvsroot/curl/curl-www/dl/list_entry.cgi,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- list_entry.cgi	18 May 2005 07:27:37 -0000	1.11
+++ list_entry.cgi	25 May 2005 11:11:20 -0000	1.12
@@ -96,7 +96,12 @@
            $fi, $$per{'curl'});
     printf("<td>%s", $$per{'hide'} eq "Yes"?"Hide ":"");
 
-    printf("%s</td>", $here?"Local":($$per{'churl'}?"Auto":""));
+    my $churl = $$per{'churl'};
+    if($churl eq "-") {
+        $churl = "";
+    }
+        
+    printf("%s</td>", $here?"Local":($churl?"Auto":""));
 
     if($here || $$per{'churl'}) {
         $auto++;

_______________________________________________
http://cool.haxx.se/mailman/listinfo/curl-www-commits
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.