OpenPKG CVS Repository
http://cvs.openpkg.org/
____________________________________________________________________________
Server: cvs.openpkg.org Name: Thomas Lotterer
Root: /v/openpkg/cvs Email: [EMAIL PROTECTED]
Module: openpkg-registry Date: 05-Jul-2006 17:37:55
Branch: HEAD Handle: 2006070516375500
Modified files:
openpkg-registry registry-ui.pl
Log:
temporarily disable hardcoded ase URL; mark body to fix canvas
handling in caught error situations; remove obsolete code fragments
for HTTP header handling in canvas; fix canvas for empty head and/or
body tags; silently ignore cache errors (cache is in turn called for
viewing error messages ...)
Summary:
Revision Changes Path
1.64 +11 -12 openpkg-registry/registry-ui.pl
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: openpkg-registry/registry-ui.pl
============================================================================
$ cvs diff -u -r1.63 -r1.64 registry-ui.pl
--- openpkg-registry/registry-ui.pl 4 Jul 2006 14:23:48 -0000 1.63
+++ openpkg-registry/registry-ui.pl 5 Jul 2006 15:37:55 -0000 1.64
@@ -75,7 +75,7 @@
$cfg->{db}->{registry}->{tablespace}="registry";
$cfg->{db}->{registry}->{host}="127.0.0.1";
$cfg->{db}->{session}->{dbfile}="$PREFIX/var/openpkg-registry/ui/session.db";
-$cfg->{canvas}->{url} =
"http://meta.openpkg.org/?path=project.registry&pane=1&stretch=body";
+#FIXME $cfg->{canvas}->{url} =
"http://meta.openpkg.org/?path=project.registry&pane=1&stretch=body";
$cfg->{canvas}->{urlcache} = 1;
$cfg->{canvas}->{mark_head}="<!-- CANVAS: HEAD -->";
$cfg->{canvas}->{mark_body}="<!-- CANVAS: BODY -->";
@@ -1029,11 +1029,13 @@
$response->{header}->{expires} = '+1s';
$html = '';
+ $html .= "<body>";
$html .= "<h2>Sorry</h2>\n";
$html .= "<img src=\"?page=gif;name=icon-x\"> an internal
<b>ERROR</b> occurred and prevents further processing.<br/>\n";
$html .= sprintf("<h2>Problem scope</h2>\n%s<br/>\n", $marketingmessage)
if (defined $marketingmessage and $marketingmessage ne "");
$html .= sprintf("<h2>Technical details</h2>\n%s<br/>\n",
$technicaldetail) if (defined $technicaldetail and $technicaldetail ne "");
$html .= "<h2>Please come back later and try again</h2>\nSorry for the
inconvenience\n";
+ $html .= "</body>";
# HTTP message
$response->{message}->divert("message");
@@ -1724,18 +1726,13 @@
sub canvas ($)
{
my ($page) = @_;
- my ($http, $head, $body, $canvas);
+ my ($head, $body, $canvas);
- $http = $page;
- $http =~ s|<html>.*$||s;
+ $head = '';
+ $head = $1 if ($page =~ m|<head[^>]*>(.*)</head>|s);
- $head = $page;
- $head =~ s|^.*<head[^>]*>||s;
- $head =~ s|</head>.*||s;
-
- $body = $page;
- $body =~ s|^.*<body[^>]*>||s;
- $body =~ s|</body>.*||s;
+ $body = '';
+ $body = $1 if ($page =~ m|<body[^>]*>(.*)</body>|s);
(undef, undef, $canvas) = &fetchurlcached($cfg->{canvas}->{url});
if (not defined $canvas or $canvas eq "") {
@@ -1755,7 +1752,7 @@
$canvas =~ s|$cfg->{canvas}->{mark_head}|$head|;
$canvas =~ s|$cfg->{canvas}->{mark_body}|$body|;
- return $http . $canvas;
+ return $canvas;
}
sub fetchurlcached ($)
@@ -1775,6 +1772,7 @@
my ($url) = @_;
my ($content_type, $expires, $content, $rv, $sth);
($content_type, $expires, $content) = undef;
+ return if (not defined $dbs);
# invalidate expired records
$rv = $dbs->do("DELETE FROM cache WHERE ( expires <= ? );", undef,
time()) or die $dbs->errstr(); #FIXME
@@ -1793,6 +1791,7 @@
sub setcache ($$$$)
{
my ($url, $content_type, $expires, $content) = @_;
+ return if (not defined $dbs);
$expires = time() + 600 if (not defined $expires);
@@ .
______________________________________________________________________
The OpenPKG Project www.openpkg.org
CVS Repository Commit List [email protected]