mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-01-27 00:33:34 +00:00
Normalize results so tests work with newer and older versions
This change is similar to e565cc0a5e4af0330fe5a1ab6f2476be7fb10df4 and
following
From the Apache 2.4.35 changelog:
*) http: Enforce consistently no response body with both 204 and 304
statuses. [Yann Ylavic]
63 lines
1.3 KiB
Perl
Executable File
63 lines
1.3 KiB
Perl
Executable File
#!/usr/bin/perl -w
|
|
#
|
|
# Given a result on stdin, try and normalise some
|
|
# elements of it (such as HTTP Header dates) so that we can
|
|
# simply compare it with other results
|
|
#
|
|
|
|
use strict;
|
|
my $no_content = 0;
|
|
|
|
while( <STDIN> ) {
|
|
|
|
/^Server: Apache(\/[0-9.]+)?/ && do {
|
|
$_ = "";
|
|
};
|
|
|
|
/^X-Powered-By: PHP\/[0-9.]+/ && do {
|
|
$_ = "";
|
|
};
|
|
|
|
/^X-Pad: avoid browser bug/ && do {
|
|
$_ = "";
|
|
};
|
|
|
|
/^Keep-Alive:/ && do {
|
|
$_ = "";
|
|
};
|
|
|
|
/^Connection:/ && do {
|
|
$_ = "";
|
|
};
|
|
|
|
/^Transfer-Encoding:/ && do {
|
|
$_ = "";
|
|
};
|
|
|
|
/^Vary: / && do {
|
|
$_ = "";
|
|
};
|
|
|
|
/^X-(DAViCal|RSCDS)-Version: (DAViCal|RSCDS)\/[0-9.]+\.[0-9.]+\.[0-9.]+; DB\/[0-9.]+\.[0-9.]+\.[0-9.]+/ && do {
|
|
$_ = "";
|
|
};
|
|
|
|
# HTTP Standard Dates
|
|
s/(Mon|Tue|Wed|Thu|Fri|Sat|Sun), [0-3][0-9] (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) 2[0-9]{3} [0-2][0-9](:[0-5][0-9]){2} GMT/Dow, 01 Jan 2000 00:00:00 GMT/;
|
|
|
|
# Fix up any opaquelocktokens to something regular
|
|
s/opaquelocktoken:[[:xdigit:]]{8}-([[:xdigit:]]{4}-){3}[[:xdigit:]]{12}/opaquelocktoken:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/;
|
|
|
|
/^HTTP\/1\.1 204 No Content/ && do {
|
|
$no_content = 1;
|
|
};
|
|
/^Content-Length: 0/ && $no_content && do {
|
|
$_ = "";
|
|
};
|
|
/^Content-Type: / && $no_content && do {
|
|
$_ = "";
|
|
};
|
|
|
|
print;
|
|
}
|