On an HTTP level, the server sends the filename information to the client in the Content-Disposition
header field within the HTTP response:
HTTP/1.1 200 OK
[…]
Content-Disposition: attachment; filename="bind-9.9.4-P2.tar.gz";
See RFC2183 for details on the Content-Disposition
header field.
wget
has experimental support for this feature according to its manpage:
--content-disposition If this is set to on, experimental (not fully-functional) support for "Content-Disposition" headers is enabled. This can currently result in extra round-trips to the server for a "HEAD" request, and is known to suffer from a few bugs, which is why it is not currently enabled by default.
So if you choose to enable it, just specify the --content-disposition
option. (You could also use curl
to do the job instead of wget
, but the question was about wget
.)