diff options
| author | Aldo Cortesi <aldo@corte.si> | 2013-06-15 15:35:57 -0700 |
|---|---|---|
| committer | Aldo Cortesi <aldo@corte.si> | 2013-06-15 15:35:57 -0700 |
| commit | 27092454bf6004c8b9cd79de5e38daa3ff37fc64 (patch) | |
| tree | 3468c07b2e7b5a99bc26ed98d276afa2a968c342 | |
| parent | 9e7f08acea55e2da53f5f2c93d6948c447cf1861 (diff) | |
| parent | 0382b809ea7dcaf91a81cc3ab506f83a341a20b6 (diff) | |
| download | mitmproxy-27092454bf6004c8b9cd79de5e38daa3ff37fc64.tar.gz mitmproxy-27092454bf6004c8b9cd79de5e38daa3ff37fc64.tar.bz2 mitmproxy-27092454bf6004c8b9cd79de5e38daa3ff37fc64.zip | |
Merge pull request #10 from mhils/master
always read files in binary mode
| -rw-r--r-- | libpathod/language.py | 4 | ||||
| -rw-r--r-- | test/test_language.py | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/libpathod/language.py b/libpathod/language.py index f3fe4daa..5cce6fde 100644 --- a/libpathod/language.py +++ b/libpathod/language.py @@ -181,7 +181,7 @@ class RandomGenerator: class FileGenerator: def __init__(self, path): self.path = path - self.fp = file(path, "r") + self.fp = file(path, "rb") self.map = mmap.mmap(self.fp.fileno(), 0, prot=mmap.PROT_READ) def __len__(self): @@ -957,7 +957,7 @@ def read_file(settings, s): raise FileAccessDenied("File access outside of configured directory") if not os.path.isfile(s): raise FileAccessDenied("File not readable") - return file(s, "r").read() + return file(s, "rb").read() def parse_response(settings, s): diff --git a/test/test_language.py b/test/test_language.py index 40967935..18865761 100644 --- a/test/test_language.py +++ b/test/test_language.py @@ -95,7 +95,7 @@ class TestValueFile: v = language.Value.parseString("<path")[0] with tutils.tmpdir() as t: p = os.path.join(t, "path") - f = open(p, "w") + f = open(p, "wb") f.write("x"*10000) f.close() @@ -143,7 +143,7 @@ class TestMisc: def test_filegenerator(self): with tutils.tmpdir() as t: path = os.path.join(t, "foo") - f = open(path, "w") + f = open(path, "wb") f.write("x"*10000) f.close() g = language.FileGenerator(path) |
