diff --git a/linkcheck/htmlutil/loginformsearch.py b/linkcheck/htmlutil/loginformsearch.py
index d10b5089..e8a4cd53 100644
--- a/linkcheck/htmlutil/loginformsearch.py
+++ b/linkcheck/htmlutil/loginformsearch.py
@@ -42,16 +42,14 @@ def search_form(content, cgiuser, cgipassword):
CGI fields. If no form is found return None.
"""
soup = htmlsoup.make_soup(content)
- # The value of the name attribute is case-insensitive
- # https://www.w3.org/TR/html401/interact/forms.html#adef-name-INPUT
- cginames = {cgiuser.lower(), cgipassword.lower()}
+ cginames = {cgiuser, cgipassword}
for form_element in soup.find_all("form", action=True):
form = Form(form_element["action"])
for input_element in form_element.find_all("input",
attrs={"name": True}):
form.add_value(
input_element["name"], input_element.attrs.get("value"))
- if cginames <= {x.lower() for x in form.data}:
+ if cginames <= set(form.data):
log.debug(LOG_CHECK, "Found form %s", form)
return form
diff --git a/tests/test_loginformsearch.py b/tests/test_loginformsearch.py
index 866e498f..6c2dab16 100644
--- a/tests/test_loginformsearch.py
+++ b/tests/test_loginformsearch.py
@@ -43,7 +43,7 @@ class TestFormSearch(unittest.TestCase):
def test_search_form(self):
form = loginformsearch.search_form(login_form,
- "USER_FIELD", "password_field")
+ "User_Field", "Password_Field")
self.assertIsNotNone(form)
self.assertEqual(form.url, "/log_me_in")
self.assertIn("User_Field", form.data)
@@ -51,5 +51,5 @@ class TestFormSearch(unittest.TestCase):
def test_search_form_none(self):
form = loginformsearch.search_form(login_form,
- "nouser", "nopassword")
+ "user_field", "password_field")
self.assertIsNone(form)