Hello,
I think I may have found a bug in the way Lynx submits forms. While testing a
personal website for text-only compatibility I came across an issue where a
form that I use to send an empty POST request is actually sending a GET request
but only in Lynx. I discovered that this happens consistently with any form
containing only a single input element. Adding a second input of any kind
results in the form being submitted correctly in Lynx.
To help recreate this, I have attached a small web server written in python3
demonstrating the requests sent from two example forms.
Additionally, here is the output of `lynx -version` in case that is useful:
Lynx Version 2.9.0dev.10 (11 Aug 2021)
libwww-FM 2.14, SSL-MM 1.4.1, GNUTLS 3.7.2, ncurses 6.2.20210905(wide)
Built on linux-gnu.
Best,
Adon
from http.server import BaseHTTPRequestHandler, HTTPServer
html = """
<!DOCTYPE html>
<html lang="en">
<head>
<title>Lynx Form Test</title>
</head>
<body>
<form method="post" action="/submit">
<input type="submit" value="Misbehaves in Lynx">
</form>
<form method="post" action="/submit">
<input type="hidden">
<input type="submit" value="Behaves as expected">
</form>
</body>
</html>
"""
class Handler(BaseHTTPRequestHandler):
def __init__(self, request, client_address, server):
self.msg = "Expected POST request. Actual method was {}."
super().__init__(request, client_address, server)
def respond(self, status, content_type, content):
self.send_response(status)
self.send_header("Content-Type", content_type)
self.end_headers()
self.wfile.write(bytes(content, "utf-8"))
def do_GET(self):
if self.path == "/submit":
self.respond(200, "text/plain", self.msg.format("GET"))
return
self.respond(200, "text/html", html)
def do_POST(self):
if self.path == "/submit":
self.respond(200, "text/plain", self.msg.format("POST"))
return
self.respond(405, "text/plain", "Method Not Allowed\n")
srv = HTTPServer(("", 8000), Handler)
print("Serving HTTP on port 8000 ...")
srv.serve_forever()