]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 398546 - config.cgi using the RDF format can generate a pretty large file
authorFrédéric Buclin <LpSolit@gmail.com>
Tue, 12 Apr 2016 22:54:57 +0000 (00:54 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Tue, 12 Apr 2016 22:54:57 +0000 (00:54 +0200)
r=dkl

.htaccess
config.cgi
template/en/default/config.rdf.tmpl
template/en/default/filterexceptions.pl

index f9eeb541cbcebe50cd4fb7d4ff5d9f024aefab9e..a2d882d8002fa4dbcbc321b750c51ff3932db7ea 100644 (file)
--- a/.htaccess
+++ b/.htaccess
@@ -42,3 +42,9 @@ Options -Indexes
   RewriteOptions inherit
   RewriteRule ^rest/(.*)$ rest.cgi/$1 [NE]
 </IfModule>
+
+# config.cgi using the RDF format can generate a pretty large file (several MB).
+# The XML format of bug reports can be quite large too.
+<IfModule mod_deflate.c>
+  AddOutputFilterByType DEFLATE text/xml application/rdf+xml
+</IfModule>
index 8e423ca009866406f97daafbb6bb48364aadb7f9..3e39439897bf81b6487bef0f578cdf49e58dcc65 100755 (executable)
@@ -139,6 +139,9 @@ sub display_data {
     $template->process($format->{'template'}, $vars, \$output)
       || ThrowTemplateError($template->error());
 
+    # Remove leading whitespaces, to save some bandwidth.
+    $output =~ s/^\s+(?=<)//gm if $format->{'ctype'} =~ /rdf/;
+
     # Wide characters cause md5_base64() to die.
     my $digest_data = $output;
     utf8::encode($digest_data) if utf8::is_utf8($digest_data);
index c1b5b0575a9b95217eeab1a3c63a95dbec5a1bfa..814b5a1d93ec89f5deebd7022b976e57336db691 100644 (file)
   <bz:products>
     <Seq>
       [% FOREACH product = products %]
+        [% uri_product_name = product.name FILTER uri %]
         <li>
-          <bz:product rdf:about="[% escaped_urlbase %]product.cgi?name=[% product.name FILTER uri %]">
+          <bz:product rdf:about="[% escaped_urlbase %]product.cgi?name=[% uri_product_name %]">
             <bz:name>[% product.name FILTER html %]</bz:name>
-            <bz:allows_unconfirmed>[% product.allows_unconfirmed FILTER html %]</bz:allows_unconfirmed>
+            <bz:allows_unconfirmed>[% product.allows_unconfirmed FILTER none %]</bz:allows_unconfirmed>
             [% IF Param('useclassification') %]
               <bz:classification>[% class_names.${product.classification_id}.name FILTER html %]</bz:classification>
             [% END %]
               <Seq>
                 [% FOREACH comp = product.components %]
                   <li resource="[% escaped_urlbase %]component.cgi?name=[% comp.name FILTER uri
-                      %]&amp;product=[% product.name FILTER uri %]"/>
+                      %]&amp;product=[% uri_product_name %]"/>
                 [% END %]
               </Seq>
             </bz:components>
               <Seq>
                 [% FOREACH version = product.versions %]
                   <li resource="[% escaped_urlbase %]version.cgi?name=[% version.name FILTER uri
-                      %]&amp;product=[% product.name FILTER uri %]"/>
+                      %]&amp;product=[% uri_product_name %]"/>
                 [% END %]
               </Seq>
             </bz:versions>
                 <Seq>
                   [% FOREACH milestone = product.milestones %]
                     <li resource="[% escaped_urlbase %]milestone.cgi?name=[% milestone.name FILTER uri
-                        %]&amp;product=[% product.name FILTER uri %]"/>
+                        %]&amp;product=[% uri_product_name %]"/>
                   [% END %]
                 </Seq>
               </bz:target_milestones>
             [% END %]
-
           </bz:product>
         </li>
       [% END %]
   <bz:components>
     <Seq>
       [% FOREACH product = products %]
+        [% uri_product_name = product.name FILTER uri %]
         [% FOREACH comp = product.components %]
           <li>
             <bz:component rdf:about="[% escaped_urlbase %]component.cgi?name=[% comp.name FILTER uri
-                          %]&amp;product=[% product.name FILTER uri %]">
+                          %]&amp;product=[% uri_product_name %]">
               <bz:name>[% comp.name FILTER html %]</bz:name>
-              <bz:is_active>[% comp.is_active FILTER html %]</bz:is_active>
+              <bz:is_active>[% comp.is_active FILTER none %]</bz:is_active>
               [% IF show_flags %]
                 <bz:flag_types>
                   <Seq>
                     [% FOREACH flag_type = flag_types %]
                       [% NEXT UNLESS flag_type.is_active %]
                       [% all_visible_flag_types.${flag_type.id} = flag_type %]
