From 118fcef771da97a873c57d8c45f8fd6e0bd1c9b0 Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Wed, 23 Apr 2014 05:02:39 +0200 Subject: [PATCH] Make formparse not depend on input being a limitreader. --- wrw/form.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wrw/form.py b/wrw/form.py index adde1d3..a57a812 100644 --- a/wrw/form.py +++ b/wrw/form.py @@ -7,9 +7,9 @@ def formparse(req): buf = {} buf.update(urllib.parse.parse_qsl(req.query)) if req.ihead.get("Content-Type") == "application/x-www-form-urlencoded": - if req.input.limit > 2 ** 20: + rbody = req.input(2 ** 20) + if len(rbody) >= 2 ** 20: raise ValueError("x-www-form-urlencoded data is absurdly long") - rbody = req.input.read() buf.update(urllib.parse.parse_qsl(rbody.decode("latin1"))) return buf -- 2.11.0