188 lines
5.4 KiB
HTML
188 lines
5.4 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>测试页面 - Simple Web Server</title>
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
min-height: 100vh;
|
|
padding: 40px 20px;
|
|
}
|
|
|
|
.container {
|
|
max-width: 800px;
|
|
margin: 0 auto;
|
|
background: white;
|
|
border-radius: 20px;
|
|
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
|
|
padding: 40px;
|
|
}
|
|
|
|
h1 {
|
|
color: #333;
|
|
font-size: 32px;
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.subtitle {
|
|
color: #666;
|
|
font-size: 16px;
|
|
margin-bottom: 30px;
|
|
padding-bottom: 20px;
|
|
border-bottom: 2px solid #f0f0f0;
|
|
}
|
|
|
|
.test-section {
|
|
margin: 30px 0;
|
|
padding: 25px;
|
|
background: #f8f9fa;
|
|
border-radius: 10px;
|
|
border-left: 4px solid #667eea;
|
|
}
|
|
|
|
.test-section h2 {
|
|
color: #667eea;
|
|
font-size: 20px;
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
.result {
|
|
font-family: 'Courier New', monospace;
|
|
background: white;
|
|
padding: 15px;
|
|
border-radius: 8px;
|
|
margin-top: 10px;
|
|
font-size: 14px;
|
|
color: #333;
|
|
}
|
|
|
|
.success {
|
|
color: #27ae60;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.btn {
|
|
display: inline-block;
|
|
padding: 10px 25px;
|
|
margin: 5px;
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
text-decoration: none;
|
|
border-radius: 6px;
|
|
transition: all 0.3s ease;
|
|
border: none;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.btn-primary {
|
|
background: #667eea;
|
|
color: white;
|
|
}
|
|
|
|
.btn-primary:hover {
|
|
background: #5568d3;
|
|
transform: translateY(-2px);
|
|
}
|
|
|
|
.btn-warning {
|
|
background: #f39c12;
|
|
color: white;
|
|
}
|
|
|
|
.btn-warning:hover {
|
|
background: #e67e22;
|
|
transform: translateY(-2px);
|
|
}
|
|
|
|
.footer {
|
|
text-align: center;
|
|
margin-top: 30px;
|
|
color: #999;
|
|
font-size: 14px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h1>🧪 功能测试页面</h1>
|
|
<p class="subtitle">测试Web服务器的各项功能</p>
|
|
|
|
<div class="test-section">
|
|
<h2>✅ 基本功能测试</h2>
|
|
<p>如果页面正常加载,说明<span class="success">GET方法处理正常</span>。</p>
|
|
<div class="result">
|
|
状态:成功加载页面 ✓<br>
|
|
时间:<span id="load-time">计算中...</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="test-section">
|
|
<h2>📝 图片资源测试</h2>
|
|
<p>测试静态资源文件加载能力</p>
|
|
<div class="result">
|
|
<img src="../../NoteBook/img/image.png">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="test-section">
|
|
<h2>🚫 错误页面测试</h2>
|
|
<p>点击下方按钮测试错误页面</p>
|
|
<button onclick="test404()" class="btn btn-warning">测试404错误</button>
|
|
<button onclick="test501()" class="btn btn-warning">测试501错误</button>
|
|
</div>
|
|
|
|
<div class="test-section">
|
|
<h2>📊 请求 Headers</h2>
|
|
<p>当前请求的头部信息:</p>
|
|
<div class="result" id="headers">加载中...</div>
|
|
</div>
|
|
|
|
<div class="footer">
|
|
<p>Simple Web Server Test Page</p>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
const loadTime = performance.now();
|
|
document.getElementById('load-time').textContent = loadTime.toFixed(2) + 'ms';
|
|
|
|
const headers = document.getElementById('headers');
|
|
let headerText = '';
|
|
|
|
headerText += 'User-Agent: ' + navigator.userAgent + '<br>';
|
|
headerText += 'Language: ' + navigator.language + '<br>';
|
|
headerText += 'Platform: ' + navigator.platform + '<br>';
|
|
headerText += 'Cookie Enabled: ' + navigator.cookieEnabled;
|
|
|
|
headers.innerHTML = headerText;
|
|
});
|
|
|
|
function test404() {
|
|
window.location.href = '/this-page-does-not-exist.html';
|
|
}
|
|
|
|
function test501() {
|
|
const xhr = new XMLHttpRequest();
|
|
xhr.open('POST', '/test-post', true);
|
|
xhr.onload = function() {
|
|
alert('Response Status: ' + xhr.status);
|
|
if (xhr.status === 501) {
|
|
alert('✓ 501 Not Implemented - POST is not supported');
|
|
}
|
|
};
|
|
xhr.send();
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|