-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change UA to distinguish rpi-imager traffic #62
Comments
Do be aware that changing the user-agent everywhere is a little less trivial than it may appear. The image downloads themselves are handled by libcurl and that does allow customization of the user-agent. |
That would still be useful insofar as the image downloads are the primary concern here (i.e. I'd still be happy to whip up something that customized the curl UA alone, if that's acceptable). That said, if QML implements XMLHttpRequest, wouldn't it be possible to use setRequestHeader to customize the UA on the JSON requests too? The UA is "just" a request header after all? |
Think that disallows changing certain headers including user-agent. But haven't tested it. |
I agree, it's probably more useful to track image downloads than it is json file downloads. Of course you'll never be able to track multiple installations of a cached image, but that's fine, it would just be good to understand what the comparison is between people installing with Imager and those installing using raw images... Gordon |
I guess JSON file downloads (metadata used to build the image-selector menu) potentially covers every time RPi Imager ever gets launched? 😉 And those files are probably only ever downloaded by RPi Imager anyway? |
Doh, that certainly would seem to put paid to my setRequestHeader idea (side note: slightly annoying given they're obviously trying to follow the spec there, in which certain headers are forbidden for good security reasons, but UA isn't one of them). Oh well, c'est la vie. |
Other than the odd wget from odd-balls like me trying to figure out what rpi-imager is looking at, very likely :) |
Although that's not the intention, there's no reason why someone else couldn't parse our .json file to develop their own installation system for example, or even just a simple script to go get the link to the latest raspbian image... |
Append "rpi-imager/version-num" to the default User-Agent when curl is downloading the image so that image hosts can more easily distinguish rpi-imager traffic from other traffic.
OK, closing this issue and moving discussion to the pull request |
At the moment, the rpi-imager uses a rather generic user-agent when requesting images (and JSON meta-data) from its servers. Specifically, it's just "Mozilla/5.0" (presumably a default in Qt somewhere). The team here at Canonical were wondering if it would be possible to change the user-agent to something a bit more unique to more easily distinguish requests from the imager (maybe something like "Mozilla/5.0 rpi-imager/1.2", just in case anything's relying on the current "Mozilla/5.0" prefix for compatibility) from other traffic.
I should stress this wouldn't be used to serve anything different, i.e. unlike the case mentioned in #17 where a user-agent change was mooted to get around Sourceforge serving different things to what it thought was "browser" or "not-browser" based on UA. This would purely be so we could determine a bit more easily what proportion of image downloads were definitely from the imager (vs anonymized or default UAs).
I'm happy to put together a PR for this, if it's acceptable?
The text was updated successfully, but these errors were encountered: