Mercurial > stress-tester
changeset 482:92c5b38cc84a
bugfixes
author | Devel 1 |
---|---|
date | Tue, 08 Aug 2017 14:41:43 +0200 |
parents | a150f3998b1c |
children | 0c397865b8f9 |
files | stress-tester/src/main/java/com/passus/st/client/http/filter/HttpCsrfFormFilter.java |
diffstat | 1 files changed, 17 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpCsrfFormFilter.java Tue Aug 08 13:29:37 2017 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpCsrfFormFilter.java Tue Aug 08 14:41:43 2017 +0200 @@ -54,7 +54,16 @@ private final HttpMessageHelper helper = new HttpMessageHelper(); // needs instance, because header decoders are not thread safe private String inputName; - private final Set<ByteString> contentTypesToScan = CONTENT_TYPES_TO_SCAN.stream().map(ByteString::create).collect(Collectors.toSet()); + private final Set<ByteString> contentTypesToScan; + + public HttpCsrfFormFilter() { + contentTypesToScan = CONTENT_TYPES_TO_SCAN.stream().map(ByteString::create).collect(Collectors.toSet()); + } + + public HttpCsrfFormFilter(String inputName, Set<ByteString> contentTypesToScan) { + this.inputName = inputName; + this.contentTypesToScan = new HashSet<>(contentTypesToScan); + } String getInputName() { return inputName; @@ -76,7 +85,10 @@ @Override public void configure(Configuration config) { setInputName((String) config.get("inputName")); - setContentTypesToScan((Collection) config.get("contentTypesToScan")); + Object types = config.get("contentTypesToScan"); + if (types != null) { + setContentTypesToScan((Collection) types); + } } @Override @@ -96,6 +108,8 @@ parameters.set(inputName, entry.value); helper.setFormUrlencoded(request, parameters); LOGGER.debug("Token inserted."); + } else { + LOGGER.debug("Could not find request parameter {}", parameters); } } catch (IOException ex) { LOGGER.debug("Could not decode request."); @@ -149,7 +163,7 @@ @Override public HttpCsrfFormFilter instanceForWorker(int index) { - return new HttpCsrfFormFilter(); + return new HttpCsrfFormFilter(inputName, contentTypesToScan); } public static class NodeDefCreator implements NodeDefinitionCreator {