It is currently April 19th, 2024, 2:43 am

New Flags WebParser Option

Changes made during the Rainmeter 4.4 beta cycle.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

New Flags WebParser Option

Post by jsmorley »

Due to the recent issue with weather.com and cookies causing some issues, we have added a new Flags option to WebParser.

Flags Option

What this does is allow you to set some options for how WebParser connects to a remote HTTP/HTTPS resource.

These are set on a "parent" WebParser measure, and multiple flags can be set by separating them with the | (pipe) character.

The ones you might be the most interested in are:

Resync
Only downloads if the resource has been modified since the last time it was downloaded. Otherwise the cache is used. This is the default if no Flags are set.

ForceReload
Forces a download of the requested resource from the origin server, not from the cache.

NoCookies
Does not add cookie headers to requests, and does not add any cookies set by the resource to the cookie database. Does not "send" or "accept" cookies from any resource.

NoCacheWrite
Does not add the returned resource data to the cache.

In particular, the NoCookies flag seems to correct the issues with skins that parse the JSON on weather.com.

Really, there is no reason to ever allow WebParser to accept or send cookies, this can almost never do any good, and only potentially cause some mischief.

Just FYI, this is how I am setting all my WebParser measures going forward:

Code: Select all

Flags=Resync | NoCookies
UserAgent=Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0
The idea is that I will take advantage of the "cache" when possible, to keep performance as good as I can, while always ignoring any "cookies" in WebParser. I then set my UserAgent String to a Windows desktop browser string, so what I get using debug=2 in WebParser will match what I get in my browser.

Note that if you distribute your skin(s) to someone who is not on the current 4.4 beta of Rainmeter, these settings will do no harm, as it will transparently ignore the Flags option, and will default to the single setting of "Resync" that has always been the default behavior. If on the other hand, you get a complaint from your user(s) that a site is misbehaving with WebParser, you might want to suggest they upgrade to the latest beta.