aboutsummaryrefslogtreecommitdiffstats
path: root/pathod
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-07-23 15:03:56 +1200
committerAldo Cortesi <aldo@nullcube.com>2012-07-23 15:03:56 +1200
commit1c45f5b05c7e066c28dfd4c9d1cde3b794f8983c (patch)
tree0e0d27af2fff15469824dff159ea034956f5a986 /pathod
parentc7b5faf7dbaab518bbe9942f018861f738ebb2b0 (diff)
downloadmitmproxy-1c45f5b05c7e066c28dfd4c9d1cde3b794f8983c.tar.gz
mitmproxy-1c45f5b05c7e066c28dfd4c9d1cde3b794f8983c.tar.bz2
mitmproxy-1c45f5b05c7e066c28dfd4c9d1cde3b794f8983c.zip
Use policy hook to apply a size limit in pathod, add corresponding cmdline arg.
Diffstat (limited to 'pathod')
-rwxr-xr-xpathod15
1 files changed, 14 insertions, 1 deletions
diff --git a/pathod b/pathod
index 7ba5ad80..052b94bb 100755
--- a/pathod
+++ b/pathod
@@ -25,6 +25,11 @@ if __name__ == "__main__":
help='Serve with SSL.'
)
parser.add_argument(
+ "--limit-size", dest='sizelimit', default=None,
+ type=str,
+ help='Size limit of served responses. Understands size suffixes, i.e. 100k.'
+ )
+ parser.add_argument(
"--keyfile", dest='ssl_keyfile', default=None,
type=str,
help='SSL key file. If not specified, a default key is used.'
@@ -67,12 +72,20 @@ if __name__ == "__main__":
if not args.debug:
logging.disable(logging.DEBUG)
+ sizelimit = None
+ if args.sizelimit:
+ try:
+ sizelimit = utils.parse_size(args.sizelimit)
+ except ValueError, v:
+ parser.error(v)
+
try:
pd = pathod.Pathod(
(args.address, args.port),
ssloptions = ssl,
staticdir = args.staticdir,
- anchors = alst
+ anchors = alst,
+ sizelimit = sizelimit,
)
except pathod.PathodError, v:
parser.error(str(v))