Skip to content
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

Overriding user-agent used by fetchurl #90034

Closed
sikmir opened this issue Jun 10, 2020 · 8 comments
Closed

Overriding user-agent used by fetchurl #90034

sikmir opened this issue Jun 10, 2020 · 8 comments
Labels
0.kind: bug Something is broken

Comments

@sikmir
Copy link
Member

sikmir commented Jun 10, 2020

Describe the bug
I'm trying to override User-Agent header used by fetchurl (#17757) using:

curlOpts = "--user-agent 'Mac OS X'";

That leads to:

curl: (28) Resolving timed out after 15001 milliseconds
curl: (6) Could not resolve host: X'
curl: (22) The requested URL returned error: 404 Not Found

That's caused by whitespaces in the 'Mac OS X' string, otherwise it works correctly (e.g. with 'Mac_OS_X').

@sikmir sikmir added the 0.kind: bug Something is broken label Jun 10, 2020
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/how-to-set-user-agent-for-fetchurl/7392/2

@lheckemann
Copy link
Member

I'm not sure this can be worked around with the way fetchurl is currently implemented: https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/fetchurl/builder.sh#L20

This could be avoided with the help of structuredAttrs, but that work isn't complete yet.

@gdamjan
Copy link
Contributor

gdamjan commented Sep 22, 2020

shouldn't be enough to just add quotes around $curlOpts here:

@gdamjan
Copy link
Contributor

gdamjan commented Sep 22, 2020

[replying to myself] obviously not. since then the two strings in "--user-agent 'Mozilla 5.0'" are considered a single argument given to curl :/

@stale
Copy link

stale bot commented Mar 21, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Mar 21, 2021
@sikmir
Copy link
Member Author

sikmir commented Mar 21, 2021

Still important.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Mar 21, 2021
@dermetfan
Copy link
Member

Probably duplicate of #41820.

@infinisil
Copy link
Member

Duplicate of #41820

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

No branches or pull requests

6 participants