Hello,

attached you'll find a patch adding Apache2(::Request) support to the 
Webinterface.


regards,
 andreas
This patch adds Apache2 support to the HTML::Mason Webinterface of OpenXPKI
by conditionaly trying first to load the Apache::Request and then the
Apache2::Request module.

Two conditional checks could be removed by unconditionally using
HTML::Entities which is the saner choice as Apache::Util::escape_html has
been removed in Apache::Request2.

Andreas Thienemann <[EMAIL PROTECTED]>

diffstats:
 htdocs/lib/html/safe.mhtml                      |   12 +-----------
 htdocs/syshandler                               |   10 +---------
 lib/OpenXPKI/Client/HTML/Mason/ApacheHandler.pm |    2 +-
 3 files changed, 3 insertions(+), 21 deletions(-)


--- OpenXPKI-Client-HTML-Mason-0.9.792/htdocs/syshandler.apache2        
2007-04-04 14:18:21.000000000 +0200
+++ OpenXPKI-Client-HTML-Mason-0.9.792/htdocs/syshandler        2007-04-04 
14:18:53.000000000 +0200
@@ -9,6 +9,7 @@
   use OpenXPKI::DN;
   use English;
   use Data::Dumper;
+  use HTML::Entities;
 
   if (defined $ENV{OPENXPKI_LOCALE_PREFIX}) {
     set_locale_prefix($ENV{OPENXPKI_LOCALE_PREFIX});
@@ -32,15 +33,6 @@
     h => \&HTML::Mason::Escapes::basic_html_escape,
   );
   
-  if (exists $ENV{MOD_PERL} and $ENV{MOD_PERL})
-  {
-    ## script is operated by apache with mod_perl
-    eval "use Apache::Util;";
-  } else {
-    ## script runs without mod_perl
-    eval "use HTML::Entities;";
-  }
-  die $EVAL_ERROR if ($EVAL_ERROR);
 </%once>
 
 <%init>
--- OpenXPKI-Client-HTML-Mason-0.9.792/htdocs/lib/html/safe.mhtml.apache2       
2007-02-09 13:09:01.000000000 +0100
+++ OpenXPKI-Client-HTML-Mason-0.9.792/htdocs/lib/html/safe.mhtml       
2007-04-04 14:18:03.000000000 +0200
@@ -4,17 +4,7 @@
 <%init>
     return "" if (not defined $data);
 
-    if (exists $ENV{MOD_PERL} and $ENV{MOD_PERL})
-    {
-        ## script is operated by apache with mod_perl
-        ## FIXME: escape_html includes a bug which removes the iutf8 flag from 
the string
-        $data = Apache::Util::escape_html ($data);
-        Encode::_utf8_on ($data);
-        print $data;
-    } else {
-        ## script runs without mod_perl
-        print HTML::Entities::encode ($data);
-    }
+    print HTML::Entities::encode ($data);
     ## always return here !!!
     ## if the normal perl area will be executed
     ## then the output can include newlines
--- 
OpenXPKI-Client-HTML-Mason-0.9.792/lib/OpenXPKI/Client/HTML/Mason/ApacheHandler.pm.apache2
  2007-02-09 13:09:02.000000000 +0100
+++ 
OpenXPKI-Client-HTML-Mason-0.9.792/lib/OpenXPKI/Client/HTML/Mason/ApacheHandler.pm
  2007-04-04 14:18:03.000000000 +0200
@@ -8,7 +8,7 @@
 use strict;
 
 use HTML::Mason::ApacheHandler;
-use Apache::Request;
+eval { require Apache::Request } or { require Apache2::Request };
 
 my %ah;
 
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
OpenXPKI-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openxpki-users

Reply via email to