diff --git a/CHANGES.md b/CHANGES.md
index d34b6ed..e01a199 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -7,6 +7,13 @@ Version 1.42 onwards - https://github.com/Qarj/WebImblaze
---------------------------------
## WebImblaze Release History:
+### Version 1.3.8 - May 30, 2020
+* added {APP_DATA} substitution
+* added {SHELL_QUOTE} substitution
+* added decodebase64 paramater
+* bugfix - don't print directly to STDOUT if runif `paramater` used
+* documented previously undocumented `shell` paramaters substitions {SHELL_ESCAPE}, {SHELL_QUOTE} and {SLASH}
+
### Version 1.3.7 - Mar 24, 2020
* added {SYS_TEMP} substitution
diff --git a/MANUAL.md b/MANUAL.md
index b8b0a48..397dedf 100644
--- a/MANUAL.md
+++ b/MANUAL.md
@@ -1,4 +1,4 @@
-# Manual for WebImblaze version 1.3.7
+# Manual for WebImblaze version 1.3.8
## Overview
@@ -46,6 +46,8 @@
- [Selenium Binaries Location](#selenium-binary)
+ - [App Data](#app-data)
+
- [Sys Temp](#sys-temp)
- [Test Step Files (specifying in configuration file)](#teststepfile)
@@ -152,6 +154,8 @@
- [Test Response Output Control Parameters](#test-response-output-control-parameters)
+ - [decodebase64](#decodebase64)
+
- [decodequotedprintable](#decodequotedprintable)
- [decodesmtp](#decodesmtp)
@@ -780,6 +784,20 @@ to use the Windows or Linux variables at run time.
+#### app-data
+
+Override the WebImblaze default values for the {APP_DATA} substitution.
+
+```xml
+ /tmp/
+ D:\temp\
+```
+
+See the 'Constants set at test run start time' section for the WebImblaze default values.
+
+
+
+
#### sys-temp
Override the WebImblaze default values for the {SYS_TEMP} substitution.
@@ -1465,6 +1483,18 @@ parseresponsePASSWORD: PASSWORD5="|"|
In addition to shell, you can specify `shell1`, `shell2` ... up to `shell20`.
The shell commands are run in numerical order starting from `shell`.
+The `shell` parameters have additional substitutions to the standard substitutions. These are
+designed to make it possible to design shell commands that run on both Linux and Windows.
+
+Constant | Description
+:------- | :----------
+`\` | Changed to `\\` on Linux only due to extra level of (de)escaping in Bash
+**{SLASH}** | Resolves to `\` on Windows and `/` on Linux
+**{SHELL_ESCAPE}** | Resolves to `^` on Windows and `\` on Linux
+**{SHELL_QUOTE}** | Resolves to `"` on Windows and `'` on Linux
+
+Commands starting with `./` are changed to `.\` on Windows.
+
Two special case parameters are also available.
##### readfile
@@ -1892,6 +1922,21 @@ retry: 5
### Test Response Output Control Parameters
+#### decodebase64
+
+Searches the response output for a base64 string and overwrites the response output with the
+decoded version of that string. Will only process one match and response output will be blank
+if nothing found to decode.
+
+Purpose is for decoding base64 encoded emails.
+
+```
+decodebase64: true
+```
+
+
+
+
#### decodequotedprintable
Decodes a quoted-printable response and replaces the response with the decoded version. The decoded
@@ -2655,7 +2700,8 @@ Constant | Description
**{OUTPUTFOLDERNAME}** | Output folder name only - not the full path
**{TESTFILENAME}** | Test file name
**{OPT_PROXY}** | What proxy option was specified via the command line to wi.pl
-**{SYS_TEMP}** | System temporary folder location - defaults to `/tmp/` for Linux and `C:\\temp\\` for Windows.
+**{APP_DATA}** | WebImblaze app data location - defaults to `/var/lib/WebImblaze/` for Linux and `C:\ProgramData\\WebImblaze\\` for Windows
+**{SYS_TEMP}** | System temporary folder location - defaults to `/var/tmp/` for Linux and `C:\\temp\\` for Windows
**{BASEURL}** | Value of `baseurl` specified in your config file
**{BASEURL1}** | Value of `baseurl1` specified in your config file
**{BASEURL2}** | Value of `baseurl2` specified in your config file
diff --git a/README.md b/README.md
index 523d5fe..7dc2b5c 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# WebImblaze 1.3.7
+# WebImblaze 1.3.8
_UTF-8 is now well supported and the default, and gzip response content is now uncompressed automatically._
diff --git a/wi.pl b/wi.pl
index 7e5381c..218f5e9 100755
--- a/wi.pl
+++ b/wi.pl
@@ -10,7 +10,7 @@
use strict;
use vars qw/ $VERSION /;
-$VERSION = '1.3.7';
+$VERSION = '1.3.8';
# This project is a fork of WebInject version 1.41, http://webinject.org/.
# Copyright 2004-2006 Corey Goldberg (corey@goldb.org)
@@ -130,9 +130,11 @@
my $counter = 0; # keeping track of the loop we are up to
my $output_folder_name = 'null'; # current working directory - not full path
-my $sys_temp;
+my ($sys_temp, $app_data);
my $DEFAULT_WINDOWS_SYS_TEMP = "C:\\temp\\";
-my $DEFAULT_LINUX_SYS_TEMP = '/tmp/';
+my $DEFAULT_WINDOWS_APP_DATA = "C:\\ProgramData\\WebImblaze\\";
+my $DEFAULT_LINUX_SYS_TEMP = '/var/tmp/';
+my $DEFAULT_LINUX_APP_DATA = '/var/lib/WebImblaze/';
our ($results_stdout, $results_html, $results_xml);
my $results_xml_file_name;
@@ -237,6 +239,7 @@
dump_json();
decode_smtp();
decode_quoted_printable();
+ decode_base64_and_overwrite_response();
verify();
@@ -436,7 +439,7 @@ sub get_test_step_skip_message {
}
if (defined $case{runif}) {
- print"runif:[$case{runif}]\n";
+ $results_stdout .= "runif:[$case{runif}]\n";
}
if (defined $case{runif} and not $case{runif}) { # evaluate content - truthy or falsy
return 'runif evaluated as falsy';
@@ -1805,11 +1808,13 @@ sub _shell_adjust {
${$_parm} =~ s{^[.]/}{.\\};
${$_parm} =~ s/{SLASH}/\\/g;
${$_parm} =~ s/{SHELL_ESCAPE}/\^/g;
+ ${$_parm} =~ s/{SHELL_QUOTE}/"/g;
} else {
${$_parm} =~ s{\\}{\\\\}g; # need to double back slashes in Linux, otherwise they vanish (unlike Windows shell)
${$_parm} =~ s/{SLASH}/\//g;
${$_parm} =~ s{^[.][/\\]}{perl ./}; # for running perl scripts from within WebImblaze using perlbrew
${$_parm} =~ s/{SHELL_ESCAPE}/\\/g;
+ ${$_parm} =~ s/{SHELL_QUOTE}/'/g;
}
return;
@@ -1858,12 +1863,29 @@ sub decode_quoted_printable {
require MIME::QuotedPrint;
if ($case{decodequotedprintable}) {
- $resp_content = decode('utf8', MIME::QuotedPrint::decode_qp($resp_content)); # decode the response output
+ $resp_content = decode('utf8', MIME::QuotedPrint::decode_qp($resp_content));
}
return;
}
+#------------------------------------------------------------------
+sub decode_base64_and_overwrite_response {
+
+ if (!$case{decodebase64}) { return; }
+
+ require MIME::Base64;
+
+ my $base64_content;
+ while ( $resp_content =~ m/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/gm ) {
+ $base64_content .= $&;
+ }
+
+ $resp_content = decode('utf8', MIME::Base64::decode_base64($base64_content));
+
+ return;
+}
+
#------------------------------------------------------------------
sub verify { # do verification of http response and print status to HTML/XML/STDOUT
@@ -2471,14 +2493,14 @@ sub process_config_file { ## no critic(ProhibitExcessComplexity) # parse config
if ($is_windows) {
$sys_temp = $DEFAULT_WINDOWS_SYS_TEMP;
- if (defined $config->{windows_sys_temp}) {
- $sys_temp = $config->{windows_sys_temp};
- }
+ $app_data = $DEFAULT_WINDOWS_APP_DATA;
+ if (defined $config->{windows_sys_temp}) { $sys_temp = $config->{windows_sys_temp}; }
+ if (defined $config->{windows_app_data}) { $app_data = $config->{windows_app_data}; }
} else {
$sys_temp = $DEFAULT_LINUX_SYS_TEMP;
- if (defined $config->{linux_sys_temp}) {
- $sys_temp = $config->{linux_sys_temp};
- }
+ $app_data = $DEFAULT_LINUX_APP_DATA;
+ if (defined $config->{linux_sys_temp}) { $sys_temp = $config->{linux_sys_temp}; }
+ if (defined $config->{linux_app_data}) { $app_data = $config->{linux_app_data}; }
}
return;
@@ -3095,6 +3117,7 @@ sub convert_back_xml { #converts replaced xml with substitutions
$_[0] =~ s/{COUNTER}/$counter/g;
$_[0] =~ s/{OUTPUTFOLDERNAME}/$output_folder_name/g; # name of the temporary folder being used - not full path
+ $_[0] =~ s/{APP_DATA}/$app_data/g;
$_[0] =~ s/{SYS_TEMP}/$sys_temp/g;
$_[0] =~ s/{OUTPUT}/$results_output_folder/g;
$_[0] =~ s/{PUBLISH}/$opt_publish_full/g;