From f336afa913963704aca343d08c0e351f9103aa5b Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Fri, 20 Jul 2012 09:48:09 +0200 Subject: [PATCH] Implementation for Issue #108 --- lib/request/connect.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/request/connect.py b/lib/request/connect.py index 1fe48180b..fa1502e53 100644 --- a/lib/request/connect.py +++ b/lib/request/connect.py @@ -653,10 +653,20 @@ class Connect: get += "%s%s=%s" % (delimiter, name, value) get = urlencode(get, limit=True) - if post and place not in (PLACE.POST, PLACE.SOAP, PLACE.CUSTOM_POST) and hasattr(post, UNENCODED_ORIGINAL_VALUE): - post = getattr(post, UNENCODED_ORIGINAL_VALUE) - elif not conf.skipUrlEncode and place not in (PLACE.SOAP,): - post = urlencode(post) + if post: + if conf.skipUrlEncode is None: + _ = (post or "").strip() + if _.startswith("<") and _.endswith(">"): + msg = "provided POST data looks " + msg += "like it's in XML format. " + msg += "Do you want to turn off URL encoding " + msg += "which is usually causing problems " + msg += "in this kind of situations? [Y/n]" + conf.skipUrlEncode = readInput(msg, default="Y").upper() != "N" + if place not in (PLACE.POST, PLACE.SOAP, PLACE.CUSTOM_POST) and hasattr(post, UNENCODED_ORIGINAL_VALUE): + post = getattr(post, UNENCODED_ORIGINAL_VALUE) + elif not conf.skipUrlEncode and place not in (PLACE.SOAP,): + post = urlencode(post) if timeBasedCompare: if len(kb.responseTimes) < MIN_TIME_RESPONSES: