Package: dwww
Version: 1.11.8
Severity: normal
Tags: patch

Dear Maintainer,
Some document packages link to absolute path /usr/share/doc/.
But the link is miss on http://localhost/cgi-bin/dwww/, because dwww return raw 
html file.

Example. libghc-hakyll-doc package has 
/usr/share/doc/libghc-hakyll-doc/html/Hakyll-Web-Blaze.html.
But 
http://localhost/cgi-bin/dwww/usr/share/doc/libghc-hakyll-doc/html/Hakyll-Web-Blaze.html
has link to 
http://localhost/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html.

How about this patch that change /usr/share/doc/ to 
/cgi-bin/dwww/usr/share/doc/ ?

Best regards,
Kiwamu Okabe

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.2.0-3-amd64 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C)
Shell: /bin/sh linked to /bin/dash

Versions of packages dwww depends on:
ii  apache2                         2.2.22-11
ii  apache2-mpm-worker [httpd-cgi]  2.2.22-11
ii  debconf [debconf-2.0]           1.5.46
ii  debianutils                     4.3.3
ii  doc-base                        0.10.4
ii  file                            5.11-2
ii  libc6                           2.13-35
ii  libfile-ncopy-perl              0.36-1
ii  libmime-types-perl              1.35-1
ii  lighttpd [httpd-cgi]            1.4.31-1+b1
ii  man-db                          2.6.2-1
ii  mime-support                    3.52-2
ii  perl                            5.14.2-13
ii  ucf                             3.0025+nmu3

Versions of packages dwww recommends:
ii  apt       0.9.7.4
ii  dlocate   1.02
ii  info2www  1.2.2.9-24
ii  swish++   6.1.5-2.2

Versions of packages dwww suggests:
ii  chromium [www-browser]              21.0.1180.89~r154005-1
ii  doc-debian                          6.0
ii  dpkg-www                            2.54+nmu1
ii  epiphany-browser [www-browser]      3.4.2-1+build1
ii  google-chrome-stable [www-browser]  21.0.1180.89-r154005
ii  iceweasel [www-browser]             10.0.7esr-2
ii  konqueror [www-browser]             4:4.8.4-1
ii  lynx-cur [www-browser]              2.8.8dev.14-1
ii  w3m [www-browser]                   0.5.3-8

-- debconf information:
  dwww/cgiuser: www-data
  dwww/nosuchuser:
  dwww/cgidir: /usr/lib/cgi-bin
  dwww/docrootdir: /var/www
  dwww/serverport: 80
  dwww/servername: casper.masterq.net
  dwww/index_docs: false
  dwww/badport:
  dwww/nosuchdir:
--- dwww-convert.orig	2012-09-11 22:59:37.419260722 +0900
+++ dwww-convert	2012-09-11 22:58:19.138872558 +0900
@@ -284,6 +284,25 @@
 } # }}}
 
 #
+# Filter html file. Change href link.
+# /usr/share/doc/ => /cgi-bin/dwww/usr/share/doc/
+#
+sub BuiltinHtmlFilter() { # {{{
+    my $filename    = shift;
+    my $cacheProg   = shift;
+    my $charset     = shift;
+
+    my $OUT_FH      = &OpenPipe($cacheProg, "w");
+    my $IN_FH       = &OpenPipe("cat \"$filename\"", "r");
+    while (<$IN_FH>) {
+	$_ =~ s/\/usr\/share\/doc\//\/cgi-bin\/dwww\/usr\/share\/doc\//g;
+        print $OUT_FH $_;
+    }
+    &ClosePipe($IN_FH);
+    &ClosePipe($OUT_FH);
+} # }}}
+
+#
 # Convert info file to HTML using info2www
 #
 sub BuiltinInfo2Html() { # {{{
@@ -494,6 +513,8 @@
     $convertFunction  =   \&BuiltinInfo2Html;
 } elsif ($type eq "text/plain") {
     $convertFunction  =   \&BuiltinText2Html;
+} elsif ($type eq "text/html") {
+    $convertFunction  =   \&BuiltinHtmlFilter;
 } elsif ($type ne  "html") {
     $mime_type  =   $type;
 }

Reply via email to