Index: subversion/svnserve/main.c =================================================================== --- subversion/svnserve/main.c (revision 32295) +++ subversion/svnserve/main.c (working copy) @@ -137,6 +137,7 @@ #define SVNSERVE_OPT_SERVICE 262 #define SVNSERVE_OPT_CONFIG_FILE 263 #define SVNSERVE_OPT_LOG_FILE 264 +#define SVNSERVE_OPT_VIRTUAL_HOST 265 static const apr_getopt_option_t svnserve__options[] = { @@ -199,6 +200,10 @@ N_("tunnel username (default is current uid's name)\n" " " "[mode: tunnel]")}, + {"virtual-host", SVNSERVE_OPT_VIRTUAL_HOST, 0, + N_("virtual host mode (look for repo in directory\n" + " " + "of provided hostname)")}, {"help", 'h', 0, N_("display this help")}, {"version", SVNSERVE_OPT_VERSION, 0, N_("show program version information")}, @@ -413,6 +418,7 @@ params.pwdb = NULL; params.authzdb = NULL; params.log_file = NULL; + params.vhost = FALSE; while (1) { @@ -532,6 +538,10 @@ pool)); break; + case SVNSERVE_OPT_VIRTUAL_HOST: + params.vhost = TRUE; + break; + case SVNSERVE_OPT_LOG_FILE: SVN_INT_ERR(svn_utf_cstring_to_utf8(&log_filename, arg, pool)); log_filename = svn_path_internal_style(log_filename, pool); Index: subversion/svnserve/serve.c =================================================================== --- subversion/svnserve/serve.c (revision 32295) +++ subversion/svnserve/serve.c (working copy) @@ -2818,8 +2818,11 @@ if (path == NULL) return svn_error_createf(SVN_ERR_BAD_URL, NULL, "Non-svn URL passed to svn server: '%s'", url); - path = strchr(path, '/'); - path = (path == NULL) ? "" : path + 1; + if (! b->vhost) + { + path = strchr(path, '/'); + path = (path == NULL) ? "" : path + 1; + } /* Decode URI escapes from the path. */ path = svn_path_uri_decode(path, pool); @@ -2938,6 +2941,7 @@ b.log_file = params->log_file; b.pool = pool; b.use_sasl = FALSE; + b.vhost = params->vhost; /* Send greeting. We don't support version 1 any more, so we can * send an empty mechlist. */ Index: subversion/svnserve/server.h =================================================================== --- subversion/svnserve/server.h (revision 32295) +++ subversion/svnserve/server.h (working copy) @@ -49,6 +49,7 @@ svn_boolean_t use_sasl; /* Use Cyrus SASL for authentication; always false if SVN_HAVE_SASL not defined */ apr_file_t *log_file; /* Log filehandle. */ + svn_boolean_t vhost; /* Use virtual-host-based path to repo. */ apr_pool_t *pool; } server_baton_t; @@ -96,6 +97,9 @@ /* A filehandle open for writing logs to; possibly NULL. */ apr_file_t *log_file; + + /* Use virtual-host-based path to repo. */ + svn_boolean_t vhost; } serve_params_t; /* Serve the connection CONN according to the parameters PARAMS. */