You may say it will look at Content-Disposition
for file name, but I'm talking about where there's nothing in that header and also URL is not so straight forward like http://website.com/myfile.zip
. I leave some examples here but wondering how browser (I use FireFox) find out the right name in save as dialog
. Does it know the URL syntax for famous websites ?
download links in sourceforge.net
download links in cnet.com
download from your own localhost
I used Fiddler2
for reverse engineering.
URL: http://mesh.dl.sourceforge.net/project/npp-plugins/Function List/FunctionList Plugin v2.1/FunctionList_2_1_UNI_dll.zip
Fiddler output sample:
HTTP/1.1 200 OK
Date: Sat, 13 Nov 2010 22:46:31 GMT
Server: Apache/2.2.9 (Debian)
Last-Modified: Thu, 18 Feb 2010 04:35:26 GMT
ETag: "142a602c-1fe24-47fd87eed7f80"
Accept-Ranges: bytes
Content-Length: 130596
Connection: close
Content-Type: application/zip
EDIT: Problem is Content-Disposition
is not set at final response, instead it at one of redirection. HttpWebRespose
header contains last response header
(AllowAutoRedirec
t = true
). I need to keep track of all responses and check if there is a Content-Disposition
then remember it. How ?