Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: /insurrection/src/

Project highlights: A modern, light-weight, self-contained, web-based toolset for Subversion repository browsing and administration.  A live system can be seen in action here.

insurrection
Discussion topic

Back to topic list

CVS update: /insurrection/src/

Author mksoft
Full name Michae Sinz
Date 2006-01-23 03:03:13 PST
Message User: mksoft
Date: 2006/01/23 03:03:13

Modified:
   insurrection/src/.htaccess
   insurrection/src/admin.pl
   insurrection/src/log.cgi
   insurrection/src/ls.cgi
   insurrection/src/svnindex.js

Log:
 Sync to r297 of http://svn.sinz.com/​svn/Insurrection/tru​nk/
 
 The latest beta Safari/AppleWebKit deals with XML/XSLT correctly now so
 I have enabled that browser as of WebKit 420+ This final version number
 may change yet but I was assured that it should be safe.
 
 Changed the way the JavaScript tells the server that we really want the
 XML format even if the browser is broken. Rather than adding an extra
 CGI parameter to the URL we are now using a HTTP header. This lets the
 default caching behaviors work a bit better and it is really cleaner.
 
 I was going to try to set the User-Agent header but not all browsers
 support this. Specifically, the "broken" Safari browsers did not allow
 the setting of this header and yet that is exactly where it was needed.
 (Non-broken browsers did not need it but happened to work - go figure!)
 
 Anyway, now the header "X-Insurrection-JS: true" means that the request
 came from the JavaScript and to not filter based on the list of known
 broken browsers.
 
 We no longer needed the extra complexity in the handling of the directory
 listing rewrite rule. We now always use the enhanced rule and also
 no longer send XMLHttp CGI parameters.
 
 I have added Blazer to the list of known non-XSLT browsers.

File Changes:

Directory: /insurrection/src/
=============================

File [changed]: .htaccess
Url: http://insurrection.​tigris.org/source/br​owse/insurrection/sr​c/.htaccess?r1=1.24​&r2=1.25
Delta lines: +2 -9
-------------------
--- .htaccess 3 Dec 2005 19:14:13 -0000 1.24
+++ .htaccess 23 Jan 2006 11:03:08 -0000 1.25
@@ -1,5 +1,5 @@
 ##
-## $Id: .htaccess,v 1.24 2005/12/03 19:14:13 mksoft Exp $
+## $Id: .htaccess,v 1.25 2006/01/23 11:03:08 mksoft Exp $
 ## Copyright 2004,2005 - Michael Sinz
 ##
 
@@ -136,13 +136,6 @@
 ## If this rule is not used, you can still get the enhanced
 ## listings via the ?Insurrection=ls CGI option (which is
 ## basically what this rule does)
-##
-## !!!NOTE!!! If this rule runs before the broken XSLT
-## browser test rule, the enhanced listing
-## CGI will implement the work around.
-## However, this is not the most bandwidth
-## friendly way - so keeping this rule after
-## the broken XSLT hack will solve that.
 RewriteCond %{REQUEST_METHOD} GET
-RewriteRule ^svn(/.*/)$ "http://%{HTTP_HOST}/​ls.cgi?%{QUERY_STRIN​G}&Insurrection=​ls&HTTPS=%{HTTPS​}&Path=$1" [P,L]
+RewriteRule ^svn(/.*/)$ "http://%{HTTP_HOST}/​ls.cgi?Insurrection=​ls&HTTPS=%{HTTPS​}&Path=$1" [P,L]
 

File [changed]: admin.pl
Url: http://insurrection.​tigris.org/source/br​owse/insurrection/sr​c/admin.pl?r1=1.46​&r2=1.47
Delta lines: +26 -4
--------------------
--- admin.pl 21 Oct 2005 13:12:36 -0000 1.46
+++ admin.pl 23 Jan 2006 11:03:08 -0000 1.47
@@ -1,5 +1,5 @@
 #
-# $Id: admin.pl,v 1.46 2005/10/21 13:12:36 mksoft Exp $
+# $Id: admin.pl,v 1.47 2006/01/23 11:03:08 mksoft Exp $
 # Copyright 2004,2005 - Michael Sinz
 #
 # This is some common code that all of the Perl code
@@ -367,7 +367,7 @@
    my $version = shift;
 
    ## Use the version of this file if there was no version passed.
- $version = '$Id: admin.pl,v 1.46 2005/10/21 13:12:36 mksoft Exp $' if (!defined $version);
+ $version = '$Id: admin.pl,v 1.47 2006/01/23 11:03:08 mksoft Exp $' if (!defined $version);
 
    ## Now, lets just use the version information a title attribute of the footer
 
@@ -417,7 +417,7 @@
 # not quite. So it is listed here.
 #
 # Note that if someone expressly wants XML, the
-# XMLHttp=1 attribute is needed.
+# X-Insurrection-JS header will be set to "true"
 #
 # Note that we would like to have the real XSLT working
 # as there are some things that are not available
@@ -426,10 +426,32 @@
 # browser technologies do work correctly enough to
 # not need this hack. That ends up covering 98% of
 # all wed users. (That is Mozilla/Firefox and IE)
