This commit is contained in:
2025-08-26 22:57:23 +08:00
commit b703135335
25222 changed files with 6200887 additions and 0 deletions

View File

@@ -0,0 +1,77 @@
#!/usr/bin/env bash
#############################################################################
##
## Copyright (C) 2018 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of the Qt Toolkit.
##
## $QT_BEGIN_LICENSE:GPL$
## Commercial License Usage
## Licensees holding valid commercial Qt licenses may use this file in
## accordance with the commercial license agreement provided with the
## Software or, alternatively, in accordance with the terms contained in
## a written agreement between you and The Qt Company. For licensing terms
## and conditions see https://www.qt.io/terms-conditions. For further
## information use the contact form at https://www.qt.io/contact-us.
##
## GNU General Public License Usage
## Alternatively, this file may be used under the terms of the GNU
## General Public License version 3 or (at your option) any later version
## approved by the KDE Free Qt Foundation. The licenses are as published by
## the Free Software Foundation and appearing in the file LICENSE.GPL3
## included in the packaging of this file. Please review the following
## information to ensure the GNU General Public License requirements will
## be met: https://www.gnu.org/licenses/gpl-3.0.html.
##
## $QT_END_LICENSE$
##
#############################################################################
set -ex
# package apache2
# add users
useradd httptest; echo "httptest:httptest" | chpasswd
# enable apache2 module
/usr/sbin/a2enmod ssl dav_fs headers deflate auth_digest cgi
# enable apache2 config
cp $TESTDATA/{main,security,ssl,dav}.conf /etc/apache2/conf-available/
/usr/sbin/a2enconf main security ssl dav
# install configurations and test data
cp $TESTDATA/deflate.conf /etc/apache2/mods-available/
mkdir -p -m 1777 /home/writeables/dav # dav.conf
a2dissite '*' # disable all of the default apache2 sites
# Populate the web-site:
su $USER -c "cp -r $TESTDATA/www ~/www"
# tst_QNetworkReply::getFromHttp(success-internal)
su $USER -c "cp rfc3252.txt ~/www/htdocs/"; rm rfc3252.txt
# tst_QNetworkReply::synchronousRequest_data()
su $USER -c "mkdir -p ~/www/htdocs/deflate/"
su $USER -c "ln -s ~/www/htdocs/rfc3252.txt ~/www/htdocs/deflate/"
# tst_QNetworkReply::headFromHttp(with-authentication)
su $USER -c "ln -s ~/www/htdocs/rfc3252.txt ~/www/htdocs/rfcs-auth/"
# Duplicate rfc3252.txt 20 times for bigfile tests:
su $USER -c "seq 20 | xargs -i cat ~/www/htdocs/rfc3252.txt >> ~/www/htdocs/bigfile"
# tst_QNetworkReply::postToHttp(empty)
su $USER -c "ln -s ~/www/htdocs/protected/cgi-bin/md5sum.cgi ~/www/cgi-bin/"
# tst_QNetworkReply::lastModifiedHeaderForHttp() expects this time-stamp:
touch -d "2007-05-22 12:04:57 GMT" /home/$USER/www/htdocs/fluke.gif
# Create 10MB file for use by tst_Q*::downloadBigFile and interruption tests:
su $USER -c "/bin/dd if=/dev/zero of=~/www/htdocs/mediumfile bs=1 count=0 seek=10000000"
# enable service with installed configurations
service apache2 restart

View File

@@ -0,0 +1,7 @@
Alias /dav /home/writeables/dav
<Location /dav>
DAV On
order allow,deny
allow from all
Require all granted
</Location>

View File

@@ -0,0 +1,5 @@
# The default configuration will turn on DEFLATE for files served up
# from everywhere.
#
# For testing purposes, we want DEFLATE off by default, and on only for
# specific paths (which is set elsewhere).

View File

