Hexxeh / rpi-update

An easier way to update the firmware of your Raspberry Pi
MIT License
1.94k stars 232 forks source link

always set user-agent for api.github.com requests #305

Closed vszakats closed 4 years ago

vszakats commented 4 years ago

This makes the updater work in environments where user agent is disabled via .curlrc (or similar means), and where rpi-update would otherwise run into an Invalid hash given error.

Ref: https://developer.github.com/v3/#user-agent-required

popcornmix commented 4 years ago

Wouldn't it be simpler/more robust to add "-A curl" to CURL_OPTIONS ? (like -L is added).

vszakats commented 4 years ago

@popcornmix It'd be simpler, but the current patch respects user's default choice better by leaving user-agent to the default value in curl calls where any/no user-agent works equally well.

popcornmix commented 4 years ago

How about a new options variable? e.g. CURL_OPTIONS_API=${CURL_OPTIONS_API:-"-A curl"} and add that to just the api calls that need it?

vszakats commented 4 years ago

Sounds good!

vszakats commented 4 years ago

I've updated the patch.

popcornmix commented 4 years ago

Thanks!