~ubuntu-branches/ubuntu/raring/apache2/raring

« back to all changes in this revision

Viewing changes to debian/patches/069_no_deflate_for_HEAD.dpatch

  • Committer: Package Import Robot
  • Author(s): Steve Beattie
  • Date: 2011-09-06 01:17:15 UTC
  • mfrom: (14.3.28 sid)
  • Revision ID: package-import@ubuntu.com-20110906011715-tca9jwg0gxy0gxt0
Tags: 2.2.20-1ubuntu1
* Merge from debian unstable to fix CVE-2011-3192 (LP: #837991).
  Remaining changes:
  - debian/{control, rules}: Enable PIE hardening.
  - debian/{control, rules, apache2.2-common.ufw.profile}: Add ufw profiles.
  - debian/control: Add bzr tag and point it to our tree
  - debian/apache2.py, debian/apache2.2-common.install: Add apport hook.
  - debian/control, debian/ask-for-passphrase, debian/config-dir/mods-available/ssl.conf:
    Plymouth aware passphrase dialog program ask-for-passphrase.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/sh /usr/share/dpatch/dpatch-run
2
 
##
3
 
## All lines beginning with `## DP:' are a description of the patch.
4
 
## DP: mod_deflate DoS
5
 
## DP: This should switch off deflate for HEAD requests
6
 
## DP: Patch by Ruediger Pluem
7
 
 
8
 
@DPATCH@
9
 
--- a/modules/filters/mod_deflate.c       (revision 793927)
10
 
+++ a/modules/filters/mod_deflate.c       (working copy)
11
 
@@ -629,6 +629,19 @@
12
 
         apr_bucket *b;
13
 
         apr_size_t len;
14
 
 
15
 
+        /*
16
 
+         * Optimization: If we are a HEAD request and bytes_sent is not zero
17
 
+         * it means that we have passed the content-length filter once and
18
 
+         * have more data to sent. This means that the content-length filter
19
 
+         * could not determine our content-length for the response to the
20
 
+         * HEAD request anyway (the associated GET request would deliver the
21
 
+         * body in chunked encoding) and we can stop compressing.
22
 
+         */
23
 
+        if (r->header_only && r->bytes_sent) {
24
 
+            ap_remove_output_filter(f);
25
 
+            return ap_pass_brigade(f->next, bb);
26
 
+        }
27
 
+
28
 
         e = APR_BRIGADE_FIRST(bb);
29
 
 
30
 
         if (APR_BUCKET_IS_EOS(e)) {