[Inteproxy-commits] r227 - in trunk: . inteproxy_server

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Mar 18 08:01:51 CET 2010


Author: bjoern
Date: 2010-03-18 08:01:50 +0100 (Thu, 18 Mar 2010)
New Revision: 227

Added:
   trunk/inteproxy_server/
   trunk/inteproxy_server/create-rewrite-rules.py
Removed:
   trunk/apache/
   trunk/create-rewrite-rules.py
Log:
Restructuring directory layout. Moved server stuff to its own directory. 


Deleted: trunk/create-rewrite-rules.py
===================================================================
--- trunk/create-rewrite-rules.py	2010-02-12 17:50:14 UTC (rev 226)
+++ trunk/create-rewrite-rules.py	2010-03-18 07:01:50 UTC (rev 227)
@@ -1,84 +0,0 @@
-#! /usr/bin/env python
-
-"""
-Usage:
-  create-rewrite-rules.py --config-file=... [-o outfile]
-
-Script to convert InteProxy's configuration to Apache RewriteRule
-definitions.  The script reads the InteProxy configuration file
-specified with --config-file and writes a RewriteRule for all entries in
-the configuration file for which credentials are specified.  The output
-is written to outfile.  If no outfile is specified, the output is
-written to stdout.
-"""
-
-import sys
-import optparse
-import re
-from urllib import quote_plus
-
-import inteproxy.resources
-import inteproxy.config
-from inteproxy.transcoder import pattern_to_regex
-
-
-def read_config(config_filename):
-    return inteproxy.config.read_config(config_filename)
-
-
-def rule_for_owsproxy(rule):
-    orig_url = "/" + rule.host + rule.path
-    if rule.user is None or rule.password is None:
-        print >>sys.stderr, ("Missing credentials for url %r"
-                             % orig_url)
-        return None
-    host_regex = pattern_to_regex(rule.host, character_set="[^/]")
-    path_regex = pattern_to_regex(rule.path, character_set=".")
-    port_regex = ""
-    if rule.port is not None:
-        port_regex = re.escape(":%d" % rule.port)
-    return ("RewriteRule ^/%s%s%s$ https:/$0?user=%s&password=%s [QSA,P]\n"
-            % (host_regex, port_regex, path_regex,
-               re.escape(quote_plus(rule.user)),
-               re.escape(quote_plus(rule.password))))
-
-
-def create_rewrite_rules(config, outfile):
-    """Writes the RewriteRules from config to outfile"""
-    for rule in config.rules:
-        if rule.scheme != "owsproxy":
-            print >>sys.stderr, ("Unsupported scheme %r for %s/%s"
-                                 % (rule.scheme, rule.host, rule.path))
-            continue
-        rewrite_rule = rule_for_owsproxy(rule)
-        if rewrite_rule:
-            outfile.write(rewrite_rule)
-
-
-def create_config_parser():
-    """Creates an OptionParser instance for the script"""
-    parser = optparse.OptionParser()
-    parser.set_defaults(
-        config_file=inteproxy.resources.default_config_file(),
-        credentials_file=inteproxy.resources.default_credentials_file())
-    parser.add_option("--config-file", help=("InteProxy configuration file"))
-    parser.add_option("--output-file", "-o",
-                      help=("Output file (by default output is written to"
-                            " stdout)"))
-    return parser
-
-
-def main():
-    parser = create_config_parser()
-    opts, rest = parser.parse_args()
-    config = read_config(opts.config_file)
-
-    outfile = sys.stdout
-    if opts.output_file:
-        outfile = open(opts.output_file, "w")
-
-    create_rewrite_rules(config, outfile)
-
-
-if __name__  == "__main__":
-    main()

Copied: trunk/inteproxy_server (from rev 226, trunk/apache)


Property changes on: trunk/inteproxy_server
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/inteproxy_server/create-rewrite-rules.py (from rev 226, trunk/create-rewrite-rules.py)


Property changes on: trunk/inteproxy_server/create-rewrite-rules.py
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Id Revision
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native



More information about the Inteproxy-commits mailing list