]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Only do keepalives (and keep state on the connection record) if this request
authorIan Holsman <ianh@apache.org>
Sat, 17 Nov 2001 22:04:48 +0000 (22:04 +0000)
committerIan Holsman <ianh@apache.org>
Sat, 17 Nov 2001 22:04:48 +0000 (22:04 +0000)
is the top-level page.

Do not pass If-XXX-Since headers to the r-proxied server on a subrequest,
and we can't handle a 30X response

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92022 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/proxy_http.c

index d5074ea03863ad76c785629379e609111cc84358..84437265d16128480025126aaa0345b9af37b244 100644 (file)
@@ -465,6 +465,11 @@ apr_status_t ap_proxy_http_request(apr_pool_t *p, request_rec *r,
      */
     p_conn->close += ap_proxy_liststr(apr_table_get(r->headers_in,
                                                      "Connection"), "close");
+    /* sub-requests never use keepalives */
+    if (r->main) {
+        p_conn->close++;
+    }
+
     ap_proxy_clear_connection(p, r->headers_in);
     if (p_conn->close) {
         apr_table_setn(r->headers_in, "Connection", "close");
@@ -582,6 +587,15 @@ apr_status_t ap_proxy_http_request(apr_pool_t *p, request_rec *r,
             || !apr_strnatcasecmp(headers_in[counter].key,"Proxy-Authenticate")) {
             continue;
         }
+        /* for sub-requests, ignore freshness/expiry headers */
+        if (r->main) {
+                if (headers_in[counter].key == NULL || headers_in[counter].val == NULL
+                     || !apr_strnatcasecmp(headers_in[counter].key, "Cache-Control")
+                     || !apr_strnatcasecmp(headers_in[counter].key, "If-Modified-Since")
+                     || !apr_strnatcasecmp(headers_in[counter].key, "If-None-Match")) {
+                    continue;
+                }
+        }
 
         buf = apr_pstrcat(p, headers_in[counter].key, ": ",
                           headers_in[counter].val, CRLF,
@@ -905,7 +919,7 @@ int ap_proxy_http_handler(request_rec *r, proxy_server_conf *conf,
     int status;
     char server_portstr[32];
     conn_rec *origin = NULL;
-    proxy_conn_rec *backend;
+    proxy_conn_rec *backend = NULL;
 
     /* Note: Memory pool allocation.
      * A downstream keepalive connection is always connected to the existence
@@ -936,15 +950,23 @@ int ap_proxy_http_handler(request_rec *r, proxy_server_conf *conf,
     ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server,
                 "proxy: HTTP: serving URL %s", url);
     
-    /* create space for state information */
-    backend = (proxy_conn_rec *) ap_get_module_config(c->conn_config,
+    
+    /* only use stored info for top-level pages. Sub requests don't share 
+     * in keepalives
+     */
+    if (!r->main) {
+        backend = (proxy_conn_rec *) ap_get_module_config(c->conn_config,
                                                       &proxy_http_module);
+    }
+    /* create space for state information */
     if (!backend) {
         backend = ap_pcalloc(c->pool, sizeof(proxy_conn_rec));
         backend->connection = NULL;
         backend->hostname = NULL;
         backend->port = 0;
-        ap_set_module_config(c->conn_config, &proxy_http_module, backend);
+        if (!r->main) {
+            ap_set_module_config(c->conn_config, &proxy_http_module, backend);
+        }
     }
 
     /* Step One: Determine Who To Connect To */