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:
@ -6,13 +6,13 @@ host = "0.0.0.0"
|
||||
port = 8080
|
||||
|
||||
[server.error_pages]
|
||||
404 = "not_found.html"
|
||||
404 = "exemples/err_pages/not_found.html"
|
||||
401 = "unauthorized.html"
|
||||
402 = "uwu.html"
|
||||
|
||||
[server.location./]
|
||||
methods = { "GET", "POST" }
|
||||
root = "./exemples/webpage"
|
||||
root = "exemples/webpage"
|
||||
dirlist = true
|
||||
client_max_body_size = "10M"
|
||||
index = "index.html"
|
||||
|
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>
|
||||
|
@ -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