The solution you recommend seems to me though that it would be necessary in most circumstances to change this file name "by URL". Meaning, the option to determine the default file name wouldn't be "global" to all URL's. Because: 1.) if you're only downloading one file (as in my work around) you can already specifiy the file name to be created on the command line via the output-document option. And, 2.) if you're downloading recursively, in most cases it seems that the default file name (meaning the local file name created for URL's ending in a slash) would be index.html - as wget is currently written. And, any exceptions to to this rule shouldn't override what is the vast majority of the cases.
I base these opinions on the idea that as the web grows, there will be more and more document types processed by the client and not on the server. I actually mentioned this issue on the #wordpress channel on freenode where several of the wordpress developers hang out. They seemed pretty emphatic that URL's should leave out any final index.html or index.xml, as it's superfluous information on the URL and makes the URL more difficult to read and remember. They even pointed me to a couple of docs on the web recommending this approach. The reasoning was similar to another mention I saw mentioned on these pages, not using tilde's in URL's, because average users who have no exposure to UNIX may not recognize the character when copying URL's by hand.
Of course, wget could probably stand to wait for these files to become more prevalent before implementing this functionality. Wget is a great tool, and probably has a long future of use for web development. I just think implementing these features sooner rather than later would make transitioning to these features more seamless for its users. That said, I imagine this probably isn't a much demanded feature these days.
Also, you mention wanting to create the file name before downloading. I'm not sure why making the file name only after the headers arrive would be difficult. Maybe there's just a lot of code that a file name extension would have to be passed back through to get to the point where a file name should be created in the code? Creating a default file name sounds like a simple enough process. But, I've never looked at the code myself.
-Levander
Hrvoje Niksic wrote:
As currently written, Wget really prefers to determine the file name
based on the URL, before the download starts (redirections are sort of
an exception here). It would be easy to add an option to change
"index.html" to "index.xml" or whatever you desire, but it would be
much harder to determine the file name only after the headers arrive.
-- Levander's Yabbering! http://home.mindspring.com/~levander
