[PATCH 11 of 25] Handling of Content-Encoding set from perl

Maxim Dounin mdounin at mdounin.ru
Tue Sep 6 15:58:08 UTC 2011


# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1315324515 -14400
# Node ID 4a6e9b96868cb07b2bf5f10d3244994fd6019952
# Parent  8e75ca21ad556974aeee9156a6534ebe4d12146b
Handling of Content-Encoding set from perl.

This fixes double gzipping in case of gzip filter being 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