You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Justin Erenkrantz <ju...@erenkrantz.com> on 2006/12/08 15:23:34 UTC

Fwd: svn commit: r22606 - trunk/subversion/mod_dav_svn

FYI, as we discussed briefly at the summit, I finally integrated the
dav-mirror stuff into trunk.  So, this allows cheap transparent
read-only SVN WebDAV-based servers to be deployed.

I also updated notes/webdav-proxy
(http://svn.collab.net/repos/svn/trunk/notes/webdav-proxy) so people
can figure out what it's all about.

Enjoy!  -- justin

---------- Forwarded message ----------
From: jerenkrantz@tigris.org <je...@tigris.org>
Date: Dec 8, 2006 4:02 PM
Subject: svn commit: r22606 - trunk/subversion/mod_dav_svn
To: svn@subversion.tigris.org


Author: jerenkrantz
Date: Fri Dec  8 07:02:26 2006
New Revision: 22606

Log:
mod_dav_svn: Merge in dav-mirror branch into trunk.

This was discussed at the summit, but I haven't had a tuit until now.

* subversion/mod_dav_svn/mod_dav_svn.c
  (dir_conf_t): Add in root_dir and master_uri fields.
  (create_dir_config): Track our root directories.
  (merge_dir_config): Merge in root_dir and master_uri fields.
  (SVNMasterURI_cmd): Implement SVNMasterURI directive.
  (dav_svn__get_root_dir, dav_svn__get_master_uri): Expose new fields.
  (cmds): Declare SVNMasterURI directive.
  (register_hooks): Register the dav-mirror hooks.
* subversion/mod_dav_svn/dav_svn.h
  (dav_svn__get_root_dir, dav_svn__get_master_uri,
   dav_svn__proxy_merge_fixup, dav_svn__location_in_filter,
   dav_svn__location_header_filter, dav_svn__location_body_filter): Declare.
* subversion/mod_dav_svn/mirror.c: New file.
  (dav_svn__proxy_merge_fixup, dav_svn__location_in_filter,
   dav_svn__location_header_filter, dav_svn__location_body_filter): Implement.

(This log message describes the diff from trunk; for history see the branch.)


Added:
   trunk/subversion/mod_dav_svn/mirror.c
      - copied unchanged from r22605,
/branches/dav-mirror/subversion/mod_dav_svn/mirror.c
Modified:
   trunk/subversion/mod_dav_svn/dav_svn.h
   trunk/subversion/mod_dav_svn/mod_dav_svn.c

Modified: trunk/subversion/mod_dav_svn/dav_svn.h
URL: http://svn.collab.net/viewvc/svn/trunk/subversion/mod_dav_svn/dav_svn.h?pathrev=22606&r1=22605&r2=22606
==============================================================================
--- trunk/subversion/mod_dav_svn/dav_svn.h      (original)
+++ trunk/subversion/mod_dav_svn/dav_svn.h      Fri Dec  8 07:02:26 2006
@@ -292,6 +292,11 @@
 /* Return the URI of an XSL transform stylesheet */
 const char *dav_svn__get_xslt_uri(request_rec *r);

+/* Return the master URI (for mirroring) */
+const char * dav_svn__get_master_uri(request_rec *r);
+
+/* Return the root directory */
+const char * dav_svn__get_root_dir(request_rec *r);

 /*** activity.c ***/

@@ -686,6 +691,30 @@
                                    ap_filter_t *output,
                                    apr_pool_t *pool);

+/*** mirror.c ***/
+
+/* Perform the fixup hook for the R request.  */
+int dav_svn__proxy_merge_fixup(request_rec *r);
+
+/* An Apache input filter which rewrites the locations in headers and
+   request body.  It reads from filter F using BB data, MODE mode, BLOCK
+   blocking strategy, and READBYTES. */
+apr_status_t dav_svn__location_in_filter(ap_filter_t *f,
+                                         apr_bucket_brigade *bb,
+                                         ap_input_mode_t mode,
+                                         apr_read_type_e block,
+                                         apr_off_t readbytes);
+
+/* An Apache output filter F which rewrites the response headers for
+ * location headers.  It will modify the stream in BB. */
+apr_status_t dav_svn__location_header_filter(ap_filter_t *f,
+                                             apr_bucket_brigade *bb);
+
+/* An Apache output filter F which rewrites the response body for
+ * location headers.  It will modify the stream in BB. */
+apr_status_t dav_svn__location_body_filter(ap_filter_t *f,
+                                           apr_bucket_brigade *bb);
+

 #ifdef __cplusplus
 }

