FS#34175 - [pacman] set user agent in makepkg.conf to avoid HTTP 406 Error

Attached to Project: Arch Linux
Opened by speps (archspeps) - Wednesday, 06 March 2013, 16:34 GMT
Last edited by Dave Reisner (falconindy) - Wednesday, 06 March 2013, 16:51 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To No-one
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
Some resources needs an user agent to be reached.
Actually, the default curl settings specified for DLAGENTS in makepkg.conf
do not provide a flag to set an user agent in the HTTP request,
causing some resources download to fail with:

curl: (22) The requested URL returned error: 406 Not Acceptable

This can be solved by setting an user agent in makepkg.conf, like '-A "Mozilla/4.0"`.
This way (according to latest release):

DLAGENTS=('ftp::/usr/bin/curl -fC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'
'http::/usr/bin/curl -A "Mozilla/4.0" -fLC - --retry 3 --retry-delay 3 -o %o %u'
'https::/usr/bin/curl -A "Mozilla/4.0" -fLC - --retry 3 --retry-delay 3 -o %o %u'
'rsync::/usr/bin/rsync -z %u %o'
'scp::/usr/bin/scp -C %u %o')

Attached a git diff to apply on current trunk (makepkg.conf.in)

Additional info:
* package version(s): 4.0.*
When wget was replaced by curl (wget worked fine).

Steps to reproduce:
$ curl -fLC - --retry 3 --retry-delay 3 "http://elf-stone.com/downloads/GLee/GLee-5.4.0-src.tar.gz"
curl: (22) The requested URL returned error: 406 Not Acceptable
This task depends upon

Closed by  Dave Reisner (falconindy)
Wednesday, 06 March 2013, 16:51 GMT
Reason for closing:  Won't fix
Additional comments about closing:  For problematic packages, you can override the DLAGENT in the PKGBUILD. We shouldn't blatantly lie about the UA for all packages just because a small number of hostmasters can't be bothered to deal with abuse in a sane way.
Comment by Dave Reisner (falconindy) - Wednesday, 06 March 2013, 16:39 GMT
curl already sets a user agent.

$ curl -vI www.google.com |& grep User-Agent
> User-Agent: curl/7.29.0

If the remote service is rejecting the request based on the UA being curl then, quite frankly, they're assholes.

Anecdotally, I'll mention that there's just as many (if not more) sites which block requests with a wget UA.

Loading...