mirror of
https://github.com/KeyZox71/webserv.git
synced 2025-07-20 19:56:32 +02:00
「🔀」 merge: a very cool feature has been merged ! :D
This commit is contained in:
@ -1,7 +1,9 @@
|
||||
#!/nix/store/8w718rm43x7z73xhw9d6vh8s4snrq67h-python3-3.12.10/bin/python3
|
||||
# Import modules for CGI handling
|
||||
#!/usr/bin/env python3
|
||||
import cgi
|
||||
import cgitb
|
||||
import time
|
||||
import os
|
||||
import sys # Needed for sys.exit()
|
||||
|
||||
# Enable error reporting
|
||||
cgitb.enable()
|
||||
@ -9,16 +11,25 @@ cgitb.enable()
|
||||
# Create instance of FieldStorage
|
||||
form = cgi.FieldStorage()
|
||||
|
||||
# Set the content type to HTML
|
||||
print("Content-Type: text/html\n")
|
||||
try:
|
||||
# Set the content type to HTML
|
||||
print("Content-Type: text/html\n")
|
||||
|
||||
# Output a simple HTML page
|
||||
print("<html>")
|
||||
print("<head>")
|
||||
print("<title>CGI Script Test</title>")
|
||||
print("</head>")
|
||||
print("<body>")
|
||||
print("<h1>CGI Script is Running</h1>")
|
||||
print("<p>Your web server is working correctly!</p>")
|
||||
print("</body>")
|
||||
print("</html>")
|
||||
# Output a simple HTML page
|
||||
print("<html>")
|
||||
print("<head>")
|
||||
print("<title>CGI Script Test</title>")
|
||||
print("</head>")
|
||||
print("<body>")
|
||||
print("<h1>CGI Script is Running</h1>")
|
||||
print("<p>Your web server is working correctly!</p>")
|
||||
files = os.listdir('.')
|
||||
for file in files:
|
||||
print(file)
|
||||
print("</body>")
|
||||
print("</html>")
|
||||
|
||||
except Exception:
|
||||
# Print error page and exit with error code
|
||||
cgitb.handler()
|
||||
sys.exit(1)
|
||||
|
Reference in New Issue
Block a user