Fix build on older Qt versions due missing QLatin1String methods (2)
@@ -540,7 +540,7 @@ static ApiVersion getAcceptHeaderApiVersion(const QString &hdrValue)
const auto ls = hdrValue.split(QLatin1Char(','), QString::SkipEmptyParts);
- for (int i = 0; !versions[i].str.isEmpty(); i++)
+ for (int i = 0; versions[i].str.size() > 0; i++)
{
if (ls.contains(versions[i].str))
{
@@ -17602,11 +17602,11 @@ QDialog *DeRestPlugin::createDialog()
*/
bool DeRestPlugin::isHttpTarget(const QHttpRequestHeader &hdr)
{
- if (hdr.path().startsWith(QLatin1String("/api")))
+ if (hdr.pathAt(0) == QLatin1String("api"))
{
return true;
}
- else if (hdr.path().startsWith(QLatin1String("/description.xml")))
+ else if (hdr.pathAt(0) == QLatin1String("description.xml"))
{
if (!d->descriptionXml.isEmpty())
{
@@ -17637,7 +17637,7 @@ int DeRestPlugin::handleHttpRequest(const QHttpRequestHeader &hdr, QTcpSocket *s
}
if(hdr.hasKey(QLatin1String("Content-Type")) &&
- hdr.value(QLatin1String("Content-Type")).startsWith(QLatin1String("multipart/form-data")))
+ hdr.value(QLatin1String("Content-Type")) == QLatin1String("multipart/form-data"))
{
if (DBG_IsEnabled(DBG_HTTP))
{
@@ -17741,8 +17741,7 @@ int DeRestPlugin::handleHttpRequest(const QHttpRequestHeader &hdr, QTcpSocket *s
stream.flush();
return 0;
}
-
- else if (hdr.path().startsWith(QLatin1String("/description.xml")) && (hdr.method() == QLatin1String("GET")))
+ else if (req.path.size() == 1 && req.path[0] == QLatin1String("description.xml") && hdr.method() == QLatin1String("GET"))
{
rsp.httpStatus = HttpStatusOk;
rsp.contentType = HttpContentHtml;
@@ -17762,7 +17761,7 @@ int DeRestPlugin::handleHttpRequest(const QHttpRequestHeader &hdr, QTcpSocket *s
return 0;
}
- else if (req.path[0] == QLatin1String("api"))
+ else if (!req.path.isEmpty() && req.path[0] == QLatin1String("api"))
{
bool resourceExist = true;