Modified: trunk/subversion/mod_dav_svn/mod_dav_svn.c
URL: http://svn.collab.net/viewvc/svn/trunk/subversion/mod_dav_svn/mod_dav_svn.c?pathrev=22606&r1=22605&r2=22606
==============================================================================
--- trunk/subversion/mod_dav_svn/mod_dav_svn.c  (original)
+++ trunk/subversion/mod_dav_svn/mod_dav_svn.c  Fri Dec  8 07:02:26 2006
@@ -65,6 +65,8 @@
   enum conf_flag autoversioning;  /* whether autoversioning is active */
   enum conf_flag do_path_authz;   /* whether GET subrequests are active */
   enum conf_flag list_parentpath; /* whether to allow GET of parentpath */
+  const char *root_dir;              /* our top-level directory */
+  const char *master_uri;            /* URI to the master SVN repos */
 } dir_conf_t;


@@ -137,6 +139,8 @@
   /* NOTE: dir==NULL creates the default per-dir config */
   dir_conf_t *conf = apr_pcalloc(p, sizeof(*conf));

+  conf->root_dir = dir;
+
   return conf;
 }

@@ -151,12 +155,15 @@
   newconf = apr_pcalloc(p, sizeof(*newconf));

   newconf->fs_path = INHERIT_VALUE(parent, child, fs_path);
+  newconf->master_uri = INHERIT_VALUE(parent, child, master_uri);
   newconf->repo_name = INHERIT_VALUE(parent, child, repo_name);
   newconf->xslt_uri = INHERIT_VALUE(parent, child, xslt_uri);
   newconf->fs_parent_path = INHERIT_VALUE(parent, child, fs_parent_path);
   newconf->autoversioning = INHERIT_VALUE(parent, child, autoversioning);
   newconf->do_path_authz = INHERIT_VALUE(parent, child, do_path_authz);
   newconf->list_parentpath = INHERIT_VALUE(parent, child, list_parentpath);
+  /* Prefer our parent's value over our new one - hence the swap. */
+  newconf->root_dir = INHERIT_VALUE(child, parent, root_dir);

   return newconf;
 }
@@ -174,6 +181,17 @@


 static const char *
