qgisinspiretools / qgis-inspire-atom-client-plugin

QGIS Plugin for INSPIRE Pre-defined Atom Downloadservice
5 stars 5 forks source link

Work with HTTP redirects? #10

Open joto opened 3 years ago

joto commented 3 years ago

Currently the plugin doesn't support HTTP redirects. You can see this in the default/demo URL http://www.weichand.de/inspire/dls/verwaltungsgrenzen.xml which redirects to https which makes the plugin not work.

I got the demo URL to work by replacing all QNetworkRequest(url) with something like this:

netreq = QNetworkRequest(url)
netreq.setAttribute(QNetworkRequest.FollowRedirectsAttribute, True)
ejn commented 3 years ago

This appears to be correct. I would be reluctant to automatically follow all redirects - particularly where authentication is required then this is problematic. A similar mechanism to what is present in the WFS 2.0 plugin where the user is asked whether to follow the redirect should however be implemented (and can probably be largely copied verbatim).

I'm not sure when I'll have time to look at this, but a Pull Request would be very welcome!