浏览器如何在下载中找到文件名?

Xaq*_*ron 2 browser filenames download

您可能会说它会查看Content-Disposition文件名,但我在谈论那个标题中没有任何内容,而且URL也不是那么直接http://website.com/myfile.zip.我在这里留下一些例子,但想知道浏览器(我使用FireFox)如何找到正确的名称save as dialog.它知道着名网站的URL语法吗?

download links in sourceforge.net
download links in cnet.com
download from your own localhost
Run Code Online (Sandbox Code Playgroud)

我用于Fiddler2逆向工程.

URL:http://mesh.dl.sourceforge.net/project/npp-plugins/Function List/FunctionList Plugin v2.1/FunctionList_2_1_UNI_dll.zip

提琴手输出样本:

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
Run Code Online (Sandbox Code Playgroud)

编辑:问题是Content-Disposition没有设置在最终响应,而是在重定向之一.HttpWebResposeheader包含last response header(AllowAutoRedirect = true).我需要跟踪所有回复并检查是否有Content-Disposition记忆.怎么样 ?

Alb*_*nez 5

DO使用content-disposition或任何其他的标准方法.看到这个例子,我只是使用Live HTTP Headers从SourceForge获取:

HTTP/1.1 302 Found
X-Powered-By: PHP/5.2.9
Content-Disposition: attachment; filename="FunctionList_2_1_UNI_dll.zip"
Location: http://mesh.dl.sourceforge.net/project/npp-plugins/Function%20List/FunctionList%20Plugin%20v2.1/FunctionList_2_1_UNI_dll.zip
Content-Type: text/html
Content-Length: 0
Date: Sat, 13 Nov 2010 22:30:00 GMT
Server: lighttpd/1.4.26
Run Code Online (Sandbox Code Playgroud)

请注意,他们也使用重定向,也许你会对此感到困惑.