+SVNMasterURI_cmd(cmd_parms *cmd, void *config, const char *arg1)
+{
+  dir_conf_t *conf = config;
+
+  conf->master_uri = apr_pstrdup(cmd->pool, arg1);
+
+  return NULL;
+}
+
+
+static const char *
 SVNIndexXSLT_cmd(cmd_parms *cmd, void *config, const char *arg1)
 {
   dir_conf_t *conf = config;
@@ -366,6 +384,26 @@


 const char *
+dav_svn__get_root_dir(request_rec *r)
+{
+  dir_conf_t *conf;
+
+  conf = ap_get_module_config(r->per_dir_config, &dav_svn_module);
+  return conf->root_dir;
+}
+
+
+const char *
+dav_svn__get_master_uri(request_rec *r)
+{
+  dir_conf_t *conf;
+
+  conf = ap_get_module_config(r->per_dir_config, &dav_svn_module);
+  return conf->master_uri;
+}
+
+
+const char *
 dav_svn__get_xslt_uri(request_rec *r)
 {
   dir_conf_t *conf;
@@ -577,6 +615,10 @@
   AP_INIT_FLAG("SVNListParentPath", SVNListParentPath_cmd, NULL,
                ACCESS_CONF|RSRC_CONF, "allow GET of SVNParentPath."),

+  /* per directory/location */
+  AP_INIT_TAKE1("SVNMasterURI", SVNMasterURI_cmd, NULL, ACCESS_CONF,
+                "specifies a URI to access a master Subversion repository"),
+
   { NULL }
 };

@@ -614,6 +656,15 @@
   dav_hook_insert_all_liveprops(dav_svn__insert_all_liveprops, NULL, NULL,
                                 APR_HOOK_MIDDLE);
   dav_register_liveprop_group(pconf, &dav_svn__liveprop_group);
+
+  /* Proxy / mirroring filters and fixups */
+  ap_register_output_filter("LocationRewrite", dav_svn__location_header_filter,
+                            NULL, AP_FTYPE_CONTENT_SET);
+  ap_register_output_filter("ReposRewrite", dav_svn__location_body_filter,
+                            NULL, AP_FTYPE_CONTENT_SET);
+  ap_register_input_filter("IncomingRewrite", dav_svn__location_in_filter,
+                           NULL, AP_FTYPE_CONTENT_SET);
+  ap_hook_fixups(dav_svn__proxy_merge_fixup, NULL, NULL, APR_HOOK_MIDDLE);
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: svn-unsubscribe@subversion.tigris.org
For additional commands, e-mail: svn-help@subversion.tigris.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Fwd: svn commit: r22606 - trunk/subversion/mod_dav_svn

Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
On 12/8/06, svnlgo@mobsol.be <sv...@mobsol.be> wrote:
> Justin,
>
> the Windows buildbot is failing on this commit. Error log:

Thanks.  Should be fixed in r22611.  -- justi

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Fwd: svn commit: r22606 - trunk/subversion/mod_dav_svn

Posted by sv...@mobsol.be.
Justin,

the Windows buildbot is failing on this commit. Error log:
..\..\..\subversion\mod_dav_svn\mirror.c(97): warning C4013:
'dav_svn_get_special_uri' undefined; assuming extern returning int
..\..\..\subversion\mod_dav_svn\mirror.c(92): warning C4101: 'full_path' :
unreferenced local variable
..\..\..\subversion\mod_dav_svn\mirror.c(127): warning C4101: 'foo' :
unreferenced local variable
..\..\..\subversion\mod_dav_svn\mirror.c(155): warning C4101: 'master_len' :
unreferenced local variable
..\..\..\subversion\mod_dav_svn\mirror.c(192): warning C4101: 'full_path' :
unreferenced local variable
..\..\..\subversion\mod_dav_svn\mirror.c(217): warning C4101: 'foo' :
unreferenced local variable
mirror.obj : error LNK2019: unresolved external symbol _dav_svn_get_special_uri
referenced in function _dav_svn__location_in_filter
..\..\..\Release\subversion\mod_dav_svn\mod_dav_svn.so : fatal error LNK1120: 1
unresolved externals

Function dav_svn_get_special_uri was renamed in r20946 to
dav_svn__get_special_uri.

Lieven



Quoting Justin Erenkrantz <ju...@erenkrantz.com>:

> FYI, as we discussed briefly at the summit, I finally integrated the
> dav-mirror stuff into trunk.  So, this allows cheap transparent
> read-only SVN WebDAV-based servers to be deployed.
>
> I also updated notes/webdav-proxy
> (http://svn.collab.net/repos/svn/trunk/notes/webdav-proxy) so people
> can figure out what it's all about.
>
> Enjoy!  -- justin
>
> ---------- Forwarded message ----------
> From: jerenkrantz@tigris.org <je...@tigris.org>
> Date: Dec 8, 2006 4:02 PM
> Subject: svn commit: r22606 - trunk/subversion/mod_dav_svn
> To: svn@subversion.tigris.org
>
>
> Author: jerenkrantz
> Date: Fri Dec  8 07:02:26 2006
> New Revision: 22606
>
> Log:
> mod_dav_svn: Merge in dav-mirror branch into trunk.
>
> This was discussed at the summit, but I haven't had a tuit until now.
>
> * subversion/mod_dav_svn/mod_dav_svn.c
>   (dir_conf_t): Add in root_dir and master_uri fields.
>   (create_dir_config): Track our root directories.
>   (merge_dir_config): Merge in root_dir and master_uri fields.
>   (SVNMasterURI_cmd): Implement SVNMasterURI directive.
>   (dav_svn__get_root_dir, dav_svn__get_master_uri): Expose new fields.
>   (cmds): Declare SVNMasterURI directive.
>   (register_hooks): Register the dav-mirror hooks.
> * subversion/mod_dav_svn/dav_svn.h
>   (dav_svn__get_root_dir, dav_svn__get_master_uri,
>    dav_svn__proxy_merge_fixup, dav_svn__location_in_filter,
>    dav_svn__location_header_filter, dav_svn__location_body_filter): Declare.
> * subversion/mod_dav_svn/mirror.c: New file.
>   (dav_svn__proxy_merge_fixup, dav_svn__location_in_filter,
>    dav_svn__location_header_filter, dav_svn__location_body_filter):
> Implement.
>
> (This log message describes the diff from trunk; for history see the branch.)
>
>
> Added:
>    trunk/subversion/mod_dav_svn/mirror.c
>       - copied unchanged from r22605,
> /branches/dav-mirror/subversion/mod_dav_svn/mirror.c
> Modified:
>    trunk/subversion/mod_dav_svn/dav_svn.h
>    trunk/subversion/mod_dav_svn/mod_dav_svn.c
>
> Modified: trunk/subversion/mod_dav_svn/dav_svn.h
> URL:
>
http://svn.collab.net/viewvc/svn/trunk/subversion/mod_dav_svn/dav_svn.h?pathrev=22606&r1=22605&r2=22606
> ==============================================================================
> --- trunk/subversion/mod_dav_svn/dav_svn.h      (original)
> +++ trunk/subversion/mod_dav_svn/dav_svn.h      Fri Dec  8 07:02:26 2006
> @@ -292,6 +292,11 @@
>  /* Return the URI of an XSL transform stylesheet */
>  const char *dav_svn__get_xslt_uri(request_rec *r);
>
> +/* Return the master URI (for mirroring) */
> +const char * dav_svn__get_master_uri(request_rec *r);
> +
> +/* Return the root directory */
> +const char * dav_svn__get_root_dir(request_rec *r);
>
>  /*** activity.c ***/
>
> @@ -686,6 +691,30 @@
>                                     ap_filter_t *output,
>                                     apr_pool_t *pool);
>
> +/*** mirror.c ***/
> +
> +/* Perform the fixup hook for the R request.  */
> +int dav_svn__proxy_merge_fixup(request_rec *r);
> +
> +/* An Apache input filter which rewrites the locations in headers and
> +   request body.  It reads from filter F using BB data, MODE mode, BLOCK
> +   blocking strategy, and READBYTES. */
> +apr_status_t dav_svn__location_in_filter(ap_filter_t *f,
> +                                         apr_bucket_brigade *bb,
> +                                         ap_input_mode_t mode,
> +                                         apr_read_type_e block,
> +                                         apr_off_t readbytes);
> +
> +/* An Apache output filter F which rewrites the response headers for
> + * location headers.  It will modify the stream in BB. */
> +apr_status_t dav_svn__location_header_filter(ap_filter_t *f,
> +                                             apr_bucket_brigade *bb);
> +
> +/* An Apache output filter F which rewrites the response body for
> + * location headers.  It will modify the stream in BB. */
> +apr_status_t dav_svn__location_body_filter(ap_filter_t *f,
> +                                           apr_bucket_brigade *bb);
> +
>
>  #ifdef __cplusplus
>  }
>
> Modified: trunk/subversion/mod_dav_svn/mod_dav_svn.c
> URL:
>
http://svn.collab.net/viewvc/svn/trunk/subversion/mod_dav_svn/mod_dav_svn.c?pathrev=22606&r1=22605&r2=22606
> ==============================================================================
> --- trunk/subversion/mod_dav_svn/mod_dav_svn.c  (original)
> +++ trunk/subversion/mod_dav_svn/mod_dav_svn.c  Fri Dec  8 07:02:26 2006
> @@ -65,6 +65,8 @@
>    enum conf_flag autoversioning;  /* whether autoversioning is active */
>    enum conf_flag do_path_authz;   /* whether GET subrequests are active */
>    enum conf_flag list_parentpath; /* whether to allow GET of parentpath */
> +  const char *root_dir;              /* our top-level directory */
> +  const char *master_uri;            /* URI to the master SVN repos */
>  } dir_conf_t;
>
>
> @@ -137,6 +139,8 @@
>    /* NOTE: dir==NULL creates the default per-dir config */
>    dir_conf_t *conf = apr_pcalloc(p, sizeof(*conf));
>
> +  conf->root_dir = dir;
> +
>    return conf;
>  }
>
> @@ -151,12 +155,15 @@
>    newconf = apr_pcalloc(p, sizeof(*newconf));
>
>    newconf->fs_path = INHERIT_VALUE(parent, child, fs_path);
> +  newconf->master_uri = INHERIT_VALUE(parent, child, master_uri);
>    newconf->repo_name = INHERIT_VALUE(parent, child, repo_name);
>    newconf->xslt_uri = INHERIT_VALUE(parent, child, xslt_uri);
>    newconf->fs_parent_path = INHERIT_VALUE(parent, child, fs_parent_path);
>    newconf->autoversioning = INHERIT_VALUE(parent, child, autoversioning);
>    newconf->do_path_authz = INHERIT_VALUE(parent, child, do_path_authz);
>    newconf->list_parentpath = INHERIT_VALUE(parent, child, list_parentpath);
> +  /* Prefer our parent's value over our new one - hence the swap. */
> +  newconf->root_dir = INHERIT_VALUE(child, parent, root_dir);
>
>    return newconf;
>  }
> @@ -174,6 +181,17 @@
>
>
>  static const char *
> +SVNMasterURI_cmd(cmd_parms *cmd, void *config, const char *arg1)
> +{
> +  dir_conf_t *conf = config;
> +
> +  conf->master_uri = apr_pstrdup(cmd->pool, arg1);
> +
> +  return NULL;
> +}
> +
> +
> +static const char *
>  SVNIndexXSLT_cmd(cmd_parms *cmd, void *config, const char *arg1)
>  {
>    dir_conf_t *conf = config;
> @@ -366,6 +384,26 @@
>
>
>  const char *
> +dav_svn__get_root_dir(request_rec *r)
> +{
> +  dir_conf_t *conf;
> +
> +  conf = ap_get_module_config(r->per_dir_config, &dav_svn_module);
> +  return conf->root_dir;
> +}
> +
> +
> +const char *
> +dav_svn__get_master_uri(request_rec *r)
> +{
> +  dir_conf_t *conf;
> +
> +  conf = ap_get_module_config(r->per_dir_config, &dav_svn_module);
> +  return conf->master_uri;
> +}
> +
> +
> +const char *
>  dav_svn__get_xslt_uri(request_rec *r)
>  {
>    dir_conf_t *conf;
> @@ -577,6 +615,10 @@
>    AP_INIT_FLAG("SVNListParentPath", SVNListParentPath_cmd, NULL,
>                 ACCESS_CONF|RSRC_CONF, "allow GET of SVNParentPath."),
>
> +  /* per directory/location */
> +  AP_INIT_TAKE1("SVNMasterURI", SVNMasterURI_cmd, NULL, ACCESS_CONF,
> +                "specifies a URI to access a master Subversion repository"),
> +
>    { NULL }
>  };
>
> @@ -614,6 +656,15 @@
>    dav_hook_insert_all_liveprops(dav_svn__insert_all_liveprops, NULL, NULL,
>                                  APR_HOOK_MIDDLE);
>    dav_register_liveprop_group(pconf, &dav_svn__liveprop_group);
> +
> +  /* Proxy / mirroring filters and fixups */
> +  ap_register_output_filter("LocationRewrite",
> dav_svn__location_header_filter,
> +                            NULL, AP_FTYPE_CONTENT_SET);
> +  ap_register_output_filter("ReposRewrite", dav_svn__location_body_filter,
> +                            NULL, AP_FTYPE_CONTENT_SET);
> +  ap_register_input_filter("IncomingRewrite", dav_svn__location_in_filter,
> +                           NULL, AP_FTYPE_CONTENT_SET);
> +  ap_hook_fixups(dav_svn__proxy_merge_fixup, NULL, NULL, APR_HOOK_MIDDLE);
>  }
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: svn-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: svn-help@subversion.tigris.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
>
>




----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org