-                      <li resource="[% escaped_urlbase %]flag.cgi?id=[% flag_type.id FILTER uri
+                      <li resource="[% escaped_urlbase %]flag.cgi?id=[% flag_type.id
                           %]&amp;name=[% flag_type.name FILTER uri %]" />
                     [% END %]
                   </Seq>
   <bz:versions>
     <Seq>
       [% FOREACH product = products %]
+        [% uri_product_name = product.name FILTER uri %]
         [% FOREACH version = product.versions %]
           <li>
             <bz:version rdf:about="[% escaped_urlbase %]version.cgi?name=[% version.name FILTER uri
-                        %]&amp;product=[% product.name FILTER uri %]">
+                        %]&amp;product=[% uri_product_name %]">
               <bz:name>[% version.name FILTER html %]</bz:name>
-              <bz:is_active>[% version.is_active FILTER html %]</bz:is_active>
+              <bz:is_active>[% version.is_active FILTER none %]</bz:is_active>
             </bz:version>
           </li>
         [% END %]
     <bz:target_milestones>
       <Seq>
         [% FOREACH product = products %]
+          [% uri_product_name = product.name FILTER uri %]
           [% FOREACH milestone = product.milestones %]
             <li>
               <bz:target_milestone rdf:about="[% escaped_urlbase %]milestone.cgi?name=[% milestone.name FILTER uri
-                                   %]&amp;product=[% product.name FILTER uri %]">
+                                   %]&amp;product=[% uri_product_name %]">
                 <bz:name>[% milestone.name FILTER html %]</bz:name>
-                <bz:is_active>[% milestone.is_active FILTER html %]</bz:is_active>
+                <bz:is_active>[% milestone.is_active FILTER none %]</bz:is_active>
               </bz:target_milestone>
             </li>
           [% END %]
       <Seq>
         [% FOREACH flag_type = all_visible_flag_types.values.sort('name') %]
           <li>
-            <bz:flag_type rdf:about="[% escaped_urlbase %]flag.cgi?id=[% flag_type.id FILTER uri
+            <bz:flag_type rdf:about="[% escaped_urlbase %]flag.cgi?id=[% flag_type.id
                           %]&amp;name=[% flag_type.name FILTER uri %]">
-              <bz:id>[% flag_type.id FILTER html %]</bz:id>
+              <bz:id>[% flag_type.id %]</bz:id>
               <bz:name>[% flag_type.name FILTER html %]</bz:name>
               <bz:description>[% flag_type.description FILTER html %]</bz:description>
               <bz:type>[% flag_type.target_type FILTER html %]</bz:type>
-              <bz:requestable>[% flag_type.is_requestable FILTER html %]</bz:requestable>
-              <bz:specifically_requestable>[% flag_type.is_requesteeble FILTER html %]</bz:specifically_requestable>
-              <bz:multiplicable>[% flag_type.is_multiplicable FILTER html %]</bz:multiplicable>
+              <bz:requestable>[% flag_type.is_requestable FILTER none %]</bz:requestable>
+              <bz:specifically_requestable>[% flag_type.is_requesteeble FILTER none %]</bz:specifically_requestable>
+              <bz:multiplicable>[% flag_type.is_multiplicable FILTER none %]</bz:multiplicable>
               [% IF user.in_group("editcomponents") %]
                 <bz:grant_group>[% flag_type.grant_group.name FILTER html %]</bz:grant_group>
                 <bz:request_group>[% flag_type.request_group.name FILTER html %]</bz:request_group>
             <bz:description>[% (field_descs.${item.name} OR item.description) FILTER html %]</bz:description>
             [%-# These values are meaningful for custom fields only. %]
             [% IF item.custom %]
-              <bz:type>[% item.type FILTER html %]</bz:type>
+              <bz:type>[% item.type FILTER none %]</bz:type>
               <bz:type_desc>[% field_types.${item.type} FILTER html %]</bz:type_desc>
-              <bz:enter_bug>[% item.enter_bug FILTER html %]</bz:enter_bug>
+              <bz:enter_bug>[% item.enter_bug FILTER none %]</bz:enter_bug>
             [% END %]
             [% IF item.is_active.defined %]
-              <bz:is_active>[% item.is_active FILTER html %]</bz:is_active>
+              <bz:is_active>[% item.is_active FILTER none %]</bz:is_active>
             [% END %]
           </bz:field>
         </li>
index f83efaa880e4c0bb6e71c6e85a5c13a2e08c5abf..69978a7223683fef9cd82183937f06bdbc7dde22 100644 (file)
 
 'config.rdf.tmpl' => [
   'escaped_urlbase',
+  'uri_product_name',
+  'flag_type.id'
 ],
 
 );