Comment 9 for bug 340106

Revision history for this message
In , Harald Sitter (apachelogger) wrote :

CCing David Faure for some input

This is either a bug in QUrl or not a bug at all.

We do

```
               QUrl u("smb://");
               u.setHost(dirpName);
```

to which QUrl says
> Invalid hostname (contains invalid characters); source was \"FOO BAR\"; scheme = \"smb\", host = \"\"

https://tools.ietf.org/html/rfc3986#section-3.2

defines host as
> host = IP-literal / IPv4address / reg-name`
of which the only relevant group for the bug is reg-name:
> reg-name = *( unreserved / pct-encoded / sub-delims )
of which no group would allow for spaces except for pct-encoded, assuming the space is percent-encoded of course.

Which would make this a QUrl bug if the RFC didn't also explicitly say:

> URI producing
> applications must not use percent-encoding in host unless it is used
> to represent a UTF-8 character sequence.

I **think** that is meant to say that one must not percent-encode if the character is plain ASCII, so by extension a space cannot be part of reg-name at all.

OTOH I ran smb://FOO%20BAR/ through a bunch of other rfc3986/7 implementation and they all found it to be perfectly valid.

So, I am really not sure.

Iff spaces cannot be expressed, then spaces in workgroup and domains are probably not supportable as it'd impair URI portability. Also QUrl would then be behaving correctly in declaring the URI invalid, and we use QUrl all over the place, so that'd be a bit of a problem.