Index: svn-log |
=================================================================== |
--- svn-log (revision 192835) |
+++ svn-log (working copy) |
@@ -1,22 +1,28 @@ |
-#!/usr/bin/python2.4 |
+#!/usr/bin/python |
import os |
+import re |
import subprocess |
import sys |
-print 'content-type: text/xml' |
-print '' |
- |
try: |
- options = {} |
- query_string = os.environ['QUERY_STRING'].split('&') |
- for q in query_string: |
- opt = q.split('=') |
- options[opt[0]] = opt[1] |
- |
- c = ['svn', 'log', '--xml', '-v', '-r', options['range'], options['url']] |
- sys.stdout.flush() |
- subprocess.call(c) |
+ options = {} |
+ query_string = os.environ['QUERY_STRING'].split('&') |
+ for q in query_string: |
+ opt = q.split('=') |
+ options[opt[0]] = opt[1] |
+ if ('range' not in options or 'url' not in options or |
+ not (options['url'].startswith('http://src.chromium.org/svn/') or |
+ options['url'].startswith('http://webrtc.googlecode.com/svn/')) or |
+ not re.match(r'^(\d+):(\d+)$', options['range'])): |
+ print 'Content-Type: text/html' |
+ print '' |
+ print '' |
+ sys.exit(1) |
+ c = ['svn', 'log', '--xml', '-v', '-r', options['range'], options['url']] |
+ print 'Content-Type: text/xml' |
+ print '' |
+ sys.stdout.flush() |
+ subprocess.call(c) |
except Exception, e: |
- print e |
- |
+ sys.stderr.write(e) |