Skip to content

Commit

Permalink
[bugfix] Do not cache invalid WM(T)S responses
Browse files Browse the repository at this point in the history
The problem here was that in case of http->https redirect
from a misconfigured server (that advertizes http and then
redirects all request to https) all http redirect requests
were cached, making all subsequent requests to the same
url hit the 301 Moved Permanently reponse page intead of
the redirected content.

Fixes #16427 WMTS rendering problems in 2.18 and Master
  • Loading branch information
elpaso committed Oct 3, 2017
1 parent 22d4d22 commit d102404
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/providers/wms/qgstilecache.cpp
Expand Up @@ -48,9 +48,12 @@ bool QgsTileCache::tile( const QUrl &url, QImage &image )
image = QImage::fromData( imageData );

// cache it as well (mutex is already locked)
sTileCache.insert( url, new QImage( image ) );

return true;
// Check for null because it could be a redirect (see: https://issues.qgis.org/issues/16427 )
if ( ! image.isNull( ) )
{
sTileCache.insert( url, new QImage( image ) );
return true;
}
}
}
return false;
Expand Down

0 comments on commit d102404

Please sign in to comment.