I'm trying to force an HTTP request to refresh. I know I can append ?rnd=seconds_since_epoch to the URL, but the URL in question might have a query string already that I don't want to break. Is there a header I can set to force a refresh?
Edit:
Experimenting a little more: One of the pages I am testing on is stackoverflow.com. In the HTTP response it sets Expires to one minute from the request. The browser seems to be ignoring the "private, no-store, max-age=0" and Expires header that I am setting and caches the response for a minute. I don't want to dig that deep into PyQt networking, so I am going to use the ?rnd=seconds method.
Could this potentially break pages that see an unknown GET variable?
Edit 2:
I did dig a little deeper and it turns out that QNetworkRequest CacheLoadControl defaults override QWebSettings setObjectCacheCapacities(), setMaximumPagesInCache() and even clearMemoryCaches()!
The trick is to set the CacheLoadControl of the QNetworkRequest to 0, or AlwaysNetwork (http://qt-project.org/doc/qt-4.8/qnetworkrequest.html#CacheLoadControl-enum). The default is 1, PreferNetwork, which fetches from the cache if it's within the Expires header timestamp.
I'll leave this here to save a lot of headache to the next person.
I did dig a little deeper and it turns out that QNetworkRequest CacheLoadControl defaults override QWebSettings setObjectCacheCapacities(), setMaximumPagesInCache() and even clearMemoryCaches()!
The trick is to set the CacheLoadControl of the QNetworkRequest to 0, or AlwaysNetwork (http://qt-project.org/doc/qt-4.8/qnetworkrequest.html#CacheLoadControl-enum
). The default is 1, PreferNetwork, which fetches from the cache if it's within the Expires header timestamp.
I'll leave this here to save a lot of headache to the next person.