Simply dont use path(), instead use text parsing, here is an example:
bool HttpGetFile::ParseUrl( const QString& qstrUrlIn, int& iError )
{
if( qstrUrlIn.length() == (qUrl.scheme().length() + 3 + qUrl.host().length()) )
{
qstrUrl += "/";
qUrl = qstrUrl;
}
if( !qUrl.isValid() )
{
iError = 8;
return false;
}
if( qUrl.scheme() != "http" )
{
iError = 9;
return false;
}
qstrHost = qUrl.host();
qstrPath = qstrUrl.remove( 0, 7 + qstrHost.length() );// 7 == http://
return true;
}
bool HttpGetFile::ParseUrl( const QString& qstrUrlIn, int& iError )
{
QString qstrUrl = qstrUrlIn;
QUrl qUrl( qstrUrl );
if( qstrUrlIn.length() == (qUrl.scheme().length() + 3 + qUrl.host().length()) )
{
qstrUrl += "/";
qUrl = qstrUrl;
}
if( !qUrl.isValid() )
{
iError = 8;
return false;
}
if( qUrl.scheme() != "http" )
{
iError = 9;
return false;
}
qstrHost = qUrl.host();
qstrPath = qstrUrl.remove( 0, 7 + qstrHost.length() );// 7 == http://
return true;
}
To copy to clipboard, switch view to plain text mode
Bookmarks