Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Simple problem -- I need a download manager, console, GUI, does not matter. The catch is in the features:

  • custom header -- I have to pass a cookie in order to download (authorization)

  • resume -- so if download stops for any reason, I could continue from 50% (for example), not from start

  • retry -- so the program could automatically try establish connection and downloading again

  • custom filename output -- so I could give specific filename, where the data go

  • and dynamic redirection -- so if I ask server for file X, and server answers "OK, here is X?token=767" downloader will accept this with original name -- X (i.e. it will think it is the same I asked for)

Since I prefer console, so far I tried wget, curl, aria2c. All of them fail. wget does not handle custom filename output (it is just a dump to a file) and it is "fooled" by redirection -- i.e. as with above example it will store the data in file X?token=767 which in effect ruins both resume and retry, because with each reconnection the token changes.

aria2c and curl do not even start downloading. My guess is, they don't accept redirection at all, aria2c retries again and again with 0 bytes download and no success, curl downloads the response from server the file was moved to X?token=767.

For the record, below my commands for downloading:


wget -rc --no-cookies --header "Cookie: COOKIEKEY=COOKIEVALUE" \


aria2c -o f.gz --check-certificate=false -c -m0 \
       --header="Cookie: COOKIEKEY=COOKIEVALUE" \


curl -o f.gz -C - --retry 1000 \
share|improve this question
up vote 7 down vote accepted

The wget redirection problem can be solved by using

wget --trust-server-names http://www.example.com/X?1234
share|improve this answer
Actually it is --trust-server-names=off, but of course thank you a lot for this info! It is present in wget 1.13. – greenoldman Aug 25 '12 at 20:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.