lftp has a GetSuggestedFileName() function which will look at the HTTP Content-Disposition header to try and determine the filename, but it doesn't appear to be used anywhere.
-(~/tmp/lftp-2.6.6) grep GetSuggestedFileName -r .
./src/ChangeLog: * Http.cc, FileAccess.cc, FileAccess.h: (GetSuggestedFileName)
new
./src/FileAccess.h: const char *GetSuggestedFileName() { return suggested_filename; }Seems this bit was actually added in July 2002, but maybe it was just forgotten or it's use removed due to problems?
Here's one URL from sun which sets the Content-Disposition / filename header.
http://sunsolve.sun.com/pub-cgi/patchDownload.pl?target=110945&method=h Content-Disposition: attachment; filename="110945-08.zip"
And another type which the cgi name is used instead of the target filename is on tranceaddict.com, but I'm sure there's many others.
http://www.tranceaddict.com/cgi-bin/videos.pl.cgi?VID-kai-tracid-too_many_times Location: ftp://avb.tranceaddict.com/videos/Kai_Tracid-Too_Many_Times-www_tranceaddict_com.m2v
This is saved as videos.pl.cgi?VID-kai-tracid-too_many_times, but I think it would be nice if the file would be saved as the name in the Location header.
Although this behavior might seem strange at first, maybe it would be best to try and resolve the filename. lftp is a great program, I use it for 99% of my downloading. My only gripe is filename handling on some of these URLs, which I don't see too often, so there's not too much griping. :)
Has anyone ever suggested something like this? I only found 2 messages on the list that mentioned Content-Disposition, not sure about the redirects.
Mike
