[PATCH 15 of 31] Correctly handle Content-Encoding set from perl

Maxim Dounin mdounin at mdounin.ru
Tue Feb 15 16:33:31 MSK 2011


# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1297776702 -10800
# Node ID 9d903cd59616d3a1e2dca508d324e9bcf886c4ac
# Parent  0d1f4df7eab0bd9665b5814ac3dd7c6c6c946fef
Correctly handle Content-Encoding set from perl.

This fixes double gzipping in case gzip filter enabled while perl
returns already gzipped response.

diff --git a/src/http/modules/perl/nginx.xs b/src/http/modules/perl/nginx.xs
--- a/src/http/modules/perl/nginx.xs
+++ b/src/http/modules/perl/nginx.xs
@@ -474,6 +474,13 @@ header_out(r, key, value)
         r->headers_out.content_length = header;
     }
 
+    if (header->key.len == sizeof("Content-Encoding") - 1
+        && ngx_strncasecmp(header->key.data, "Content-Encoding",
+                           sizeof("Content-Encoding") - 1) == 0)
+    {
+        r->headers_out.content_encoding = header;
+    }
+
 
 void
 filename(r)



More information about the nginx-devel mailing list