~ubuntu-branches/ubuntu/feisty/apache2/feisty

« back to all changes in this revision

Viewing changes to debian/patches/048_reverse_proxy_fix

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Barth
  • Date: 2006-12-09 21:05:45 UTC
  • mfrom: (0.6.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061209210545-h70s0xaqc2v8vqr2
Tags: 2.2.3-3.2
* Non-maintainer upload.
* 043_ajp_connection_reuse: Patch from upstream Bugzilla, fixing a critical
  issue with regard to connection reuse in mod_proxy_ajp.
  Closes: #396265

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Index: modules/proxy/proxy_http.c
2
 
===================================================================
3
 
--- build-tree/apache2/modules/proxy/proxy_http.c       (Revision 326480)
4
 
+++ build-tree/apache2/modules/proxy/proxy_http.c       (Arbeitskopie)
5
 
@@ -504,7 +504,21 @@
6
 
              * take care of that now
7
 
              */
8
 
             bb = header_brigade;
9
 
-            APR_BRIGADE_CONCAT(bb, input_brigade);
10
 
+
11
 
+            /*
12
 
+             * Save input_brigade in bb brigade. (At least) in the SSL case
13
 
+             * input_brigade contains transient buckets whose data would get
14
 
+             * overwritten during the next call of ap_get_brigade in the loop.
15
 
+             * ap_save_brigade ensures these buckets to be set aside.
16
 
+             * Calling ap_save_brigade with NULL as filter is OK, because
17
 
+             * bb brigade already has been created and does not need to get
18
 
+             * created by ap_save_brigade.
19
 
+             */
20
 
+            status = ap_save_brigade(NULL, &bb, &input_brigade, p);
21
 
+            if (status != APR_SUCCESS) {
22
 
+                return status;
23
 
+            }
24
 
+
25
 
             header_brigade = NULL;
26
 
         }
27
 
         else {
28
 
@@ -611,7 +625,21 @@
29
 
              * take care of that now
30
 
              */
31
 
             bb = header_brigade;
32
 
-            APR_BRIGADE_CONCAT(bb, input_brigade);
33
 
+
34
 
+            /*
35
 
+             * Save input_brigade in bb brigade. (At least) in the SSL case
36
 
+             * input_brigade contains transient buckets whose data would get
37
 
+             * overwritten during the next call of ap_get_brigade in the loop.
38
 
+             * ap_save_brigade ensures these buckets to be set aside.
39
 
+             * Calling ap_save_brigade with NULL as filter is OK, because
40
 
+             * bb brigade already has been created and does not need to get
41
 
+             * created by ap_save_brigade.
42
 
+             */
43
 
+            status = ap_save_brigade(NULL, &bb, &input_brigade, p);
44
 
+            if (status != APR_SUCCESS) {
45
 
+                return status;
46
 
+            }
47
 
+
48
 
             header_brigade = NULL;
49
 
         }
50
 
         else {
51
 
@@ -735,7 +763,21 @@
52
 
             apr_brigade_cleanup(input_brigade);
53
 
         }
54
 
         else {
55
 
-            APR_BRIGADE_CONCAT(body_brigade, input_brigade);
56
 
+
57
 
+            /*
58
 
+             * Save input_brigade in body_brigade. (At least) in the SSL case
59
 
+             * input_brigade contains transient buckets whose data would get
60
 
+             * overwritten during the next call of ap_get_brigade in the loop.
61
 
+             * ap_save_brigade ensures these buckets to be set aside.
62
 
+             * Calling ap_save_brigade with NULL as filter is OK, because
63
 
+             * body_brigade already has been created and does not need to get
64
 
+             * created by ap_save_brigade.
65
 
+             */
66
 
+            status = ap_save_brigade(NULL, &body_brigade, &input_brigade, p);
67
 
+            if (status != APR_SUCCESS) {
68
 
+                return status;
69
 
+            }
70
 
+
71
 
         }
72
 
         
73
 
         bytes_spooled += bytes;
74
 
@@ -1081,9 +1123,27 @@
75
 
         }
76
 
 
77
 
         apr_brigade_length(temp_brigade, 1, &bytes);
78
 
-        APR_BRIGADE_CONCAT(input_brigade, temp_brigade);
79
 
         bytes_read += bytes;
80
 
 
81
 
+        /*
82
 
+         * Save temp_brigade in input_brigade. (At least) in the SSL case
83
 
+         * temp_brigade contains transient buckets whose data would get
84
 
+         * overwritten during the next call of ap_get_brigade in the loop.
85
 
+         * ap_save_brigade ensures these buckets to be set aside.
86
 
+         * Calling ap_save_brigade with NULL as filter is OK, because
87
 
+         * input_brigade already has been created and does not need to get
88
 
+         * created by ap_save_brigade.
89
 
+         */
90
 
+        status = ap_save_brigade(NULL, &input_brigade, &temp_brigade, p);
91
 
+        if (status != APR_SUCCESS) {
92
 
+            ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
93
 
+                         "proxy: processing prefetched request body failed"
94
 
+                         " to %s from %s (%s)",
95
 
+                         p_conn->name ? p_conn->name: "",
96
 
+                         c->remote_ip, c->remote_host ? c->remote_host: "");
97
 
+            return status;
98
 
+        }
99
 
+
100
 
     /* Ensure we don't hit a wall where we have a buffer too small
101
 
      * for ap_get_brigade's filters to fetch us another bucket,
102
 
      * surrender once we hit 80 bytes less than MAX_MEM_SPOOL