@@ -0,0 +1,56 @@
ServerName apache2.test-net.qt.local:80
NameVirtualHost *:443
<VirtualHost *:80>
</VirtualHost>
<VirtualHost *:443>
SSLEngine On
CustomLog /var/log/apache2/ssl_access.log combined
ErrorLog /var/log/apache2/ssl_error.log
</VirtualHost>
# default ubuntu config turns off SSLv2 because it is deprecated.
# Turn it back on so we can test it.
SSLProtocol all
DocumentRoot /home/qt-test-server/www/htdocs
ScriptAlias /qtest/cgi-bin/ "/home/qt-test-server/www/cgi-bin/"
ScriptAlias /qtest/protected/cgi-bin/ "/home/qt-test-server/www/htdocs/protected/cgi-bin/"
Alias /qtest "/home/qt-test-server/www/htdocs/"
<Directory "/home/qt-test-server/www/htdocs">
Require all granted
</Directory>
<Directory "/home/qt-test-server/www/htdocs/rfcs-auth">
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /home/qt-test-server/passwords
Require user httptest
</Directory>
<Directory "/home/qt-test-server/www/htdocs/auth-digest">
AuthType Digest
AuthName "Digest testing"
AuthDigestProvider file
AuthUserFile /home/qt-test-server/www/htdocs/digest-authfile
Require user httptest
</Directory>
<Directory "/home/qt-test-server/www/htdocs/deflate">
AddOutputFilterByType DEFLATE text/html text/plain text/xml
Header append Vary User-Agent env=!dont-vary
</Directory>
<Directory "/home/qt-test-server/www/cgi-bin">
Options +ExecCGI -Includes
AddHandler cgi-script .cgi .pl
Require all granted
</Directory>
<Directory "/home/qt-test-server/www/htdocs/protected/">
AllowOverride AuthConfig Options
</Directory>

View File

@@ -0,0 +1,51 @@
#
# Disable access to the entire file system except for the directories that
# are explicitly allowed later.
#
# This currently breaks the configurations that come with some web application
# Debian packages. It will be made the default for the release after lenny.
#
#<Directory />
# AllowOverride None
# Order Deny,Allow
# Deny from all
#</Directory>
# Changing the following options will not really affect the security of the
# server, but might make attacks slightly more difficult in some cases.
#
# ServerTokens
# This directive configures what you return as the Server HTTP response
# Header. The default is 'Full' which sends information about the OS-Type
# and compiled in modules.
# Set to one of: Full | OS | Minimal | Minor | Major | Prod
# where Full conveys the most information, and Prod the least.
#
#ServerTokens Minimal
ServerTokens OS
#ServerTokens Full
#
# Optionally add a line containing the server version and virtual host
# name to server-generated pages (internal error documents, FTP directory
# listings, mod_status and mod_info output etc., but not CGI generated
# documents or custom error documents).
# Set to "EMail" to also include a mailto: link to the ServerAdmin.
# Set to one of: On | Off | EMail
#
#ServerSignature Off
ServerSignature On
#
# Allow TRACE method
#
# Set to "extended" to also reflect the request body (only for testing and
# diagnostic purposes).
#
# Set to one of: On | Off | extended
#
#TraceEnable Off
TraceEnable On

View File

@@ -0,0 +1,2 @@
SSLCertificateFile /home/qt-test-server/ssl-certs/qt-test-server-cert.pem
SSLCertificateKeyFile /home/qt-test-server/ssl-certs/private/qt-test-server-key.pem

View File

@@ -0,0 +1,11 @@
#!/usr/bin/perl
if ($ENV{'REQUEST_METHOD'} eq "GET") {
$request = $ENV{'QUERY_STRING'};
} elsif ($ENV{'REQUEST_METHOD'} eq "POST") {
read(STDIN, $request, $ENV{'CONTENT_LENGTH'}) || die "Could not get query\n";
}
print "Content-type: text/plain\n\n";
print $request;

View File

