File: crash_after_output.py

package info (click to toggle)
python-legacy-cgi 2.6.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 232 kB
  • sloc: python: 1,533; makefile: 3
file content (18 lines) | stat: -rwxr-xr-x 439 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env python3
"""Test CGI script that crashes AFTER HTML output has begun.

This tests cgitb when headers and some body content have already
been sent to the browser.
"""
import cgitb

cgitb.enable()

print("Content-Type: text/html")
print()
print("<html><head><title>Test Page</title></head>")
print("<body>")
print("<h1>Welcome to my page</h1>")
print("<p>Some content here...</p>")

raise ValueError("crash after HTML output")