News for hackers. Stuff that matters.
Re:How the URL Was Built by gumby on Friday October 09, 2020 @11:55AM (#24731149)
Actually they can, though it is not recommended as URLs appear in running text, which may break lines at space characters. Just look at appendices A and B of RFC 3986.

Although it's recommended that you encode them in user representation (for this reason) you can certainly should be able to send a space character through at the protocol level and if not it's a bug.

Note that a space is not valid in the host name portion if you are using DNS (which most URLs do, of course).

Re:How the URL Was Built by account42 on Monday October 12, 2020 @03:47AM (#24752295)
The EBNF in appendix A does not allow any spaces. Specifically, there is also this section in RFC 3986.

> 2.4.3. Excluded US-ASCII Characters

> Although they are disallowed within the URI syntax, we include here a description of those US-ASCII characters that have been excluded and the reasons for their exclusion.

[...]

> space = <US-ASCII coded character 20 hexadecimal>

You can certainly encode spaces in URLs but the URL will not contain spaces.

The regular expression in appendix B is irrelevant because it assumes a well-formed URL so spaces do not need to be explicitly excluded.

And at the protocol level you certainly can't use spaces in URLs (in HTTP 1.1) because the request line uses spaces to delimit the URL or path.