+# Safari will/does work correctly as of webkit 420+
+# so also detect that.
+#
+# Note test filter downwards - thus the "OK" or 0 return
+# is done as early as possible.
 #
 sub isBrokenBrowser()
 {
- return ((!defined $cgi->param('XMLHttp')) && ($cgi->user_agent =~ m/(Opera)|(Safari)|(​Konqueror)/o));
+ ## If the user agent does not match this pattern we
+ ## assume that it is a correctly working browser
+ return 0 if (!($cgi->user_agent =~ m/(Opera)|(Safari)|(​Konqueror)|(Blazer)/​o));
+
+ ## If the request is from the JavaScript code then
+ ## it is for sure not broken behavior...
+ return 0 if (defined $ENV{'HTTP_X_INSURR​ECTION_JS'});
+
+ ## Safari has some extra checking since as of webkit 420+
+ ## it seems to handle XML/XSLT correctly...
+ if ($cgi->user_agent =~ m:AppleWebKit/(\d+\.\d+):o)
+ {
+ my $ver = $1 + 0;
+ return 0 if ($ver >= 420);
+ }
+
+ ## Well, if we get here it must be a broken browser
+ return 1;
 }
 
 ####################​####################​####################​##################

File [changed]: log.cgi
Url: http://insurrection.​tigris.org/source/br​owse/insurrection/sr​c/log.cgi?r1=1.24​&r2=1.25
Delta lines: +2 -8
-------------------
--- log.cgi 8 Nov 2005 03:14:36 -0000 1.24
+++ log.cgi 23 Jan 2006 11:03:08 -0000 1.25
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 #
-# $Id: log.cgi,v 1.24 2005/11/08 03:14:36 mksoft Exp $
+# $Id: log.cgi,v 1.25 2006/01/23 11:03:08 mksoft Exp $
 # Copyright 2004,2005 - Michael Sinz
 #
 # This script handles the display of SVN history/logs
@@ -86,17 +86,11 @@
 ## What a trick - to get the broken browsers to work.
 ## Removes the need for XSLT...
 ##
-## Note that the XSLT of Safari is almost working but
-## not quite. So it is listed here.
-##
 ## What we do here is redirect the output of this
 ## CGI into a server-side XSLT processor when the
 ## client user-agent string seems to match known
 ## broken clients.
 ##
-## Note that if someone expressly wants XML, the
-## XMLHttp=1 attribute is needed.
-##
 ## Note that we would like to have the real XSLT working
 ## as there are some things that are not available
 ## without it *and* the bandwidth and server load are
@@ -179,6 +173,6 @@
        , '<h3>Log command:</h3>'
        , '<pre>' , $cmd , '</pre>';
 
- &svn_TRAILER('$Id: log.cgi,v 1.24 2005/11/08 03:14:36 mksoft Exp $');
+ &svn_TRAILER('$Id: log.cgi,v 1.25 2006/01/23 11:03:08 mksoft Exp $');
 }
 

File [changed]: ls.cgi
Url: http://insurrection.​tigris.org/source/br​owse/insurrection/sr​c/ls.cgi?r1=1.3&​r2=1.4
Delta lines: +1 -7
-------------------
--- ls.cgi 10 Oct 2005 19:22:20 -0000 1.3
+++ ls.cgi 23 Jan 2006 11:03:08 -0000 1.4
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 #
-# $Id: ls.cgi,v 1.3 2005/10/10 19:22:20 mksoft Exp $
+# $Id: ls.cgi,v 1.4 2006/01/23 11:03:08 mksoft Exp $
 # Copyright 2004,2005 - Michael Sinz
 #
 # This script handles the return of a slightly better XML listing
@@ -43,16 +43,10 @@
 ## What a trick - to get the broken browsers to work.
 ## Removes the need for XSLT...
 ##
-## Note that the XSLT of Safari is almost working but
-## not quite. So it is listed here.
-##
 ## What we do here is redirect the output of this
 ## CGI into a server-side XSLT processor when the
 ## client user-agent string seems to match known
 ## broken clients.
-##
-## Note that if someone expressly wants XML, the
-## XMLHttp=1 attribute is needed.
 ##
 ## Note that we would like to have the real XSLT working
 ## as there are some things that are not available

File [changed]: svnindex.js
Url: http://insurrection.​tigris.org/source/br​owse/insurrection/sr​c/svnindex.js?r1=1.2​2&r2=1.23
Delta lines: +10 -2
--------------------
--- svnindex.js 5 Oct 2005 22:12:24 -0000 1.22
+++ svnindex.js 23 Jan 2006 11:03:08 -0000 1.23
@@ -1,5 +1,5 @@
 /*
- * $Id: svnindex.js,v 1.22 2005/10/05 22:12:24 mksoft Exp $
+ * $Id: svnindex.js,v 1.23 2006/01/23 11:03:08 mksoft Exp $
  * Copyright 2004,2005 - Michael Sinz
  *
  * Some JavaScript support routines for the svn index pages
@@ -479,7 +479,15 @@
                 target.innerHTML = 'xml.open("GET","' + target.id + '",true);';
 
                 target.xml.onreadystatechange = function() { loadDirCheck(target); };
- target.xml.open("GET",target.id + '?XMLHttp=1',true);
+ target.xml.open("GET​",target.id,true);
+
+ // Signal that we are within the JavaScript and want the raw XML
+ // even if we are in a browser that normally can not handle raw XML
+ // NOTE - We would have done this by setting a new User-Agent
+ // header but not all browsers seem to support that so we have
+ // our own header.
+ target.xml.setReques​tHeader('X-Insurrect​ion-JS','true');
+
                 target.xml.send(null);
             }
         }

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: /insurrection/src/ mksoft Michae Sinz 2006-01-23 03:03:13 PST
Messages per page: