{
// schemes are strictly RFC-compliant:
// scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
- // but we need to decode any percent-encoding sequences that fall on
- // those characters
// we also lowercase the scheme
+ // schemes in URLs are not allowed to be empty, but they can be in
+ // "Relative URIs" which QUrl also supports. QUrl::setScheme does
+ // not call us with len == 0, so this can only be from parse()
scheme.clear();
- sectionIsPresent |= Scheme;
- sectionHasError |= Scheme; // assume it has errors, we'll clear before returning true
- errorCode = SchemeEmptyError;
if (len == 0)
return false;
+ sectionIsPresent |= Scheme;
+
// validate it:
errorCode = InvalidSchemeError;
int needsLowercasing = -1;
QString msg = QStringLiteral("Invalid scheme (character '%1' not permitted)");
return msg.arg(c);
}
- case QUrlPrivate::SchemeEmptyError:
- return QStringLiteral("Empty scheme");
case QUrlPrivate::InvalidUserNameError:
return QString(QStringLiteral("Invalid user name (character '%1' not permitted)"))
enum ErrorCode {
// the high byte of the error code matches the Section
InvalidSchemeError = Scheme << 8,
- SchemeEmptyError,
InvalidUserNameError = UserName << 8,