Alien-SVN

 view release on metacpan or  search on metacpan

src/subversion/subversion/mod_dav_svn/mirror.c  view on Meta::CPAN

/*
 * mirror.c: Use a transparent proxy to mirror Subversion instances.
 *
 * ====================================================================
 *    Licensed to the Apache Software Foundation (ASF) under one
 *    or more contributor license agreements.  See the NOTICE file
 *    distributed with this work for additional information
 *    regarding copyright ownership.  The ASF licenses this file
 *    to you under the Apache License, Version 2.0 (the
 *    "License"); you may not use this file except in compliance
 *    with the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing,
 *    software distributed under the License is distributed on an
 *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 *    KIND, either express or implied.  See the License for the
 *    specific language governing permissions and limitations
 *    under the License.
 * ====================================================================
 */

#include <assert.h>

#include <apr_strmatch.h>

#include <httpd.h>
#include <http_core.h>

#include "private/svn_fspath.h"

#include "dav_svn.h"


/* Tweak the request record R, and add the necessary filters, so that
   the request is ready to be proxied away.  MASTER_URI is the URI
   specified in the SVNMasterURI Apache configuration value.
   URI_SEGMENT is the URI bits relative to the repository root (but if
   non-empty, *does* have a leading slash delimiter).
   MASTER_URI and URI_SEGMENT are not URI-encoded. */
static int proxy_request_fixup(request_rec *r,
                               const char *master_uri,
                               const char *uri_segment)
{
    if (uri_segment[0] != '\0' && uri_segment[0] != '/')
      {
        ap_log_rerror(APLOG_MARK, APLOG_ERR, SVN_ERR_BAD_CONFIG_VALUE, r,
                     "Invalid URI segment '%s' in slave fixup",
                      uri_segment);
        return HTTP_INTERNAL_SERVER_ERROR;
      }

    r->proxyreq = PROXYREQ_REVERSE;
    r->uri = r->unparsed_uri;
    r->filename = (char *) svn_path_uri_encode(apr_pstrcat(r->pool, "proxy:",
                                                           master_uri,
                                                           uri_segment,
                                                           (char *)NULL),
                                               r->pool);
    r->handler = "proxy-server";



( run in 1.259 second using v1.01-cache-2.11-cpan-39bf76dae61 )