[pve-devel] r4867 - in pve-manager/pve2: . lib/PVE www/templates

svn-commits at proxmox.com svn-commits at proxmox.com
Fri Jul 2 13:46:22 CEST 2010


Author: dietmar
Date: 2010-07-02 11:46:22 +0000 (Fri, 02 Jul 2010)
New Revision: 4867

Modified:
   pve-manager/pve2/ChangeLog
   pve-manager/pve2/lib/PVE/API2Client.pm
   pve-manager/pve2/lib/PVE/REST.pm
   pve-manager/pve2/www/templates/pve.conf.in
Log:
	* lib/PVE/REST.pm (handler): fix content length

	* lib/PVE/API2Client.pm (new): allow gzip encoding



Modified: pve-manager/pve2/ChangeLog
===================================================================
--- pve-manager/pve2/ChangeLog	2010-07-02 08:45:10 UTC (rev 4866)
+++ pve-manager/pve2/ChangeLog	2010-07-02 11:46:22 UTC (rev 4867)
@@ -1,3 +1,9 @@
+2010-07-02  Proxmox Support Team  <support at proxmox.com>
+
+	* lib/PVE/REST.pm (handler): fix content length
+
+	* lib/PVE/API2Client.pm (new): allow gzip encoding
+
 2010-07-01  Proxmox Support Team  <support at proxmox.com>
 
 	* bin/pvesh: experimental command line tool

Modified: pve-manager/pve2/lib/PVE/API2Client.pm
===================================================================
--- pve-manager/pve2/lib/PVE/API2Client.pm	2010-07-02 08:45:10 UTC (rev 4866)
+++ pve-manager/pve2/lib/PVE/API2Client.pm	2010-07-02 11:46:22 UTC (rev 4867)
@@ -138,6 +138,8 @@
 	protocols_allowed => [ 'http', 'https'],
 	timeout => $self->{timeout},
 	);
+
+     $self->{useragent}->default_header('Accept-Encoding' => 'gzip'); # allow gzip
   
     return $self;
 }

Modified: pve-manager/pve2/lib/PVE/REST.pm
===================================================================
--- pve-manager/pve2/lib/PVE/REST.pm	2010-07-02 08:45:10 UTC (rev 4866)
+++ pve-manager/pve2/lib/PVE/REST.pm	2010-07-02 11:46:22 UTC (rev 4867)
@@ -207,8 +207,11 @@
 
     $r->content_type ($ct);
     my $raw = $response->decoded_content;
+
+    # note: do not use err_headers_out(), because mod_deflate has a bug,
+    # resulting in dup length (for exampe 'content-length: 89, 75')
+    $r->headers_out()->add('Content-Length' , length($raw));
     $r->print($raw);
-    $r->err_headers_out()->add('Content-length' , length($raw));
 
     syslog('info', "proxy end $method $host:$abs_uri ($code)");
 
@@ -331,8 +334,11 @@
 
      my ($raw, $ct) = format_response_data($format, $res, $abs_uri);
      $r->content_type ($ct);
+
+     # note: do not use err_headers_out(), because mod_deflate has a bug,
+     # resulting in dup length (for exampe 'content-length: 89, 75')
+     $r->headers_out()->add('Content-Length', length($raw));
      $r->print($raw);
-     $r->err_headers_out()->add('Content-length', length($raw));
     
      syslog('info', "perl handler end $res->{status}");
 

Modified: pve-manager/pve2/www/templates/pve.conf.in
===================================================================
--- pve-manager/pve2/www/templates/pve.conf.in	2010-07-02 08:45:10 UTC (rev 4866)
+++ pve-manager/pve2/www/templates/pve.conf.in	2010-07-02 11:46:22 UTC (rev 4867)
@@ -25,12 +25,15 @@
 	AllowOverride None
 </Directory>
 
+<IfModule mod_deflate.c>
+	AddOutputFilterByType DEFLATE application/json
+</IfModule>
+
 <Directory @WWW_ROOTDIR@>
 	Options FollowSymLinks MultiViews
 	AllowOverride None
 	Order allow,deny
 	allow from all
-	SetOutputFilter DEFLATE
 </Directory>
 
 ErrorLog /var/log/apache2/error.log



More information about the pve-devel mailing list