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

Maxim Dounin mdounin at mdounin.ru
Mon Jun 27 21:06:46 MSD 2011


# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1309186979 -14400
# Node ID d43c81dbcd7f0774d72720f7bc9d65aa9bff0cc2
# Parent  d03835e97b323834ed8f4107cb1e0ecd68f6ca1f
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