Modified: 
subversion/branches/shelve-checkpoint/subversion/mod_authz_svn/mod_authz_svn.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/shelve-checkpoint/subversion/mod_authz_svn/mod_authz_svn.c?rev=1829257&r1=1829256&r2=1829257&view=diff
==============================================================================
--- 
subversion/branches/shelve-checkpoint/subversion/mod_authz_svn/mod_authz_svn.c 
(original)
+++ 
subversion/branches/shelve-checkpoint/subversion/mod_authz_svn/mod_authz_svn.c 
Mon Apr 16 12:21:02 2018
@@ -401,10 +401,12 @@ static svn_authz_t *
 get_access_conf(request_rec *r, authz_svn_config_rec *conf,
                 apr_pool_t *scratch_pool)
 {
+  const char *cache_key = NULL;
   const char *access_file;
   const char *groups_file;
   const char *repos_path;
   const char *repos_url = NULL;
+  void *user_data = NULL;
   svn_authz_t *access_conf = NULL;
   svn_error_t *svn_err = SVN_NO_ERROR;
   dav_error *dav_err;
@@ -464,19 +466,31 @@ get_access_conf(request_rec *r, authz_sv
                     "Path to groups file is %s", groups_file);
     }
 
-  svn_err = svn_repos_authz_read3(&access_conf,
-                                  access_file, groups_file,
-                                  TRUE, NULL,
-                                  r->connection->pool, scratch_pool);
+  cache_key = apr_pstrcat(scratch_pool, "mod_authz_svn:",
+                          access_file, groups_file, SVN_VA_NULL);
+  apr_pool_userdata_get(&user_data, cache_key, r->connection->pool);
+  access_conf = user_data;
+  if (access_conf == NULL)
+    {
+      svn_err = svn_repos_authz_read3(&access_conf, access_file,
+                                      groups_file, TRUE, NULL,
+                                      r->connection->pool,
+                                      scratch_pool);
 
-  if (svn_err)
-    {
-      log_svn_error(APLOG_MARK, r,
-                    "Failed to load the mod_authz_svn config:",
-                    svn_err, scratch_pool);
-      access_conf = NULL;
+      if (svn_err)
+        {
+          log_svn_error(APLOG_MARK, r,
+                        "Failed to load the mod_authz_svn config:",
+                        svn_err, scratch_pool);
+          access_conf = NULL;
+        }
+      else
+        {
+          /* Cache the open repos for the next request on this connection */
+          apr_pool_userdata_set(access_conf, cache_key,
+                                NULL, r->connection->pool);
+        }
     }
-
   return access_conf;
 }
 


Reply via email to