-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_proxy_structure.py
More file actions
55 lines (44 loc) · 1.27 KB
/
Copy pathtest_proxy_structure.py
File metadata and controls
55 lines (44 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
"""
Quick Test: Verify HTML Structure Tags via Proxy
"""
import requests
print("=" * 70)
print("PROXY TEST: HTML Structure Tags")
print("=" * 70)
proxy_url = "http://127.0.0.1:8080"
test_url = "http://info.cern.ch"
print(f"\n[REQUEST]")
print(f" Proxy: {proxy_url}")
print(f" Target: {test_url}")
try:
# Use proxy
response = requests.get(test_url, proxies={"http": proxy_url}, timeout=10)
print(f"\n[RESPONSE]")
print(f" Status: {response.status_code}")
print(f" Size: {len(response.text)} bytes")
# Check for structure tags
html = response.text
print(f"\n[STRUCTURE CHECK]")
tags_to_check = ['<html', '<head', '<body', '<title']
all_ok = True
for tag in tags_to_check:
if tag in html.lower():
print(f" ✅ {tag}> FOUND")
else:
print(f" ❌ {tag}> MISSING")
all_ok = False
# Show first 200 chars
print(f"\n[HTML PREVIEW]")
print("-" * 70)
print(html[:200])
print("...")
print("-" * 70)
if all_ok:
print("\n✅ SUCCESS - All structure tags preserved!")
exit(0)
else:
print("\n❌ FAILED - Some structure tags missing!")
exit(1)
except Exception as e:
print(f"\n❌ ERROR: {e}")
exit(1)