statichttprepo: abort if opener mode is 'r+' or 'rb+'
authorAdrian Buehlmann <adrian@cadifra.com>
Fri, 18 Feb 2011 01:19:01 +0100
changeset 13533 b4f5f76386f2
parent 13532 d4c2f2ac3ff7
child 13535 0d3cce1de233
statichttprepo: abort if opener mode is 'r+' or 'rb+' The old version of the check failed to catch modifying modes 'r+' and 'rb+'.
mercurial/statichttprepo.py
--- a/mercurial/statichttprepo.py	Fri Mar 04 14:11:15 2011 +0100
+++ b/mercurial/statichttprepo.py	Fri Feb 18 01:19:01 2011 +0100
@@ -71,7 +71,7 @@
         """return a function that opens files over http"""
         p = base
         def o(path, mode="r", atomictemp=None):
-            if 'a' in mode or 'w' in mode:
+            if mode not in ('r', 'rb'):
                 raise IOError('Permission denied')
             f = "/".join((p, urllib.quote(path)))
             return httprangereader(f, urlopener)