summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/io/qurl.cpp12
-rw-r--r--src/corelib/io/qurl_p.h1
2 files changed, 5 insertions, 8 deletions
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 0f8ed9fb17..3c82a2659f 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -661,17 +661,17 @@ bool QUrlPrivate::setScheme(const QString &value, int len)
{
// 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;
@@ -3413,8 +3413,6 @@ static QString errorMessage(QUrlPrivate::ErrorCode errorCode, QChar c)
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)"))
diff --git a/src/corelib/io/qurl_p.h b/src/corelib/io/qurl_p.h
index 8c1e307521..12ab0c763d 100644
--- a/src/corelib/io/qurl_p.h
+++ b/src/corelib/io/qurl_p.h
@@ -79,7 +79,6 @@ public:
enum ErrorCode {
// the high byte of the error code matches the Section
InvalidSchemeError = Scheme << 8,
- SchemeEmptyError,
InvalidUserNameError = UserName << 8,