mirror of
https://github.com/KeyZox71/webserv.git
synced 2025-06-25 09:33:36 +02:00
「🔨」 fix: fixed post request with cgi
This commit is contained in:
24
exemples/webpage/get_cgi.py
Executable file
24
exemples/webpage/get_cgi.py
Executable file
@ -0,0 +1,24 @@
|
||||
#!/nix/store/8w718rm43x7z73xhw9d6vh8s4snrq67h-python3-3.12.10/bin/python3
|
||||
# Import modules for CGI handling
|
||||
import cgi
|
||||
import cgitb
|
||||
|
||||
# Enable error reporting
|
||||
cgitb.enable()
|
||||
|
||||
# Create instance of FieldStorage
|
||||
form = cgi.FieldStorage()
|
||||
|
||||
# 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>")
|
@ -8,4 +8,10 @@ body {
|
||||
<body>
|
||||
<h1 style="font-size: 3rem; font-weight: bold; color: #fff; text-align: center; letter-spacing: 2px; background: linear-gradient(90deg, #ff00ff, #00ffff); -webkit-background-clip: text; display: inline-block; border-bottom: 2px solid #fff;">evilge</h1>
|
||||
</body>
|
||||
</br>
|
||||
<a style="color: #fff;" href="/get_cgi.py">get cgi test</a>
|
||||
</br>
|
||||
<a style="color: #fff;" href="/catually.png">catually</a>
|
||||
</br>
|
||||
<a style="color: #fff;" href="/post_cgi.html">post cgi test</a>
|
||||
</html>
|
||||
|
@ -1,13 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Not found D:</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>The page you requested was not found. Here is an image of Kanel instead</h1>
|
||||
<img src= "https://send.kanel.ovh/hotlink/xA0pJbJY6vuwjvGjpXHde6Y7WSVs7VF0qWp8y9YS.png" width="500" height="500">
|
||||
</body>
|
||||
</html>
|
||||
|
@ -7,7 +7,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<h1>Test POST Request</h1>
|
||||
<form action="/test.py" method="post">
|
||||
<form action="/post_cgi.py" method="post">
|
||||
<label for="name">Name:</label>
|
||||
<input type="text" id="name" name="name" required>
|
||||
<br>
|
Reference in New Issue
Block a user