使用wget下载分块资源?

3

这里有一个示例ASP.NET项目,其中包含此控制器:

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
   protected void Page_Load(object sender, EventArgs e)
   {
       Response.Write("test1234");
       Response.Clear();
       Response.Flush();
       Response.Write("test5");
       Response.End();
   }
}

在浏览器(Chrome 10)中,我看到“test5”和Transfer-Encoding:chunked。
当尝试使用wget(来自最新的Cygwin)下载时,我收到以下信息:
$ wget -S  --read-timeout=60 http://127.0.0.1/EmptyWebSite/test/
--2011-04-05 23:25:51--  http://127.0.0.1/EmptyWebSite/test/
Connecting to 127.0.0.1:80... connected.
HTTP request sent, awaiting response...
  HTTP/1.1 200 OK
  Server: Microsoft-IIS/5.1
  Date: Tue, 05 Apr 2011 20:25:51 GMT
  X-Powered-By: ASP.NET
  X-AspNet-Version: 2.0.50727
  Cache-Control: private
  Content-Type: text/html
Length: unspecified [text/html]
Saving to: `index.html'

[ <=>  ] 0           --.-K/s   in 0s

文件是(显然)空的

出了什么问题?我可以用wget / curl下载这样的资源吗?

3个回答

5

自1.13版本以来,Wget支持HTTP/1.1和分块传输。


4
不使用WGET。来自bugs.debian.org的信息显示,Wget不支持分块传输编码(因此也不支持HTTP / 1.1)。它只会发送HTTP / 1.0请求,这意味着HTTP / 1.1响应是非法的(分块编码也是如此)。Curl支持HTTP / 1.1。

0
啊,使用 curl -v URL 解决了问题...

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接