gruns / furl

🌐 URL parsing and manipulation made easy.
Other
2.6k stars 151 forks source link

Fixed Scheme validation to reject schemes with non-alphanumeric characters #171

Open JohnJamesUtley opened 1 year ago

JohnJamesUtley commented 1 year ago

Background

RFC 3986 defines a scheme as follows

scheme        = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )

The Bug

Furl will accept non-alphanumeric characters in its schemes

import furl
f = furl.furl('sch^eme://user@host.com')
print(f.scheme)

In this example, Furl will currently print the scheme as 'sch^eme'. This is in violation of RFC 3896 because of the '^' character.

The Pull Request