From 0df2126ee144e10cccaad32d550b7a741146aac2 Mon Sep 17 00:00:00 2001
From: Ralph Amissah <ralph@amissah.com>
Date: Tue, 24 May 2011 21:39:00 -0400
Subject: v3: sysenv, url webserver link (manifest) fix

---
 data/doc/sisu/CHANGELOG_v3 |  2 ++
 lib/sisu/v3/sysenv.rb      | 16 ++++++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3
index 710b0fb2..73275cb5 100644
--- a/data/doc/sisu/CHANGELOG_v3
+++ b/data/doc/sisu/CHANGELOG_v3
@@ -20,6 +20,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.11.orig.tar.gz
   sisu_3.0.11-1.dsc
   sisu_3.0.11-1.debian.tar.gz
 
+  * sysenv, url webserver link (manifest) fix
+
 %% 3.0.10.orig.tar.gz (2011-05-23:21/1)
 http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/3.0.10-1
 http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.10.orig.tar.gz
diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb
index a35a9eef..944df010 100644
--- a/lib/sisu/v3/sysenv.rb
+++ b/lib/sisu/v3/sysenv.rb
@@ -2068,15 +2068,20 @@ WOK
         else "#{http}localhost" end
       end
       def webserv                                                              #web url for local webserv (localhost, or hostname)
-        if path.webserv_dir \
+        if defined? @rc['webserv']['url_root'] \
+        and @rc['webserv']['url_root'] =~/http/
+          # needed for alternative output dir structures, fixes manifest url links, check may cause problems elsewhere
+          @rc['webserv']['url_root']
+        elsif path.webserv_dir \
         and path.webserv =~ /#{path.webserv_dir}/ #revisit
           "#{path.webserv}/#{@stub_pwd}".gsub(/#{path.webserv_dir}/,"#{url.hostname}/#{@stub_pwd}")
         elsif defined? @rc['webserv']['webrick_url'] \
         and @rc['webserv']['webrick_url']==false
-          "file://#{path.webserv}/#{@stub_pwd}"
+          "file://#{path.webserv}"
         elsif webserv_port_cgi =~/\S+/
-          "#{url.hostname}:#{webserv_port_cgi}/#{@stub_pwd}"
-        else "#{url.hostname}/#{@stub_pwd}"
+          "#{url.hostname}:#{webserv_port_cgi}"
+        else
+          url.hostname
         end
       end
       def webserv_base                                                         #web url for local webserv (localhost, or hostname)
@@ -3810,8 +3815,7 @@ WOK
           "#{@env.path.webserv}/#{@md.opt.f_pth[:pth_stub]}"
         end
         def url
-          "#{@env.url.root}"
-          #url:  "#{@env.url.root}/#{@md.opt.f_pth[:pth_stub]}"
+          "#{@env.url.webserv}/#{@md.opt.f_pth[:pth_stub]}"
         end
         def rel
           "./#{@md.opt.f_pth[:pth_stub]}"
-- 
cgit v1.2.3