@@ -0,0 +1,5 @@
#!/bin/sh
echo "Content-Type: text/plain"
echo
echo "$HTTP_COOKIE"

View File

@@ -0,0 +1,22 @@
#!/usr/bin/perl
use CGI;
if ($ENV{'REQUEST_METHOD'} eq "DELETE") {
$queryString = $ENV{'QUERY_STRING'};
if ($queryString eq "200-ok") {
$returnCode = 200;
} elsif ($queryString eq "202-accepted") {
$returnCode = 202;
} elsif ($queryString eq "204-no-content") {
$returnCode = 204;
} else {
$returnCode = 404;
}
} else {
# 405 = Method Not Allowed
$returnCode = 405;
}
$q = new CGI;
print $q->header(-status=>$returnCode);

View File

@@ -0,0 +1,17 @@
#!/usr/bin/perl
use CGI;
$queryString = $ENV{'QUERY_STRING'};
my $message;
if ($queryString eq "407-proxy-authorization-required") {
$status = 407;
} else {
$status = 401;
}
$q = new CGI;
print $q->header(-status=>$status,
-type=>"text/plain",
-WWW_Authenticate=>'WSSE realm="Test", profile="TestProfile"'),
"authorization required";

View File

@@ -0,0 +1,12 @@
#!/bin/bash
if [ "${HTTP_IF_MODIFIED_SINCE}" ]
then
echo "Status: 500"
echo ""
exit;
fi
echo "Expires: Mon, 30 Oct 2028 14:19:41 GMT"
echo "Content-type: text/html";
echo ""
echo "Hello World!"

View File

@@ -0,0 +1,42 @@
#!/usr/bin/perl
use CGI;
use Digest::MD5 qw(md5_hex);
$q = new CGI;
print $q->header();
$contentType = $ENV{"CONTENT_TYPE"};
print "content type: $contentType\n";
if ($contentType =~ /^multipart\/form-data/) {
foreach my $key ($q->param) {
foreach my $value ($q->param($key)) {
if ($key =~ /text/) {
$retValue = $value;
} else {
$retValue = md5_hex($value);
}
print "key: $key, value: $retValue\n";
}
}
} else {
#$contentLength = $ENV{"CONTENT_LENGTH"};
#print "content length: $contentLength\r\n";
$data = $q->param('POSTDATA');
$data =~ s/--\S*--$//; # remove ending boundary
@parts = split(/--\S*\r\n/, $data);
shift(@parts);
foreach (@parts) {
#print "raw: $_";
($header, $content) = split("\r\n\r\n");
@headerFields = split("\r\n", $header);
foreach (@headerFields) {
($fieldName, $value) = split(": ");
print "header: $fieldName, value: '$value'\n";
}
$content =~ s/\r\n//;
print "content: $content\n\n";
}
}

View File

@@ -0,0 +1,9 @@
#!/bin/sh
echo "Content-type: text/plain"
while read line; do
echo "Set-Cookie: $line"
done
echo
echo "Success"

View File

@@ -0,0 +1 @@
digest authentication successful

View File

@@ -0,0 +1 @@
httptest:Digest testing:5f68f4bc3cd2873a3d547558fe7d9782

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View File

@@ -0,0 +1,3 @@
<h1>Welcome to qt-test-server</h1>
<img src="fluke.gif" alt="fluke">
<p>This is a network test server. It serves as a caching ftp and http proxy, transparent http/socks5 proxy, imap, ftp and http server, and more.</p>

View File

@@ -0,0 +1,5 @@
Require valid-user
AuthUserFile /home/qt-test-server/passwords
AuthType basic
AuthName "password-protected area"
Options Indexes

View File

@@ -0,0 +1,6 @@
#!/bin/sh
echo "Content-type: text/plain";
echo "Content-length: 33"
echo
md5sum | cut -f 1 -d " "

View File

@@ -0,0 +1 @@
you found the secret