mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 05:45:59 +03:00
Add initial unit testing framework. See #438.
This commit is contained in:
parent
2657154eaa
commit
499c3f3167
@ -51,6 +51,19 @@ CFLAGS = -O2 -g -Wuninitialized -Wall -Wmissing-prototypes -Wshadow -Wunused-var
|
||||
|
||||
all: local-shared-build
|
||||
|
||||
### Experimental Test Framework (UNIX only right now)
|
||||
TESTOBJS = \
|
||||
re.o re_operators.o re_actions.o re_tfns.o re_variables.o \
|
||||
msc_logging.o msc_xml.o msc_multipart.o modsecurity.o msc_parsers.o msc_util.o msc_pcre.o \
|
||||
persist_dbm.o msc_reqbody.o msc_geo.o acmp.o
|
||||
|
||||
msc-test: msc-test.c ${TESTOBJS}
|
||||
@${CC} -I .. -I `${top_dir}/bin/${APXS} -q INCLUDEDIR` ${INCLUDES} ${DEFS} -L ${top_dir}/lib -o msc-test ${TESTOBJS} msc-test.c -lapr-1 -laprutil-1 -lpcre -lxml2
|
||||
|
||||
test: msc-test
|
||||
t/run-tests.pl
|
||||
|
||||
clean:
|
||||
-rm -f *.o *.lo *.slo *.la *~ .libs
|
||||
|
||||
-rm -f *.o *.lo *.slo *.la *~ .libs msc-test
|
||||
|
||||
.PHONY: all clean test
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
MOD_SECURITY2 = mod_security2 apache2_config apache2_io apache2_util \
|
||||
re re_operators re_actions re_tfns re_variables \
|
||||
msc_logging msc_xml msc_multipart modsecurity msc_parsers msc_util msc_pcre \
|
||||
|
260
apache2/msc-test.c
Normal file
260
apache2/msc-test.c
Normal file
@ -0,0 +1,260 @@
|
||||
/*
|
||||
* ModSecurity for Apache 2.x, http://www.modsecurity.org/
|
||||
* Copyright (c) 2004-2007 Breach Security, Inc. (http://www.breach.com/)
|
||||
*
|
||||
* You should have received a copy of the licence along with this
|
||||
* program (stored in the file "LICENSE"). If the file is missing,
|
||||
* or if you have any other questions related to the licence, please
|
||||
* write to Breach Security, Inc. at support@breach.com.
|
||||
*
|
||||
*/
|
||||
#include <apr.h>
|
||||
|
||||
#include "modsecurity.h"
|
||||
#include "re.h"
|
||||
|
||||
#define ISHEX(X) (((X >= '0')&&(X <= '9')) || ((X >= 'a')&&(X <= 'f')) || ((X >= 'A')&&(X <= 'F')))
|
||||
|
||||
#define TFNS_DIR "t/tfns"
|
||||
|
||||
#define BUFLEN 8192
|
||||
|
||||
modsec_build_type_rec DSOLOCAL modsec_build_type[] = {
|
||||
{ "dev", 1 }, /* Development build */
|
||||
{ "rc", 3 }, /* Release Candidate build */
|
||||
{ "", 9 }, /* Production build */
|
||||
{ "breach", 9 }, /* Breach build */
|
||||
{ "trunk", 9 }, /* Trunk build */
|
||||
{ NULL, -1 } /* terminator */
|
||||
};
|
||||
|
||||
#define RESULT_SUCCESS 0
|
||||
#define RESULT_ERROR -1
|
||||
#define RESULT_MISMATCHED -2
|
||||
#define RESULT_WRONGSIZE -3
|
||||
#define RESULT_WRONGRET -4
|
||||
|
||||
/* Globals */
|
||||
apr_pool_t *mp = NULL;
|
||||
msc_engine *modsecurity = NULL;
|
||||
|
||||
|
||||
/* Stubs */
|
||||
char *format_error_log_message(apr_pool_t *mp, error_message *em) {
|
||||
return "FAKE ERROR LOG MESSAGE";
|
||||
}
|
||||
|
||||
apr_status_t send_error_bucket(modsec_rec *msr, ap_filter_t *f, int status) {
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
int apache2_exec(modsec_rec *msr, const char *command, const char **argv, char **output) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *get_apr_error(apr_pool_t *p, apr_status_t rc) {
|
||||
return "FAKE APR ERROR";
|
||||
}
|
||||
|
||||
void msr_log(modsec_rec *msr, int level, const char *text, ...) {
|
||||
}
|
||||
|
||||
const char *ap_get_remote_host(conn_rec *conn, void *dir_config, int type, int *str_is_ip) {
|
||||
return "FAKE-REMOTE-HOST";
|
||||
}
|
||||
|
||||
char *get_env_var(request_rec *r, char *name) {
|
||||
return "FAKE-ENV-VAR";
|
||||
}
|
||||
|
||||
apr_status_t unixd_set_global_mutex_perms(apr_global_mutex_t *gmutex) {
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
apr_status_t unixd_set_proc_mutex_perms(apr_proc_mutex_t *pmutex) {
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
static unsigned char hex2dec(unsigned char *what) {
|
||||
register unsigned char digit;
|
||||
|
||||
digit = (what[0] >= 'A' ? ((what[0] & 0xdf) - 'A') + 10 : (what[0] - '0'));
|
||||
digit *= 16;
|
||||
digit += (what[1] >= 'A' ? ((what[1] & 0xdf) - 'A') + 10 : (what[1] - '0'));
|
||||
|
||||
return digit;
|
||||
}
|
||||
|
||||
static unsigned char *unescape_inplace(unsigned char *str, apr_size_t *len)
|
||||
{
|
||||
apr_size_t i, j;
|
||||
for (i = j = 0; i < *len; j++) {
|
||||
if ((str[i] == '\\') && (i + 3 < *len) && (str[i + 1] == 'x') && ISHEX(str[i + 2]) && ISHEX(str[i + 3]) ) {
|
||||
str[j] = hex2dec(str + i + 2);
|
||||
i += 4;
|
||||
}
|
||||
else {
|
||||
str[j] = str[i++];
|
||||
}
|
||||
}
|
||||
*len = j;
|
||||
|
||||
while (j < i) {
|
||||
str[j++] = '\0';
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
static char *escape(unsigned char *str, apr_size_t *len)
|
||||
{
|
||||
char *new = apr_pcalloc(mp, (*len * 4) + 1);
|
||||
apr_size_t i, j;
|
||||
for (i = j = 0; i < *len; i++) {
|
||||
if ((str[i] >= 0x20) && (str[i] <= 0x7e)) {
|
||||
new[j++] = str[i];
|
||||
}
|
||||
else {
|
||||
sprintf(new + j, "\\x%02x", str[i]);
|
||||
j += 4;
|
||||
}
|
||||
}
|
||||
*len = j;
|
||||
|
||||
return new;
|
||||
}
|
||||
|
||||
|
||||
static int test_tfn(const char *name, unsigned char *input, long input_len, unsigned char **rval, long *rval_len, char **errmsg)
|
||||
{
|
||||
int rc = -1;
|
||||
msre_tfn_metadata *metadata = NULL;
|
||||
const apr_array_header_t *arr = apr_table_elts(modsecurity->msre->tfns);
|
||||
|
||||
metadata = (msre_tfn_metadata *)apr_table_get(modsecurity->msre->tfns, name);
|
||||
|
||||
*errmsg = NULL;
|
||||
|
||||
if (metadata == NULL) {
|
||||
*errmsg = apr_psprintf(mp, "Failed to fetch TFN \"%s\".", name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = metadata->execute(mp, input, input_len, (char **)rval, rval_len);
|
||||
|
||||
if (rc < 0) {
|
||||
*errmsg = apr_psprintf(mp, "Failed to execute TFN \"%s\".", name);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, const char * const argv[])
|
||||
{
|
||||
apr_file_t *fd;
|
||||
unsigned char buf[BUFLEN];
|
||||
apr_size_t nbytes = BUFLEN;
|
||||
unsigned char input[BUFLEN];
|
||||
const char *type = NULL;
|
||||
const char *name = NULL;
|
||||
unsigned char *expected = NULL;
|
||||
const char *returnval = NULL;
|
||||
char *p = NULL;
|
||||
apr_size_t input_len = 0;
|
||||
apr_size_t expected_len = 0;
|
||||
char *errmsg = NULL;
|
||||
unsigned char *out = NULL;
|
||||
long out_len = 0;
|
||||
int rc = 0;
|
||||
int result = 0;
|
||||
|
||||
apr_app_initialize(&argc, &argv, NULL);
|
||||
atexit(apr_terminate);
|
||||
|
||||
apr_pool_create(&mp, NULL);
|
||||
|
||||
if (argc < 4) {
|
||||
fprintf(stderr, "Usage: %s <type> <name> <expected> [<returnval>]\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
modsecurity = modsecurity_create(mp, MODSEC_OFFLINE);
|
||||
|
||||
type = argv[1];
|
||||
name = argv[2];
|
||||
expected_len = strlen(argv[3]);
|
||||
expected = apr_pmemdup(mp, argv[3], expected_len);
|
||||
unescape_inplace(expected, &expected_len);
|
||||
if (argc >= 5) {
|
||||
returnval = argv[4];
|
||||
}
|
||||
|
||||
if (apr_file_open_stdin(&fd, mp) != APR_SUCCESS) {
|
||||
fprintf(stderr, "Failed to open stdin\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
memset(buf, 0, BUFLEN);
|
||||
rc = apr_file_read(fd, buf, &nbytes);
|
||||
if ((rc != APR_EOF) && (rc != APR_SUCCESS)) {
|
||||
fprintf(stderr, "Failed to read data\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (nbytes < 0) {
|
||||
fprintf(stderr, "Error reading data\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
apr_file_close(fd);
|
||||
|
||||
/* Make a copy as transformations are done in-place */
|
||||
memcpy(input, buf, BUFLEN);
|
||||
input_len = nbytes;
|
||||
|
||||
if (strcmp("tfns", type) == 0) {
|
||||
/* TFNS */
|
||||
int ret = returnval ? atoi(returnval) : -8888;
|
||||
rc = test_tfn(name, input, input_len, &out, &out_len, &errmsg);
|
||||
if ((ret != -8888) && (rc != ret)) {
|
||||
fprintf(stderr, "Returned %d (expected %d)\n", rc, ret);
|
||||
result = RESULT_WRONGRET;
|
||||
}
|
||||
else if (expected_len != out_len) {
|
||||
fprintf(stderr, "Lenth %" APR_SIZE_T_FMT " (expected %" APR_SIZE_T_FMT ")\n", out_len, expected_len);
|
||||
result = RESULT_WRONGSIZE;
|
||||
}
|
||||
else {
|
||||
result = memcmp(expected, out, expected_len) ? RESULT_MISMATCHED : RESULT_SUCCESS;
|
||||
}
|
||||
}
|
||||
else if (strcmp("operators", type) == 0) {
|
||||
/* OPERATORS */
|
||||
fprintf(stderr, "Type not implemented yet: \"%s\"\n", type);
|
||||
exit(1);
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "Unknown type: \"%s\"\n", type);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (result != RESULT_SUCCESS) {
|
||||
apr_size_t s0len = nbytes;
|
||||
const char *s0 = escape(buf, &s0len);
|
||||
apr_size_t s1len = out_len;
|
||||
const char *s1 = escape(out, &s1len);
|
||||
apr_size_t s2len = expected_len;
|
||||
const char *s2 = escape(expected, &s2len);
|
||||
|
||||
fprintf(stderr, " Input: '%s' len=%" APR_SIZE_T_FMT "\n"
|
||||
"Output: '%s' len=%" APR_SIZE_T_FMT "\n"
|
||||
"Expect: '%s' len=%" APR_SIZE_T_FMT "\n",
|
||||
s0, nbytes, s1, out_len, s2, expected_len);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
1
apache2/t/operators/beginsWith.t
Normal file
1
apache2/t/operators/beginsWith.t
Normal file
@ -0,0 +1 @@
|
||||
|
1
apache2/t/operators/contains.t
Normal file
1
apache2/t/operators/contains.t
Normal file
@ -0,0 +1 @@
|
||||
|
1
apache2/t/operators/containsWord.t
Normal file
1
apache2/t/operators/containsWord.t
Normal file
@ -0,0 +1 @@
|
||||
|
1
apache2/t/operators/endsWith.t
Normal file
1
apache2/t/operators/endsWith.t
Normal file
@ -0,0 +1 @@
|
||||
|
1
apache2/t/operators/eq.t
Normal file
1
apache2/t/operators/eq.t
Normal file
@ -0,0 +1 @@
|
||||
|
1
apache2/t/operators/ge.t
Normal file
1
apache2/t/operators/ge.t
Normal file
@ -0,0 +1 @@
|
||||
|
1
apache2/t/operators/geoLookup.t
Normal file
1
apache2/t/operators/geoLookup.t
Normal file
@ -0,0 +1 @@
|
||||
|
1
apache2/t/operators/gt.t
Normal file
1
apache2/t/operators/gt.t
Normal file
@ -0,0 +1 @@
|
||||
|
1
apache2/t/operators/inspectFile.t
Normal file
1
apache2/t/operators/inspectFile.t
Normal file
@ -0,0 +1 @@
|
||||
|
1
apache2/t/operators/le.t
Normal file
1
apache2/t/operators/le.t
Normal file
@ -0,0 +1 @@
|
||||
|
1
apache2/t/operators/lt.t
Normal file
1
apache2/t/operators/lt.t
Normal file
@ -0,0 +1 @@
|
||||
|
1
apache2/t/operators/m.t
Normal file
1
apache2/t/operators/m.t
Normal file
@ -0,0 +1 @@
|
||||
|
1
apache2/t/operators/noMatch.t
Normal file
1
apache2/t/operators/noMatch.t
Normal file
@ -0,0 +1 @@
|
||||
|
1
apache2/t/operators/pm.t
Normal file
1
apache2/t/operators/pm.t
Normal file
@ -0,0 +1 @@
|
||||
|
1
apache2/t/operators/pmFromFile.t
Normal file
1
apache2/t/operators/pmFromFile.t
Normal file
@ -0,0 +1 @@
|
||||
|
1
apache2/t/operators/rbl.t
Normal file
1
apache2/t/operators/rbl.t
Normal file
@ -0,0 +1 @@
|
||||
|
1
apache2/t/operators/rx.t
Normal file
1
apache2/t/operators/rx.t
Normal file
@ -0,0 +1 @@
|
||||
|
1
apache2/t/operators/streq.t
Normal file
1
apache2/t/operators/streq.t
Normal file
@ -0,0 +1 @@
|
||||
|
1
apache2/t/operators/unconditionalMatch.t
Normal file
1
apache2/t/operators/unconditionalMatch.t
Normal file
@ -0,0 +1 @@
|
||||
|
1
apache2/t/operators/validateByteRange.t
Normal file
1
apache2/t/operators/validateByteRange.t
Normal file
@ -0,0 +1 @@
|
||||
|
1
apache2/t/operators/validateDTD.t
Normal file
1
apache2/t/operators/validateDTD.t
Normal file
@ -0,0 +1 @@
|
||||
|
1
apache2/t/operators/validateSchema.t
Normal file
1
apache2/t/operators/validateSchema.t
Normal file
@ -0,0 +1 @@
|
||||
|
1
apache2/t/operators/validateUrlEncoding.t
Normal file
1
apache2/t/operators/validateUrlEncoding.t
Normal file
@ -0,0 +1 @@
|
||||
|
1
apache2/t/operators/validateUtf8Encoding.t
Normal file
1
apache2/t/operators/validateUtf8Encoding.t
Normal file
@ -0,0 +1 @@
|
||||
|
7
apache2/t/operators/verifyCC.t
Normal file
7
apache2/t/operators/verifyCC.t
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
type => "operators",
|
||||
name => "verifyCC",
|
||||
param => "\d{15,16}",
|
||||
input => "1234567890123456",
|
||||
rc => 0,
|
||||
},
|
1
apache2/t/operators/within.t
Normal file
1
apache2/t/operators/within.t
Normal file
@ -0,0 +1 @@
|
||||
|
109
apache2/t/run-tests.pl
Executable file
109
apache2/t/run-tests.pl
Executable file
@ -0,0 +1,109 @@
|
||||
#!/usr/bin/perl
|
||||
use strict;
|
||||
use File::Basename qw(basename dirname);
|
||||
|
||||
my @TYPES = qw(tfns operators);
|
||||
my $TEST = "./msc-test";
|
||||
my $SCRIPT = basename($0);
|
||||
my $SCRIPTDIR = dirname($0);
|
||||
my $PASSED = 0;
|
||||
my $TOTAL = 0;
|
||||
|
||||
if (defined $ARGV[0]) {
|
||||
runfile(dirname($ARGV[0]), basename($ARGV[0]));
|
||||
done();
|
||||
}
|
||||
|
||||
for my $type (sort @TYPES) {
|
||||
my $dir = "$SCRIPTDIR/$type";
|
||||
my @cfg = ();
|
||||
|
||||
# Get test names
|
||||
opendir(DIR, "$dir") or quit(1, "Failed to open \"$dir\": $!");
|
||||
@cfg = grep { /\.t$/ && -f "$dir/$_" } readdir(DIR);
|
||||
closedir(DIR);
|
||||
|
||||
for my $cfg (sort @cfg) {
|
||||
runfile($dir, $cfg);
|
||||
}
|
||||
|
||||
}
|
||||
done();
|
||||
|
||||
|
||||
sub runfile {
|
||||
my($dir, $cfg) = @_;
|
||||
my $fn = "$dir/$cfg";
|
||||
my @data = ();
|
||||
my $edata;
|
||||
my @C = ();
|
||||
my $n = 0;
|
||||
my $pass = 0;
|
||||
|
||||
open(CFG, "<$fn") or quit(1, "Failed to open \"$fn\": $!");
|
||||
@data = <CFG>;
|
||||
|
||||
$edata = q/@C = (/ . join("", @data) . q/)/;
|
||||
eval $edata;
|
||||
quit(1, "Failed to read test data \"$cfg\": $@") if ($@);
|
||||
|
||||
unless (@C) {
|
||||
msg("\nNo tests defined for $fn");
|
||||
return;
|
||||
}
|
||||
|
||||
msg("\nLoaded ".@C." tests from $fn");
|
||||
for my $t (@C) {
|
||||
my %t = %{$t || {}};
|
||||
my $id = sprintf("%6d", $n + 1);
|
||||
my $in = $t{input};
|
||||
my $out = escape($t{output}); # Escape so we can send via commandline
|
||||
quit(1, "Failed to interpret output \"$cfg\": $@") if ($@);
|
||||
my $rc = 0;
|
||||
|
||||
open(TEST, "|-", $TEST, $t{type}, $t{name}, $out, (exists($t{ret}) ? ($t{ret}) : ())) or quit(1, "Failed to execute test \"$cfg\": $!");
|
||||
print TEST "$in";
|
||||
close TEST;
|
||||
|
||||
$n++;
|
||||
|
||||
$rc = $?;
|
||||
$pass += $rc ? 0 : 1;
|
||||
msg(sprintf("%s) %s \"%s\": %s", $id, $t{type}, $t{name}, ($rc ? "failed" : "passed")));
|
||||
|
||||
}
|
||||
|
||||
$TOTAL += $n;
|
||||
$PASSED += $pass;
|
||||
|
||||
msg(sprintf("Passed: %2d; Failed %2d", $pass, ($n - $pass)));
|
||||
}
|
||||
|
||||
sub escape {
|
||||
my @new = ();
|
||||
for my $c (split(//, $_[0])) {
|
||||
push @new, ((ord($c) >= 0x20 and ord($c) <= 0x7e) ? $c : sprintf("\\x%02x", ord($c)));
|
||||
}
|
||||
join('', @new);
|
||||
}
|
||||
|
||||
sub msg {
|
||||
print STDOUT "@_\n" if (@_);
|
||||
}
|
||||
|
||||
sub quit {
|
||||
my($ec,$msg) = @_;
|
||||
$ec = 0 unless (defined $_[0]);
|
||||
|
||||
msg("$msg") if (defined $msg);
|
||||
|
||||
exit $ec;
|
||||
}
|
||||
|
||||
sub done {
|
||||
if ($PASSED != $TOTAL) {
|
||||
quit(1, "\nOnly $PASSED/$TOTAL tests passed.");
|
||||
}
|
||||
|
||||
quit(0, "\nAll tests passed ($TOTAL).");
|
||||
}
|
51
apache2/t/tfns/base64Decode.t
Normal file
51
apache2/t/tfns/base64Decode.t
Normal file
@ -0,0 +1,51 @@
|
||||
### Empty
|
||||
{
|
||||
type => "tfns",
|
||||
name => "base64Decode",
|
||||
input => "",
|
||||
output => "",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
### Test values with varying lengths to check padding
|
||||
{
|
||||
type => "tfns",
|
||||
name => "base64Decode",
|
||||
input => "VGVzdENhc2U=",
|
||||
output => "TestCase",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "base64Decode",
|
||||
input => "VGVzdENhc2Ux",
|
||||
output => "TestCase1",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "base64Decode",
|
||||
input => "VGVzdENhc2UxMg==",
|
||||
output => "TestCase12",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
|
||||
### Check with a NUL
|
||||
{
|
||||
type => "tfns",
|
||||
name => "base64Decode",
|
||||
input => "VGVzdABDYXNl",
|
||||
output => "Test\0Case",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
### Invalid
|
||||
# What should happen here? Probably just fail and leave alone.
|
||||
{
|
||||
type => "tfns",
|
||||
name => "base64Decode",
|
||||
input => "VGVzdENhc2U=\0VGVzdENhc2U=",
|
||||
output => "VGVzdENhc2U=\0VGVzdENhc2U=",
|
||||
ret => 0,
|
||||
},
|
40
apache2/t/tfns/base64Encode.t
Normal file
40
apache2/t/tfns/base64Encode.t
Normal file
@ -0,0 +1,40 @@
|
||||
### Empty
|
||||
{
|
||||
type => "tfns",
|
||||
name => "base64Encode",
|
||||
input => "",
|
||||
output => "",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
### Test values with varying lengths to check padding
|
||||
{
|
||||
type => "tfns",
|
||||
name => "base64Encode",
|
||||
input => "TestCase",
|
||||
output => "VGVzdENhc2U=",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "base64Encode",
|
||||
input => "TestCase1",
|
||||
output => "VGVzdENhc2Ux",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "base64Encode",
|
||||
input => "TestCase12",
|
||||
output => "VGVzdENhc2UxMg==",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
### Check with a NUL
|
||||
{
|
||||
type => "tfns",
|
||||
name => "base64Encode",
|
||||
input => "Test\0Case",
|
||||
output => "VGVzdABDYXNl",
|
||||
ret => 1,
|
||||
},
|
50
apache2/t/tfns/compressWhitespace.t
Normal file
50
apache2/t/tfns/compressWhitespace.t
Normal file
@ -0,0 +1,50 @@
|
||||
### Empty
|
||||
{
|
||||
type => "tfns",
|
||||
name => "compressWhitespace",
|
||||
input => "",
|
||||
output => "",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
### Nothing
|
||||
{
|
||||
type => "tfns",
|
||||
name => "compressWhitespace",
|
||||
input => "TestCase",
|
||||
output => "TestCase",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "compressWhitespace",
|
||||
input => "Test\0Case",
|
||||
output => "Test\0Case",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "compressWhitespace",
|
||||
input => "Test Case",
|
||||
output => "Test Case",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
|
||||
### Compress space/tab
|
||||
{
|
||||
type => "tfns",
|
||||
name => "compressWhitespace",
|
||||
input => " Test \t Case ",
|
||||
output => " Test Case ",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
### Pretty much everything in one
|
||||
{
|
||||
type => "tfns",
|
||||
name => "compressWhitespace",
|
||||
input => "This is a test case with a tab \t, vtab \x0b, newline \x0a, return \x0d, formfeed \f, and a NUL\0 in it with a CRLF at the end.\x0d\x0a",
|
||||
output => "This is a test case with a tab , vtab , newline , return , formfeed , and a NUL\0 in it with a CRLF at the end. ",
|
||||
ret => 1,
|
||||
},
|
92
apache2/t/tfns/escapeSeqDecode.t
Normal file
92
apache2/t/tfns/escapeSeqDecode.t
Normal file
@ -0,0 +1,92 @@
|
||||
### Empty
|
||||
{
|
||||
type => "tfns",
|
||||
name => "escapeSeqDecode",
|
||||
input => "",
|
||||
output => "",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
### Nothing
|
||||
{
|
||||
type => "tfns",
|
||||
name => "escapeSeqDecode",
|
||||
input => "TestCase",
|
||||
output => "TestCase",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "escapeSeqDecode",
|
||||
input => "Test\0Case",
|
||||
output => "Test\0Case",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
### Valid Sequences
|
||||
{
|
||||
type => "tfns",
|
||||
name => "escapeSeqDecode",
|
||||
input => "\\a\\b\\f\\n\\r\\t\\v\\?\\'\\\"\\0\\12\\123\\x00\\xff",
|
||||
output => "\a\b\f\x0a\x0d\t\x0b?'\"\x00\x0a\x53\x00\xff",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "escapeSeqDecode",
|
||||
input => "\\a\\b\\f\\n\\r\\t\\v\0\\?\\'\\\"\\0\\12\\123\\x00\\xff",
|
||||
output => "\a\b\f\x0a\x0d\t\x0b\0?'\"\x00\x0a\x53\x00\xff",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
### Invalid Sequences
|
||||
# \8 and \9 are not octal
|
||||
# \666 is a byte overflow (0x1b6) and should be truncated to a byte as \xff
|
||||
# \xag and \xga are not hex,
|
||||
# \0123 is \012 + '3'
|
||||
{
|
||||
type => "tfns",
|
||||
name => "escapeSeqDecode",
|
||||
input => "\\8\\9\\666\\xag\\xga\\0123",
|
||||
output => "89\xffxagxga\x0a3",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
# \x, \x0 lack enough hex digits
|
||||
{
|
||||
type => "tfns",
|
||||
name => "escapeSeqDecode",
|
||||
input => "\\x",
|
||||
output => "x",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "escapeSeqDecode",
|
||||
input => "\\x\\x0",
|
||||
output => "xx0",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "escapeSeqDecode",
|
||||
input => "\\x\\x0\0",
|
||||
output => "xx0\0",
|
||||
ret => 1,
|
||||
},
|
||||
# A forward slash with nothing after
|
||||
{
|
||||
type => "tfns",
|
||||
name => "escapeSeqDecode",
|
||||
input => "\\",
|
||||
output => "\\",
|
||||
ret => 0,
|
||||
},
|
||||
# A forward slash with NUL after
|
||||
{
|
||||
type => "tfns",
|
||||
name => "escapeSeqDecode",
|
||||
input => "\\\0",
|
||||
output => "\0",
|
||||
ret => 1,
|
||||
},
|
50
apache2/t/tfns/hexDecode.t
Normal file
50
apache2/t/tfns/hexDecode.t
Normal file
@ -0,0 +1,50 @@
|
||||
### Empty
|
||||
{
|
||||
type => "tfns",
|
||||
name => "hexDecode",
|
||||
input => "",
|
||||
output => "",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
### Basic
|
||||
{
|
||||
type => "tfns",
|
||||
name => "hexDecode",
|
||||
input => "5465737443617365",
|
||||
output => "TestCase",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
### Basic w/NULL
|
||||
{
|
||||
type => "tfns",
|
||||
name => "hexDecode",
|
||||
input => "546573740043617365",
|
||||
output => "Test\0Case",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
### Invalid
|
||||
# What should happen here? Probably just fail and leave alone.
|
||||
{
|
||||
type => "tfns",
|
||||
name => "hexDecode",
|
||||
input => "01234567890a0z01234567890a",
|
||||
output => "01234567890a0z01234567890a",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "hexDecode",
|
||||
input => "01234567890az",
|
||||
output => "01234567890az",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "hexDecode",
|
||||
input => "01234567890a0",
|
||||
output => "01234567890a0",
|
||||
ret => 0,
|
||||
},
|
26
apache2/t/tfns/hexEncode.t
Normal file
26
apache2/t/tfns/hexEncode.t
Normal file
@ -0,0 +1,26 @@
|
||||
### Empty
|
||||
{
|
||||
type => "tfns",
|
||||
name => "hexEncode",
|
||||
input => "",
|
||||
output => "",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
### Basic
|
||||
{
|
||||
type => "tfns",
|
||||
name => "hexEncode",
|
||||
input => "TestCase",
|
||||
output => "5465737443617365",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
### Basic w/NULL
|
||||
{
|
||||
type => "tfns",
|
||||
name => "hexEncode",
|
||||
input => "Test\0Case",
|
||||
output => "546573740043617365",
|
||||
ret => 1,
|
||||
},
|
58
apache2/t/tfns/htmlEntityDecode.t
Normal file
58
apache2/t/tfns/htmlEntityDecode.t
Normal file
@ -0,0 +1,58 @@
|
||||
### Empty
|
||||
{
|
||||
type => "tfns",
|
||||
name => "htmlEntityDecode",
|
||||
input => "",
|
||||
output => "",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
### Nothing
|
||||
{
|
||||
type => "tfns",
|
||||
name => "htmlEntityDecode",
|
||||
input => "TestCase",
|
||||
output => "TestCase",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "htmlEntityDecode",
|
||||
input => "Test\0Case",
|
||||
output => "Test\0Case",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
### Valid
|
||||
# With ;
|
||||
{
|
||||
type => "tfns",
|
||||
name => "htmlEntityDecode",
|
||||
input => "��  � \0d"&<> ",
|
||||
output => "\0\0\x20\x20\0\x20\0\x64\"&<>\xa0",
|
||||
ret => 1,
|
||||
},
|
||||
# Without ;
|
||||
{
|
||||
type => "tfns",
|
||||
name => "htmlEntityDecode",
|
||||
input => "��  � \0d"&<> ",
|
||||
output => "\0\0\x20\x20\0\x20\0\x64\"&<>\xa0",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
### Invalid
|
||||
{
|
||||
type => "tfns",
|
||||
name => "htmlEntityDecode",
|
||||
input => "&#xg;&#Xg;&#xg0;g;&#a;\0&#a2;a&#a00;a0;
a;&foo;",
|
||||
output => "&#xg;&#Xg;&#xg0;\x02g;&#a;\0&#a2;\x03a&#a00;\x01a0;\x0aa;&foo;",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "htmlEntityDecode",
|
||||
input => "&#xg&#Xg&#xg0g&#a\0&#a2a&#a00a0
a&foo",
|
||||
output => "&#xg&#Xg&#xg0\x02g&#a\0&#a2\x03a&#a00\x01a0\x0aa&foo",
|
||||
ret => 1,
|
||||
},
|
129
apache2/t/tfns/jsDecode.t
Normal file
129
apache2/t/tfns/jsDecode.t
Normal file
@ -0,0 +1,129 @@
|
||||
### Empty
|
||||
{
|
||||
type => "tfns",
|
||||
name => "jsDecode",
|
||||
input => "",
|
||||
output => "",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
### Nothing
|
||||
{
|
||||
type => "tfns",
|
||||
name => "jsDecode",
|
||||
input => "TestCase",
|
||||
output => "TestCase",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "jsDecode",
|
||||
input => "Test\0Case",
|
||||
output => "Test\0Case",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
### Valid Sequences
|
||||
{
|
||||
type => "tfns",
|
||||
name => "jsDecode",
|
||||
input => "\\a\\b\\f\\n\\r\\t\\v\\?\\'\\\"\\0\\12\\123\\x00\\xff\\u0021\\uff01",
|
||||
output => "\a\b\f\x0a\x0d\t\x0b?'\"\x00\x0a\x53\x00\xff\x21\x21",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "jsDecode",
|
||||
input => "\\a\\b\\f\\n\\r\\t\\v\0\\?\\'\\\"\\0\\12\\123\\x00\\xff\\u0021\\uff01",
|
||||
output => "\a\b\f\x0a\x0d\t\x0b\0?'\"\x00\x0a\x53\x00\xff\x21\x21",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
### Invalid Sequences
|
||||
# \8 and \9 are not octal
|
||||
# \666 is \66 + '6' (JS does not allow the overflow as C does)
|
||||
# \u00ag, \u00ga, \u0zaa, \uz0aa are not hex
|
||||
# \xag and \xga are not hex,
|
||||
# \0123 is \012 + '3'
|
||||
{
|
||||
type => "tfns",
|
||||
name => "jsDecode",
|
||||
input => "\\8\\9\\666\\u00ag\\u00ga\\u0zaa\\uz0aa\\xag\\xga\\0123\\u00a",
|
||||
output => "89\x366u00agu00gau0zaauz0aaxagxga\x0a3u00a",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
# \x, \x0 lack enough hex digits
|
||||
{
|
||||
type => "tfns",
|
||||
name => "jsDecode",
|
||||
input => "\\x",
|
||||
output => "x",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "jsDecode",
|
||||
input => "\\x\\x0",
|
||||
output => "xx0",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "jsDecode",
|
||||
input => "\\x\\x0\0",
|
||||
output => "xx0\0",
|
||||
ret => 1,
|
||||
},
|
||||
# \u, \u0 \u01, \u012 lack enough hex digits
|
||||
{
|
||||
type => "tfns",
|
||||
name => "jsDecode",
|
||||
input => "\\u",
|
||||
output => "u",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "jsDecode",
|
||||
input => "\\u\\u0",
|
||||
output => "uu0",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "jsDecode",
|
||||
input => "\\u\\u0\\u01",
|
||||
output => "uu0u01",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "jsDecode",
|
||||
input => "\\u\\u0\\u01\\u012",
|
||||
output => "uu0u01u012",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "jsDecode",
|
||||
input => "\\u\\u0\\u01\\u012\0",
|
||||
output => "uu0u01u012\0",
|
||||
ret => 1,
|
||||
},
|
||||
# A forward slash with nothing after
|
||||
{
|
||||
type => "tfns",
|
||||
name => "jsDecode",
|
||||
input => "\\",
|
||||
output => "\\",
|
||||
ret => 0,
|
||||
},
|
||||
# A forward slash with NUL after
|
||||
{
|
||||
type => "tfns",
|
||||
name => "jsDecode",
|
||||
input => "\\\0",
|
||||
output => "\0",
|
||||
ret => 1,
|
||||
},
|
43
apache2/t/tfns/length.t
Normal file
43
apache2/t/tfns/length.t
Normal file
@ -0,0 +1,43 @@
|
||||
### Empty
|
||||
{
|
||||
type => "tfns",
|
||||
name => "length",
|
||||
input => "",
|
||||
output => "0",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
|
||||
### Basic normal and large
|
||||
{
|
||||
type => "tfns",
|
||||
name => "length",
|
||||
input => "0123456789abcdef",
|
||||
output => "16",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "length",
|
||||
input => ('x' x 8192),
|
||||
output => "8192",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
### With TAB
|
||||
{
|
||||
type => "tfns",
|
||||
name => "length",
|
||||
input => "0123456789\tabcdef",
|
||||
output => "17",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
### With NUL
|
||||
{
|
||||
type => "tfns",
|
||||
name => "length",
|
||||
input => "Test\0Case",
|
||||
output => "9",
|
||||
ret => 1,
|
||||
},
|
40
apache2/t/tfns/lowercase.t
Normal file
40
apache2/t/tfns/lowercase.t
Normal file
@ -0,0 +1,40 @@
|
||||
### Empty
|
||||
{
|
||||
type => "tfns",
|
||||
name => "lowercase",
|
||||
input => "",
|
||||
output => "",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
### Nothing
|
||||
{
|
||||
type => "tfns",
|
||||
name => "lowercase",
|
||||
input => "testcase",
|
||||
output => "testcase",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "lowercase",
|
||||
input => "test\0case",
|
||||
output => "test\0case",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
### Basic
|
||||
{
|
||||
type => "tfns",
|
||||
name => "lowercase",
|
||||
input => "TestCase",
|
||||
output => "testcase",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "lowercase",
|
||||
input => "Test\0Case",
|
||||
output => "test\0case",
|
||||
ret => 1,
|
||||
},
|
26
apache2/t/tfns/md5.t
Normal file
26
apache2/t/tfns/md5.t
Normal file
@ -0,0 +1,26 @@
|
||||
### Empty
|
||||
{
|
||||
type => "tfns",
|
||||
name => "md5",
|
||||
input => "",
|
||||
output => "\xd4\x1d\x8c\xd9\x8f\x00\xb2\x04\xe9\x80\x09\x98\xec\xf8\x42\x7e",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
### Basic
|
||||
{
|
||||
type => "tfns",
|
||||
name => "md5",
|
||||
input => "TestCase",
|
||||
output => "\xc9\xab\xa2\xc3\xe6\x01\x26\x16\x9e\x80\xe9\xa2\x6b\xa2\x73\xc1",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
### Binary w/NUL
|
||||
{
|
||||
type => "tfns",
|
||||
name => "md5",
|
||||
input => "\x00\x01\x02\x03\x04\x05\x06\x07\x08",
|
||||
output => "\xa6\xe7\xd3\xb4\x6f\xdf\xaf\x0b\xde\x2a\x1f\x83\x2a\x00\xd2\xde",
|
||||
ret => 1,
|
||||
},
|
98
apache2/t/tfns/normalisePath.t
Normal file
98
apache2/t/tfns/normalisePath.t
Normal file
@ -0,0 +1,98 @@
|
||||
### Empty
|
||||
{
|
||||
type => "tfns",
|
||||
name => "normalisePath",
|
||||
input => "",
|
||||
output => "",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
### Nothing
|
||||
{
|
||||
type => "tfns",
|
||||
name => "normalisePath",
|
||||
input => "/foo/bar/baz",
|
||||
output => "/foo/bar/baz",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "normalisePath",
|
||||
input => "/foo/bar\0/baz",
|
||||
output => "/foo/bar\0/baz",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
### Basic
|
||||
{
|
||||
type => "tfns",
|
||||
name => "normalisePath",
|
||||
input => "/foo/bar//baz",
|
||||
output => "/foo/bar/baz",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "normalisePath",
|
||||
input => "/foo/bar baz/././././boo//eek/././../whoa",
|
||||
output => "/foo/bar baz/boo/whoa",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "normalisePath",
|
||||
input => "./foo/bar baz/././././boo//eek/././../whoa",
|
||||
output => "./foo/bar baz/boo/whoa",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "normalisePath",
|
||||
input => "/./foo/bar baz/././././boo//eek/././../whoa",
|
||||
output => "/foo/bar baz/boo/whoa",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "normalisePath",
|
||||
input => "//foo/bar baz/././././boo//eek/././../whoa",
|
||||
output => "/foo/bar baz/boo/whoa",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "normalisePath",
|
||||
input => "//foo/bar baz/././././boo//eek/././../whoa/./",
|
||||
output => "/foo/bar baz/boo/whoa/",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "normalisePath",
|
||||
input => "/./foo/bar baz/././././boo//eek/././../whoa//",
|
||||
output => "/foo/bar baz/boo/whoa/",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "normalisePath",
|
||||
input => "/./../../../../../../../../etc/passwd",
|
||||
output => "/etc/passwd",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "normalisePath",
|
||||
input => "/./.././../../../../../../../etc/../etc/./passwd",
|
||||
output => "/etc/passwd",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
### With NUL
|
||||
{
|
||||
type => "tfns",
|
||||
name => "normalisePath",
|
||||
input => "/./.././../../../../../../../\0/../etc/./passwd",
|
||||
output => "/etc/passwd",
|
||||
ret => 1,
|
||||
},
|
98
apache2/t/tfns/normalisePathWin.t
Normal file
98
apache2/t/tfns/normalisePathWin.t
Normal file
@ -0,0 +1,98 @@
|
||||
### Empty
|
||||
{
|
||||
type => "tfns",
|
||||
name => "normalisePathWin",
|
||||
input => "",
|
||||
output => "",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
### Nothing but switch slashes
|
||||
{
|
||||
type => "tfns",
|
||||
name => "normalisePathWin",
|
||||
input => "\\foo\\bar\\baz",
|
||||
output => "/foo/bar/baz",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "normalisePathWin",
|
||||
input => "\\foo\\bar\0\\baz",
|
||||
output => "/foo/bar\0/baz",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
### Basics
|
||||
{
|
||||
type => "tfns",
|
||||
name => "normalisePathWin",
|
||||
input => "\\foo\\bar\\\\baz",
|
||||
output => "/foo/bar/baz",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "normalisePathWin",
|
||||
input => "\\foo\\bar baz\\.\\.\\.\\.\\boo\\\\eek\\.\\.\\..\\whoa",
|
||||
output => "/foo/bar baz/boo/whoa",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "normalisePathWin",
|
||||
input => ".\\foo\\bar baz\\.\\.\\.\\.\\boo\\\\eek\\.\\.\\..\\whoa",
|
||||
output => "./foo/bar baz/boo/whoa",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "normalisePathWin",
|
||||
input => "\\.\\foo\\bar baz\\.\\.\\.\\.\\boo\\\\eek\\.\\.\\..\\whoa",
|
||||
output => "/foo/bar baz/boo/whoa",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "normalisePathWin",
|
||||
input => "\\\\foo\\bar baz\\.\\.\\.\\.\\boo\\\\eek\\.\\.\\..\\whoa",
|
||||
output => "/foo/bar baz/boo/whoa",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "normalisePathWin",
|
||||
input => "\\\\foo\\bar baz\\.\\.\\.\\.\\boo\\\\eek\\.\\.\\..\\whoa\\.\\",
|
||||
output => "/foo/bar baz/boo/whoa/",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "normalisePathWin",
|
||||
input => "\\.\\foo\\bar baz\\.\\.\\.\\.\\boo\\\\eek\\.\\.\\..\\whoa\\\\",
|
||||
output => "/foo/bar baz/boo/whoa/",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "normalisePathWin",
|
||||
input => "\\.\\..\\..\\..\\..\\..\\..\\..\\..\\etc\\passwd",
|
||||
output => "/etc/passwd",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "normalisePathWin",
|
||||
input => "\\.\\..\\.\\..\\..\\..\\..\\..\\..\\..\\etc\\..\\etc\\.\\passwd",
|
||||
output => "/etc/passwd",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
### With NUL
|
||||
{
|
||||
type => "tfns",
|
||||
name => "normalisePathWin",
|
||||
input => "\\.\\..\\.\\..\\..\\..\\..\\..\\..\\..\\\0\\..\\etc\\.\\passwd",
|
||||
output => "/etc/passwd",
|
||||
ret => 1,
|
||||
},
|
62
apache2/t/tfns/removeNulls.t
Normal file
62
apache2/t/tfns/removeNulls.t
Normal file
@ -0,0 +1,62 @@
|
||||
### Empty
|
||||
{
|
||||
type => "tfns",
|
||||
name => "removeNulls",
|
||||
input => "",
|
||||
output => "",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
### Nothing
|
||||
{
|
||||
type => "tfns",
|
||||
name => "removeNulls",
|
||||
input => "TestCase",
|
||||
output => "TestCase",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "removeNulls",
|
||||
input => "Test\x01Case",
|
||||
output => "Test\x01Case",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
|
||||
### Basics
|
||||
{
|
||||
type => "tfns",
|
||||
name => "removeNulls",
|
||||
input => "\0TestCase",
|
||||
output => "TestCase",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "removeNulls",
|
||||
input => "Test\0Case",
|
||||
output => "TestCase",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "removeNulls",
|
||||
input => "Test\0\0Case",
|
||||
output => "TestCase",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "removeNulls",
|
||||
input => "TestCase\0",
|
||||
output => "TestCase",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "removeNulls",
|
||||
input => "\0Test\0Case\0",
|
||||
output => "TestCase",
|
||||
ret => 1,
|
||||
},
|
43
apache2/t/tfns/removeWhitespace.t
Normal file
43
apache2/t/tfns/removeWhitespace.t
Normal file
@ -0,0 +1,43 @@
|
||||
### Empty
|
||||
{
|
||||
type => "tfns",
|
||||
name => "removeWhitespace",
|
||||
input => "",
|
||||
output => "",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
### Nothing
|
||||
{
|
||||
type => "tfns",
|
||||
name => "removeWhitespace",
|
||||
input => "TestCase",
|
||||
output => "TestCase",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "removeWhitespace",
|
||||
input => "Test\0Case",
|
||||
output => "Test\0Case",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
|
||||
### Remove space/tab
|
||||
{
|
||||
type => "tfns",
|
||||
name => "removeWhitespace",
|
||||
input => " Test \t Case ",
|
||||
output => "TestCase",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
### Pretty much everything in one
|
||||
{
|
||||
type => "tfns",
|
||||
name => "removeWhitespace",
|
||||
input => "This is a test case with a tab \t, vtab \x0b, newline \x0a, return \x0d, formfeed \f, and a NUL\0 in it with a CRLF at the end.\x0d\x0a",
|
||||
output => "Thisisatestcasewithatab,vtab,newline,return,formfeed,andaNUL\0initwithaCRLFattheend.",
|
||||
ret => 1,
|
||||
},
|
155
apache2/t/tfns/replaceComments.t
Normal file
155
apache2/t/tfns/replaceComments.t
Normal file
@ -0,0 +1,155 @@
|
||||
### Empty
|
||||
{
|
||||
type => "tfns",
|
||||
name => "replaceComments",
|
||||
input => "",
|
||||
output => "",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
### Nothing
|
||||
{
|
||||
type => "tfns",
|
||||
name => "replaceComments",
|
||||
input => "TestCase",
|
||||
output => "TestCase",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "replaceComments",
|
||||
input => "Test\0Case",
|
||||
output => "Test\0Case",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
|
||||
### Basics
|
||||
{
|
||||
type => "tfns",
|
||||
name => "replaceComments",
|
||||
input => "/* TestCase */",
|
||||
output => " ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "replaceComments",
|
||||
input => "/*TestCase*/",
|
||||
output => " ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "replaceComments",
|
||||
input => "/* TestCase*/",
|
||||
output => " ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "replaceComments",
|
||||
input => "/*TestCase */",
|
||||
output => " ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "replaceComments",
|
||||
input => "Before/* TestCase */After",
|
||||
output => "Before After",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "replaceComments",
|
||||
input => "Before /* TestCase */ After",
|
||||
output => "Before After",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "replaceComments",
|
||||
input => "/* Test\nCase */",
|
||||
output => " ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "replaceComments",
|
||||
input => "/* Test\x0d\x0aCase */",
|
||||
output => " ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "replaceComments",
|
||||
input => "/* Test\x0aCase */",
|
||||
output => " ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "replaceComments",
|
||||
input => "/* Test\x0dCase */",
|
||||
output => " ",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
### Broken Comments
|
||||
{
|
||||
type => "tfns",
|
||||
name => "replaceComments",
|
||||
input => "Before/* Test\x0d\x0aCase ",
|
||||
output => "Before ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "replaceComments",
|
||||
input => "Before /* Test\x0aCase ",
|
||||
output => "Before ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "replaceComments",
|
||||
input => "Before/* Test\x0d\x0aCase ",
|
||||
output => "Before ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "replaceComments",
|
||||
input => "Before /* Test\x0aCase ",
|
||||
output => "Before ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "replaceComments",
|
||||
input => "Test\x0d\x0aCase */After",
|
||||
output => "Test\x0d\x0aCase */After",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "replaceComments",
|
||||
input => "Test\x0aCase */ After",
|
||||
output => "Test\x0aCase */ After",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "replaceComments",
|
||||
input => "Test\x0d\x0aCase */After",
|
||||
output => "Test\x0d\x0aCase */After",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "replaceComments",
|
||||
input => "Test\x0aCase */ After",
|
||||
output => "Test\x0aCase */ After",
|
||||
ret => 0,
|
||||
},
|
55
apache2/t/tfns/replaceNulls.t
Normal file
55
apache2/t/tfns/replaceNulls.t
Normal file
@ -0,0 +1,55 @@
|
||||
### Empty
|
||||
{
|
||||
type => "tfns",
|
||||
name => "replaceNulls",
|
||||
input => "",
|
||||
output => "",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
### Nothing
|
||||
{
|
||||
type => "tfns",
|
||||
name => "replaceNulls",
|
||||
input => "TestCase",
|
||||
output => "TestCase",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
|
||||
### Basics
|
||||
{
|
||||
type => "tfns",
|
||||
name => "replaceNulls",
|
||||
input => "\0TestCase",
|
||||
output => " TestCase",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "replaceNulls",
|
||||
input => "Test\0Case",
|
||||
output => "Test Case",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "replaceNulls",
|
||||
input => "Test\0\0Case",
|
||||
output => "Test Case",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "replaceNulls",
|
||||
input => "TestCase\0",
|
||||
output => "TestCase ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "replaceNulls",
|
||||
input => "\0Test\0Case\0",
|
||||
output => " Test Case ",
|
||||
ret => 1,
|
||||
},
|
26
apache2/t/tfns/sha1.t
Normal file
26
apache2/t/tfns/sha1.t
Normal file
@ -0,0 +1,26 @@
|
||||
### Empty
|
||||
{
|
||||
type => "tfns",
|
||||
name => "sha1",
|
||||
input => "",
|
||||
output => "\xda\x39\xa3\xee\x5e\x6b\x4b\x0d\x32\x55\xbf\xef\x95\x60\x18\x90\xaf\xd8\x07\x09",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
### Basic
|
||||
{
|
||||
type => "tfns",
|
||||
name => "sha1",
|
||||
input => "TestCase",
|
||||
output => "\xa7\x0c\xe3\x83\x89\xe3\x18\xbd\x2b\xe1\x8a\x01\x11\xc6\xdc\x76\xbd\x2c\xd9\xed",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
### Binary w/NUL
|
||||
{
|
||||
type => "tfns",
|
||||
name => "sha1",
|
||||
input => "\x00\x01\x02\x03\x04\x05\x06\x07\x08",
|
||||
output => "\x63\xbf\x60\xc7\x10\x5a\x07\xa2\xb1\x25\xbb\xf8\x9e\x61\xab\xda\xbc\x69\x78\xc2",
|
||||
ret => 1,
|
||||
},
|
68
apache2/t/tfns/trim.t
Normal file
68
apache2/t/tfns/trim.t
Normal file
@ -0,0 +1,68 @@
|
||||
### Empty
|
||||
{
|
||||
type => "tfns",
|
||||
name => "trim",
|
||||
input => "",
|
||||
output => "",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
### Nothing
|
||||
{
|
||||
type => "tfns",
|
||||
name => "trim",
|
||||
input => "TestCase",
|
||||
output => "TestCase",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "trim",
|
||||
input => "Test\0Case",
|
||||
output => "Test\0Case",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
### Basics
|
||||
{
|
||||
type => "tfns",
|
||||
name => "trim",
|
||||
input => " TestCase",
|
||||
output => "TestCase",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "trim",
|
||||
input => "TestCase ",
|
||||
output => "TestCase",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "trim",
|
||||
input => " TestCase ",
|
||||
output => "TestCase",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "trim",
|
||||
input => " Test Case ",
|
||||
output => "Test Case",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "trim",
|
||||
input => " Test \0 Case ",
|
||||
output => "Test \0 Case",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "trim",
|
||||
input => " Test \0 Case \r\n ",
|
||||
output => "Test \0 Case",
|
||||
ret => 1,
|
||||
},
|
69
apache2/t/tfns/trimLeft.t
Normal file
69
apache2/t/tfns/trimLeft.t
Normal file
@ -0,0 +1,69 @@
|
||||
### Empty
|
||||
{
|
||||
type => "tfns",
|
||||
name => "trimLeft",
|
||||
input => "",
|
||||
output => "",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
### Nothing
|
||||
{
|
||||
type => "tfns",
|
||||
name => "trimLeft",
|
||||
input => "TestCase",
|
||||
output => "TestCase",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "trimLeft",
|
||||
input => "Test\0Case",
|
||||
output => "Test\0Case",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "trimLeft",
|
||||
input => "TestCase ",
|
||||
output => "TestCase ",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
|
||||
### Basics
|
||||
{
|
||||
type => "tfns",
|
||||
name => "trimLeft",
|
||||
input => " TestCase",
|
||||
output => "TestCase",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "trimLeft",
|
||||
input => " TestCase ",
|
||||
output => "TestCase ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "trimLeft",
|
||||
input => " Test Case ",
|
||||
output => "Test Case ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "trimLeft",
|
||||
input => " Test \0 Case ",
|
||||
output => "Test \0 Case ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "trimLeft",
|
||||
input => " Test \0 Case \r\n ",
|
||||
output => "Test \0 Case \r\n ",
|
||||
ret => 1,
|
||||
},
|
68
apache2/t/tfns/trimRight.t
Normal file
68
apache2/t/tfns/trimRight.t
Normal file
@ -0,0 +1,68 @@
|
||||
### Empty
|
||||
{
|
||||
type => "tfns",
|
||||
name => "trimRight",
|
||||
input => "",
|
||||
output => "",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
### Nothing
|
||||
{
|
||||
type => "tfns",
|
||||
name => "trimRight",
|
||||
input => "TestCase",
|
||||
output => "TestCase",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "trimRight",
|
||||
input => "Test\0Case",
|
||||
output => "Test\0Case",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "trimRight",
|
||||
input => " TestCase",
|
||||
output => " TestCase",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
### Basics
|
||||
{
|
||||
type => "tfns",
|
||||
name => "trimRight",
|
||||
input => "TestCase ",
|
||||
output => "TestCase",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "trimRight",
|
||||
input => " TestCase ",
|
||||
output => " TestCase",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "trimRight",
|
||||
input => " Test Case ",
|
||||
output => " Test Case",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "trimRight",
|
||||
input => " Test \0 Case ",
|
||||
output => " Test \0 Case",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "trimRight",
|
||||
input => " Test \0 Case \r\n ",
|
||||
output => " Test \0 Case",
|
||||
ret => 1,
|
||||
},
|
136
apache2/t/tfns/urlDecode.t
Normal file
136
apache2/t/tfns/urlDecode.t
Normal file
@ -0,0 +1,136 @@
|
||||
### Empty
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecode",
|
||||
input => "",
|
||||
output => "",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
### Nothing
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecode",
|
||||
input => "TestCase",
|
||||
output => "TestCase",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecode",
|
||||
input => "Test\0Case",
|
||||
output => "Test\0Case",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
### Valid
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecode",
|
||||
input => "+%00%01%02%03%04%05%06%07%08%09%0a%0b%0c%0d%0e%0f%10%11%12%13%14%15%16%17%18%19%1a%1b%1c%1d%1e%1f%20%21%22%23%24%25%26%27%28%29%2a%2b%2c%2d%2e%2f%30%31%32%33%34%35%36%37%38%39%3a%3b%3c%3d%3e%3f%40%41%42%43%44%45%46%47%48%49%4a%4b%4c%4d%4e%4f%50%51%52%53%54%55%56%57%58%59%5a%5b%5c%5d%5e%5f%60%61%62%63%64%65%66%67%68%69%6a%6b%6c%6d%6e%6f%70%71%72%73%74%75%76%77%78%79%7a%7b%7c%7d%7e%7f%80%81%82%83%84%85%86%87%88%89%8a%8b%8c%8d%8e%8f%90%91%92%93%94%95%96%97%98%99%9a%9b%9c%9d%9e%9f%a0%a1%a2%a3%a4%a5%a6%a7%a8%a9%aa%ab%ac%ad%ae%af%b0%b1%b2%b3%b4%b5%b6%b7%b8%b9%ba%bb%bc%bd%be%bf%c0%c1%c2%c3%c4%c5%c6%c7%c8%c9%ca%cb%cc%cd%ce%cf%d0%d1%d2%d3%d4%d5%d6%d7%d8%d9%da%db%dc%dd%de%df%e0%e1%e2%e3%e4%e5%e6%e7%e8%e9%ea%eb%ec%ed%ee%ef%f0%f1%f2%f3%f4%f5%f6%f7%f8%f9%fa%fb%fc%fd%fe%ff",
|
||||
output => " \x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f \x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
|
||||
### Partial Invalid
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecode",
|
||||
input => "%+",
|
||||
output => "% ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecode",
|
||||
input => "%%20",
|
||||
output => "% ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecode",
|
||||
input => "%0g%20",
|
||||
output => "%0g ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecode",
|
||||
input => "%0%20",
|
||||
output => "%0 ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecode",
|
||||
input => "%g0%20",
|
||||
output => "%g0 ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecode",
|
||||
input => "%g%20",
|
||||
output => "%g ",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
### Invalid
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecode",
|
||||
input => "%0%1%2%3%4%5%6%7%8%9%0%a%b%c%d%e%f",
|
||||
output => "%0%1%2%3%4%5%6%7%8%9%0%a%b%c%d%e%f",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecode",
|
||||
input => "%g0%g1%g2%g3%g4%g5%g6%g7%g8%g9%g0%ga%gb%gc%gd%ge%gf",
|
||||
output => "%g0%g1%g2%g3%g4%g5%g6%g7%g8%g9%g0%ga%gb%gc%gd%ge%gf",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecode",
|
||||
input => "%0g%1g%2g%3g%4g%5g%6g%7g%8g%9g%0g%ag%bg%cg%dg%eg%fg",
|
||||
output => "%0g%1g%2g%3g%4g%5g%6g%7g%8g%9g%0g%ag%bg%cg%dg%eg%fg",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecode",
|
||||
input => "%",
|
||||
output => "%",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecode",
|
||||
input => "%0",
|
||||
output => "%0",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecode",
|
||||
input => "%%",
|
||||
output => "%%",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecode",
|
||||
input => "%0g",
|
||||
output => "%0g",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecode",
|
||||
input => "%gg",
|
||||
output => "%gg",
|
||||
ret => 0,
|
||||
},
|
228
apache2/t/tfns/urlDecodeUni.t
Normal file
228
apache2/t/tfns/urlDecodeUni.t
Normal file
@ -0,0 +1,228 @@
|
||||
### Empty
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecodeUni",
|
||||
input => "",
|
||||
output => "",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
### Nothing
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecodeUni",
|
||||
input => "TestCase",
|
||||
output => "TestCase",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecodeUni",
|
||||
input => "Test\0Case",
|
||||
output => "Test\0Case",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
### Valid
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecodeUni",
|
||||
input => "+%00%01%02%03%04%05%06%07%08%09%0a%0b%0c%0d%0e%0f%10%11%12%13%14%15%16%17%18%19%1a%1b%1c%1d%1e%1f%20%21%22%23%24%25%26%27%28%29%2a%2b%2c%2d%2e%2f%30%31%32%33%34%35%36%37%38%39%3a%3b%3c%3d%3e%3f%40%41%42%43%44%45%46%47%48%49%4a%4b%4c%4d%4e%4f%50%51%52%53%54%55%56%57%58%59%5a%5b%5c%5d%5e%5f%60%61%62%63%64%65%66%67%68%69%6a%6b%6c%6d%6e%6f%70%71%72%73%74%75%76%77%78%79%7a%7b%7c%7d%7e%7f%80%81%82%83%84%85%86%87%88%89%8a%8b%8c%8d%8e%8f%90%91%92%93%94%95%96%97%98%99%9a%9b%9c%9d%9e%9f%a0%a1%a2%a3%a4%a5%a6%a7%a8%a9%aa%ab%ac%ad%ae%af%b0%b1%b2%b3%b4%b5%b6%b7%b8%b9%ba%bb%bc%bd%be%bf%c0%c1%c2%c3%c4%c5%c6%c7%c8%c9%ca%cb%cc%cd%ce%cf%d0%d1%d2%d3%d4%d5%d6%d7%d8%d9%da%db%dc%dd%de%df%e0%e1%e2%e3%e4%e5%e6%e7%e8%e9%ea%eb%ec%ed%ee%ef%f0%f1%f2%f3%f4%f5%f6%f7%f8%f9%fa%fb%fc%fd%fe%ff",
|
||||
output => " \x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f \x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecodeUni",
|
||||
input => "+%u0000%u0001%u0002%u0003%u0004%u0005%u0006%u0007%u0008%u0009%u000a%u000b%u000c%u000d%u000e%u000f%u0010%u0011%u0012%u0013%u0014%u0015%u0016%u0017%u0018%u0019%u001a%u001b%u001c%u001d%u001e%u001f%u0020%u0021%u0022%u0023%u0024%u0025%u0026%u0027%u0028%u0029%u002a%u002b%u002c%u002d%u002e%u002f%u0030%u0031%u0032%u0033%u0034%u0035%u0036%u0037%u0038%u0039%u003a%u003b%u003c%u003d%u003e%u003f%u0040%u0041%u0042%u0043%u0044%u0045%u0046%u0047%u0048%u0049%u004a%u004b%u004c%u004d%u004e%u004f%u0050%u0051%u0052%u0053%u0054%u0055%u0056%u0057%u0058%u0059%u005a%u005b%u005c%u005d%u005e%u005f%u0060%u0061%u0062%u0063%u0064%u0065%u0066%u0067%u0068%u0069%u006a%u006b%u006c%u006d%u006e%u006f%u0070%u0071%u0072%u0073%u0074%u0075%u0076%u0077%u0078%u0079%u007a%u007b%u007c%u007d%u007e%u007f%u0080%u0081%u0082%u0083%u0084%u0085%u0086%u0087%u0088%u0089%u008a%u008b%u008c%u008d%u008e%u008f%u0090%u0091%u0092%u0093%u0094%u0095%u0096%u0097%u0098%u0099%u009a%u009b%u009c%u009d%u009e%u009f%u00a0%u00a1%u00a2%u00a3%u00a4%u00a5%u00a6%u00a7%u00a8%u00a9%u00aa%u00ab%u00ac%u00ad%u00ae%u00af%u00b0%u00b1%u00b2%u00b3%u00b4%u00b5%u00b6%u00b7%u00b8%u00b9%u00ba%u00bb%u00bc%u00bd%u00be%u00bf%u00c0%u00c1%u00c2%u00c3%u00c4%u00c5%u00c6%u00c7%u00c8%u00c9%u00ca%u00cb%u00cc%u00cd%u00ce%u00cf%u00d0%u00d1%u00d2%u00d3%u00d4%u00d5%u00d6%u00d7%u00d8%u00d9%u00da%u00db%u00dc%u00dd%u00de%u00df%u00e0%u00e1%u00e2%u00e3%u00e4%u00e5%u00e6%u00e7%u00e8%u00e9%u00ea%u00eb%u00ec%u00ed%u00ee%u00ef%u00f0%u00f1%u00f2%u00f3%u00f4%u00f5%u00f6%u00f7%u00f8%u00f9%u00fa%u00fb%u00fc%u00fd%u00fe%u00ff",
|
||||
output => " \x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f \x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecodeUni",
|
||||
input => "+%u1100%u1101%u1102%u1103%u1104%u1105%u1106%u1107%u1108%u1109%u110a%u110b%u110c%u110d%u110e%u110f%u1110%u1111%u1112%u1113%u1114%u1115%u1116%u1117%u1118%u1119%u111a%u111b%u111c%u111d%u111e%u111f%u1120%u1121%u1122%u1123%u1124%u1125%u1126%u1127%u1128%u1129%u112a%u112b%u112c%u112d%u112e%u112f%u1130%u1131%u1132%u1133%u1134%u1135%u1136%u1137%u1138%u1139%u113a%u113b%u113c%u113d%u113e%u113f%u1140%u1141%u1142%u1143%u1144%u1145%u1146%u1147%u1148%u1149%u114a%u114b%u114c%u114d%u114e%u114f%u1150%u1151%u1152%u1153%u1154%u1155%u1156%u1157%u1158%u1159%u115a%u115b%u115c%u115d%u115e%u115f%u1160%u1161%u1162%u1163%u1164%u1165%u1166%u1167%u1168%u1169%u116a%u116b%u116c%u116d%u116e%u116f%u1170%u1171%u1172%u1173%u1174%u1175%u1176%u1177%u1178%u1179%u117a%u117b%u117c%u117d%u117e%u117f%u1180%u1181%u1182%u1183%u1184%u1185%u1186%u1187%u1188%u1189%u118a%u118b%u118c%u118d%u118e%u118f%u1190%u1191%u1192%u1193%u1194%u1195%u1196%u1197%u1198%u1199%u119a%u119b%u119c%u119d%u119e%u119f%u11a0%u11a1%u11a2%u11a3%u11a4%u11a5%u11a6%u11a7%u11a8%u11a9%u11aa%u11ab%u11ac%u11ad%u11ae%u11af%u11b0%u11b1%u11b2%u11b3%u11b4%u11b5%u11b6%u11b7%u11b8%u11b9%u11ba%u11bb%u11bc%u11bd%u11be%u11bf%u11c0%u11c1%u11c2%u11c3%u11c4%u11c5%u11c6%u11c7%u11c8%u11c9%u11ca%u11cb%u11cc%u11cd%u11ce%u11cf%u11d0%u11d1%u11d2%u11d3%u11d4%u11d5%u11d6%u11d7%u11d8%u11d9%u11da%u11db%u11dc%u11dd%u11de%u11df%u11e0%u11e1%u11e2%u11e3%u11e4%u11e5%u11e6%u11e7%u11e8%u11e9%u11ea%u11eb%u11ec%u11ed%u11ee%u11ef%u11f0%u11f1%u11f2%u11f3%u11f4%u11f5%u11f6%u11f7%u11f8%u11f9%u11fa%u11fb%u11fc%u11fd%u11fe%u11ff",
|
||||
output => " \x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f \x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
|
||||
ret => 1,
|
||||
},
|
||||
# Full Width ASCII
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecodeUni",
|
||||
input => "%uff01%uff02%uff03%uff04%uff05%uff06%uff07%uff08%uff09%uff0a%uff0b%uff0c%uff0d%uff0e%uff0f%uff10%uff11%uff12%uff13%uff14%uff15%uff16%uff17%uff18%uff19%uff1a%uff1b%uff1c%uff1d%uff1e%uff1f%uff20%uff21%uff22%uff23%uff24%uff25%uff26%uff27%uff28%uff29%uff2a%uff2b%uff2c%uff2d%uff2e%uff2f%uff30%uff31%uff32%uff33%uff34%uff35%uff36%uff37%uff38%uff39%uff3a%uff3b%uff3c%uff3d%uff3e%uff3f%uff40%uff41%uff42%uff43%uff44%uff45%uff46%uff47%uff48%uff49%uff4a%uff4b%uff4c%uff4d%uff4e%uff4f%uff50%uff51%uff52%uff53%uff54%uff55%uff56%uff57%uff58%uff59%uff5a%uff5b%uff5c%uff5d%uff5e",
|
||||
output => "\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e",
|
||||
ret => 1,
|
||||
},
|
||||
# Invalid Full Width ASCII
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecodeUni",
|
||||
input => "%uff00%uff7f%uff80%uff81%uff82%uff83%uff84%uff85%uff86%uff87%uff88%uff89%uff8a%uff8b%uff8c%uff8d%uff8e%uff8f%uff90%uff91%uff92%uff93%uff94%uff95%uff96%uff97%uff98%uff99%uff9a%uff9b%uff9c%uff9d%uff9e%uff9f%uffa0%uffa1%uffa2%uffa3%uffa4%uffa5%uffa6%uffa7%uffa8%uffa9%uffaa%uffab%uffac%uffad%uffae%uffaf%uffb0%uffb1%uffb2%uffb3%uffb4%uffb5%uffb6%uffb7%uffb8%uffb9%uffba%uffbb%uffbc%uffbd%uffbe%uffbf%uffc0%uffc1%uffc2%uffc3%uffc4%uffc5%uffc6%uffc7%uffc8%uffc9%uffca%uffcb%uffcc%uffcd%uffce%uffcf%uffd0%uffd1%uffd2%uffd3%uffd4%uffd5%uffd6%uffd7%uffd8%uffd9%uffda%uffdb%uffdc%uffdd%uffde%uffdf%uffe0%uffe1%uffe2%uffe3%uffe4%uffe5%uffe6%uffe7%uffe8%uffe9%uffea%uffeb%uffec%uffed%uffee%uffef%ufff0%ufff1%ufff2%ufff3%ufff4%ufff5%ufff6%ufff7%ufff8%ufff9%ufffa%ufffb%ufffc%ufffd%ufffe%uffff",
|
||||
output => "\x00\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
### Partial Invalid
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecodeUni",
|
||||
input => "%+",
|
||||
output => "% ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecodeUni",
|
||||
input => "%%20",
|
||||
output => "% ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecodeUni",
|
||||
input => "%0g%20",
|
||||
output => "%0g ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecodeUni",
|
||||
input => "%0%20",
|
||||
output => "%0 ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecodeUni",
|
||||
input => "%g0%20",
|
||||
output => "%g0 ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecodeUni",
|
||||
input => "%g%20",
|
||||
output => "%g ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecodeUni",
|
||||
input => "%%u0020",
|
||||
output => "% ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecodeUni",
|
||||
input => "%0g%u0020",
|
||||
output => "%0g ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecodeUni",
|
||||
input => "%0%u0020",
|
||||
output => "%0 ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecodeUni",
|
||||
input => "%g0%u0020",
|
||||
output => "%g0 ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecodeUni",
|
||||
input => "%u%u0020",
|
||||
output => "%u ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecodeUni",
|
||||
input => "%u0%u0020",
|
||||
output => "%u0 ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecodeUni",
|
||||
input => "%u00%u0020",
|
||||
output => "%u00 ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecodeUni",
|
||||
input => "%u000%u0020",
|
||||
output => "%u000 ",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecodeUni",
|
||||
input => "%u000g%u0020",
|
||||
output => "%u000g ",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
### Invalid
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecodeUni",
|
||||
input => "%0%1%2%3%4%5%6%7%8%9%0%a%b%c%d%e%f",
|
||||
output => "%0%1%2%3%4%5%6%7%8%9%0%a%b%c%d%e%f",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecodeUni",
|
||||
input => "%g0%g1%g2%g3%g4%g5%g6%g7%g8%g9%g0%ga%gb%gc%gd%ge%gf",
|
||||
output => "%g0%g1%g2%g3%g4%g5%g6%g7%g8%g9%g0%ga%gb%gc%gd%ge%gf",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecodeUni",
|
||||
input => "%0g%1g%2g%3g%4g%5g%6g%7g%8g%9g%0g%ag%bg%cg%dg%eg%fg",
|
||||
output => "%0g%1g%2g%3g%4g%5g%6g%7g%8g%9g%0g%ag%bg%cg%dg%eg%fg",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecodeUni",
|
||||
input => "%",
|
||||
output => "%",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecodeUni",
|
||||
input => "%0",
|
||||
output => "%0",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecodeUni",
|
||||
input => "%%",
|
||||
output => "%%",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecodeUni",
|
||||
input => "%0g",
|
||||
output => "%0g",
|
||||
ret => 0,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlDecodeUni",
|
||||
input => "%gg",
|
||||
output => "%gg",
|
||||
ret => 0,
|
||||
},
|
122
apache2/t/tfns/urlEncode.t
Normal file
122
apache2/t/tfns/urlEncode.t
Normal file
@ -0,0 +1,122 @@
|
||||
### Empty
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlEncode",
|
||||
input => "",
|
||||
output => "",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
### Nothing
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlEncode",
|
||||
input => "TestCase",
|
||||
output => "TestCase",
|
||||
ret => 0,
|
||||
},
|
||||
|
||||
### Valid
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlEncode",
|
||||
input => " \x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
|
||||
output => "+%00%01%02%03%04%05%06%07%08%09%0a%0b%0c%0d%0e%0f%10%11%12%13%14%15%16%17%18%19%1a%1b%1c%1d%1e%1f+%21%22%23%24%25%26%27%28%29*%2b%2c%2d%2e%2f0123456789%3a%3b%3c%3d%3e%3f%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5b%5c%5d%5e%5f%60abcdefghijklmnopqrstuvwxyz%7b%7c%7d%7e%7f%80%81%82%83%84%85%86%87%88%89%8a%8b%8c%8d%8e%8f%90%91%92%93%94%95%96%97%98%99%9a%9b%9c%9d%9e%9f%a0%a1%a2%a3%a4%a5%a6%a7%a8%a9%aa%ab%ac%ad%ae%af%b0%b1%b2%b3%b4%b5%b6%b7%b8%b9%ba%bb%bc%bd%be%bf%c0%c1%c2%c3%c4%c5%c6%c7%c8%c9%ca%cb%cc%cd%ce%cf%d0%d1%d2%d3%d4%d5%d6%d7%d8%d9%da%db%dc%dd%de%df%e0%e1%e2%e3%e4%e5%e6%e7%e8%e9%ea%eb%ec%ed%ee%ef%f0%f1%f2%f3%f4%f5%f6%f7%f8%f9%fa%fb%fc%fd%fe%ff",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
|
||||
### Partial Invalid
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlEncode",
|
||||
input => "% ",
|
||||
output => "%25+",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlEncode",
|
||||
input => "%0g ",
|
||||
output => "%250g+",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlEncode",
|
||||
input => "%0 ",
|
||||
output => "%250+",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlEncode",
|
||||
input => "%g0 ",
|
||||
output => "%25g0+",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlEncode",
|
||||
input => "%g ",
|
||||
output => "%25g+",
|
||||
ret => 1,
|
||||
},
|
||||
|
||||
### Invalid
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlEncode",
|
||||
input => "%0%1%2%3%4%5%6%7%8%9%0%a%b%c%d%e%f",
|
||||
output => "%250%251%252%253%254%255%256%257%258%259%250%25a%25b%25c%25d%25e%25f",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlEncode",
|
||||
input => "%g0%g1%g2%g3%g4%g5%g6%g7%g8%g9%g0%ga%gb%gc%gd%ge%gf",
|
||||
output => "%25g0%25g1%25g2%25g3%25g4%25g5%25g6%25g7%25g8%25g9%25g0%25ga%25gb%25gc%25gd%25ge%25gf",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlEncode",
|
||||
input => "%0g%1g%2g%3g%4g%5g%6g%7g%8g%9g%0g%ag%bg%cg%dg%eg%fg",
|
||||
output => "%250g%251g%252g%253g%254g%255g%256g%257g%258g%259g%250g%25ag%25bg%25cg%25dg%25eg%25fg",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlEncode",
|
||||
input => "%",
|
||||
output => "%25",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlEncode",
|
||||
input => "%0",
|
||||
output => "%250",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlEncode",
|
||||
input => "%%",
|
||||
output => "%25%25",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlEncode",
|
||||
input => "%0g",
|
||||
output => "%250g",
|
||||
ret => 1,
|
||||
},
|
||||
{
|
||||
type => "tfns",
|
||||
name => "urlEncode",
|
||||
input => "%gg",
|
||||
output => "%25gg",
|
||||
ret => 1,
|
||||
},
|
Loading…
x
Reference in New Issue
Block a user