From 84932346b53f22c107b3b4126c86a753778dad7b Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 19 Dec 2017 08:35:10 +0100 Subject: [PATCH 1/3] fix http request plugin bug data field overwrite bug --- .gitignore | 4 ++++ plugins/httpRequest/httpRequest.py | 12 +++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 7617a01..e02c9e9 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,7 @@ *.log config.ini log/ + +\.project + +\.pydevproject diff --git a/plugins/httpRequest/httpRequest.py b/plugins/httpRequest/httpRequest.py index 56e35a6..f5f5e89 100644 --- a/plugins/httpRequest/httpRequest.py +++ b/plugins/httpRequest/httpRequest.py @@ -68,11 +68,13 @@ def run(typ,freq,data): try: # - # Replace special characters in data Strings for URL + # Make a copy of the data field to not overwrite the data in it + # Replace special characters in dataCopy Strings for URL # - for key in data: - if isinstance(data[key], basestring): - data[key] = urllib.quote(data[key]) + dataCopy = data + for key in dataCopy: + if isinstance(dataCopy[key], basestring): + dataCopy[key] = urllib.quote(dataCopy[key]) # # Get URLs # @@ -90,7 +92,7 @@ def run(typ,freq,data): # replace wildcards # for (i, url) in enumerate(urls): - urls[i] = wildcardHandler.replaceWildcards(urls[i].strip(), data) + urls[i] = wildcardHandler.replaceWildcards(urls[i].strip(), dataCopy) # # HTTP-Request # From 1771c2ec6f9f71b3f378d2468ab5abc22ecf45bc Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 19 Dec 2017 08:36:58 +0100 Subject: [PATCH 2/3] edit CL --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 472e03c..86dd0a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ ##### Removed - Beta Branch aus Readme, Installer und Travis-CI entfernt [#324](https://github.com/Schrolli91/BOSWatch/pull/324) ##### Fixed +- Bug in httpRequest Plugin (data Field wurde überschrieben) [#337](https://github.com/Schrolli91/BOSWatch/pull/337) ##### Security From 0539e33207a8a239e53ecb15ac515c5d8484c667 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 19 Dec 2017 09:05:27 +0100 Subject: [PATCH 3/3] fix copy fail only made a ref not a real copy --- plugins/httpRequest/httpRequest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/httpRequest/httpRequest.py b/plugins/httpRequest/httpRequest.py index f5f5e89..1622a8b 100644 --- a/plugins/httpRequest/httpRequest.py +++ b/plugins/httpRequest/httpRequest.py @@ -71,7 +71,7 @@ def run(typ,freq,data): # Make a copy of the data field to not overwrite the data in it # Replace special characters in dataCopy Strings for URL # - dataCopy = data + dataCopy = dict(data) for key in dataCopy: if isinstance(dataCopy[key], basestring): dataCopy[key] = urllib.quote(dataCopy[key])