]> granicus.if.org Git - apache/commitdiff
Remove proxy_mdule_conf.
authorWilliam A. Rowe Jr <wrowe@apache.org>
Wed, 11 Aug 2004 22:28:59 +0000 (22:28 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Wed, 11 Aug 2004 22:28:59 +0000 (22:28 +0000)
We will change the scheme hook api to include the worker.

Submitted by: mturk

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

modules/proxy/mod_proxy.c
modules/proxy/mod_proxy.h
modules/proxy/proxy_util.c

index 69940ec5085cdec595ad1d7a5eb12b791acfc827..f661f4cd9d5a5380e6f6d5adab368524c7a08ef5 100644 (file)
@@ -475,7 +475,6 @@ static int proxy_handler(request_rec *r)
     long maxfwd;
     proxy_balancer *balancer = NULL;
     proxy_worker *worker = NULL;
-    proxy_module_conf *mconf;
 
     /* is this for us? */
     if (!r->proxyreq || !r->filename || strncmp(r->filename, "proxy:", 6) != 0)
@@ -561,29 +560,6 @@ static int proxy_handler(request_rec *r)
     if (access_status != OK)
         return access_status;
     
-    /* only use stored info for top-level pages. Sub requests don't share 
-     * in keepalives
-     */
-    if (!r->main) {
-        mconf = (proxy_module_conf *)ap_get_module_config(r->connection->conn_config,
-                                                          &proxy_module);
-    }
-    /* create space for state information */
-    if (!mconf) {
-        mconf = apr_pcalloc(r->connection->pool, sizeof(proxy_module_conf));
-        if (!r->main) {
-            ap_set_module_config(r->connection->conn_config,
-                                 &proxy_module, mconf);
-        }
-    }
-    /* use the current balancer and worker. 
-     * the proxy_conn will be set in particular scheme handler
-     * if not already set.
-     */ 
-    mconf->balancer = balancer;
-    mconf->worker   = worker;
-    mconf->url      = url;
-    
     /* firstly, try a proxy, unless a NoProxy directive is active */
     if (!direct_connect) {
         for (i = 0; i < proxies->nelts; i++) {
index a401bf6be4b563cc6b5c300eeac9b89f681357bd..22073230887261e5704fd9be44689a7eaf397cc9 100644 (file)
@@ -175,7 +175,6 @@ typedef struct {
 
 typedef struct proxy_balancer  proxy_balancer;
 typedef struct proxy_worker    proxy_worker;
-typedef struct proxy_conn      proxy_conn;
 typedef struct proxy_conn_pool proxy_conn_pool;
 
 typedef struct {
@@ -255,16 +254,6 @@ struct proxy_balancer {
 #endif
 };
 
-/* per connection data structure for set/get module_config */
-typedef struct {
-    char                  *url;         /* rewtitten url */
-    struct proxy_balancer *balancer;    /* load balancer to use */
-    proxy_worker          *worker;      /* most suitable worker */
-    proxy_conn_rec        *conn_rec;
-    proxy_conn            *conn;
-    void                  *opaque;      /* module private data */
-} proxy_module_conf;
-
 /* hooks */
 
 /* Create a set of PROXY_DECLARE(type), PROXY_DECLARE_NONSTD(type) and 
@@ -359,7 +348,7 @@ PROXY_DECLARE(struct proxy_balancer *) ap_proxy_get_balancer(apr_pool_t *p, prox
 PROXY_DECLARE(const char *) ap_proxy_add_balancer(proxy_balancer **balancer, apr_pool_t *p, proxy_server_conf *conf, const char *url);
 PROXY_DECLARE(void) ap_proxy_add_worker_to_balancer(proxy_balancer *balancer, proxy_worker *worker);
 PROXY_DECLARE(int) ap_proxy_pre_request(proxy_worker **worker, proxy_balancer **balancer, request_rec *r, proxy_server_conf *conf, char **url);
-PROXY_DECLARE(apr_status_t) ap_proxy_determine_connection(apr_pool_t *p, request_rec *r, proxy_server_conf *conf, proxy_module_conf *mconf,
+PROXY_DECLARE(apr_status_t) ap_proxy_determine_connection(apr_pool_t *p, request_rec *r, proxy_server_conf *conf, proxy_worker *worker, proxy_conn_rec *conn,
                                                           apr_pool_t *ppool, apr_uri_t *uri, char **url, const char *proxyname, apr_port_t proxyport,
                                                           char *server_portstr, int server_portstr_size);
 
index 8a24147f4ad2feb24a582b81cb3b137420693a68..8a39c43b026c4564fad8f08abd3af90324957cc2 100644 (file)
@@ -1398,7 +1398,8 @@ static apr_status_t init_conn_worker(proxy_worker *worker, server_rec *s)
 PROXY_DECLARE(apr_status_t)
 ap_proxy_determine_connection(apr_pool_t *p, request_rec *r,
                               proxy_server_conf *conf,
-                              proxy_module_conf *mconf,
+                              proxy_worker *worker,
+                              proxy_conn_rec *conn,
                               apr_pool_t *ppool,
                               apr_uri_t *uri,
                               char **url,
@@ -1433,11 +1434,11 @@ ap_proxy_determine_connection(apr_pool_t *p, request_rec *r,
      */
     /* are we connecting directly, or via a proxy? */
     if (proxyname) {
-        mconf->conn_rec->hostname = apr_pstrdup(ppool, proxyname);
-        mconf->conn_rec->port = proxyport;
+        conn->hostname = apr_pstrdup(ppool, proxyname);
+        conn->port = proxyport;
     } else {
-        mconf->conn_rec->hostname = apr_pstrdup(ppool, uri->hostname);
-        mconf->conn_rec->port = uri->port;
+        conn->hostname = apr_pstrdup(ppool, uri->hostname);
+        conn->port = uri->port;
         *url = apr_pstrcat(p, uri->path, uri->query ? "?" : "",
                            uri->query ? uri->query : "",
                            uri->fragment ? "#" : "",
@@ -1448,16 +1449,16 @@ ap_proxy_determine_connection(apr_pool_t *p, request_rec *r,
      * If dynamic change is needed then set the addr to NULL
      * inside dynamic config to force the lookup.
      */
-    if (!mconf->worker->cp->addr)
-        err = apr_sockaddr_info_get(&(mconf->worker->cp->addr),
-                                    mconf->conn_rec->hostname, APR_UNSPEC,
-                                    mconf->conn_rec->port, 0,
-                                    mconf->worker->cp->pool);
+    if (!worker->cp->addr)
+        err = apr_sockaddr_info_get(&(worker->cp->addr),
+                                    conn->hostname, APR_UNSPEC,
+                                    conn->port, 0,
+                                    worker->cp->pool);
 
     if (err != APR_SUCCESS) {
         return ap_proxyerror(r, HTTP_BAD_GATEWAY,
                              apr_pstrcat(p, "DNS lookup failure for: ",
-                                         mconf->conn_rec->hostname, NULL));
+                                         conn->hostname, NULL));
     }
 
     /* Get the server port for the Via headers */
@@ -1472,7 +1473,7 @@ ap_proxy_determine_connection(apr_pool_t *p, request_rec *r,
     }
 
     /* check if ProxyBlock directive on this host */
-    if (OK != ap_proxy_checkproxyblock(r, conf, mconf->worker->cp->addr)) {
+    if (OK != ap_proxy_checkproxyblock(r, conf, worker->cp->addr)) {
         return ap_proxyerror(r, HTTP_FORBIDDEN,
                              "Connect to remote machine blocked");
     }