[PATCH] Correctly handle Content-Encoding set from perl

Maxim Dounin mdounin at mdounin.ru
Tue Dec 22 02:06:42 MSK 2009


# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1261436632 -10800
# Node ID 798c007ce2aca62db1de752db1b12ca5516131c6
# Parent  72104cd120ece09b3004261b2a29ace3e0aab812
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