开发者

Download chunked resource with wget?

开发者 https://www.devze.com 2023-02-22 12:46 出处:网络
There\'s a sample ASP.NET project with this controller: using System; using System.Collections.Generic;

There's a sample ASP.NET project with this controller:

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();
   }
}

In the browser (Chrome 10) I see "test5" and Transfer-Encoding:chunked

When trying to download with wget (from the most recent Cygwin) I get

$ wget -S  --rea开发者_Go百科d-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

And the file is (obviously) empty

What's going wrong? Can I download such a resource with wget / curl?


Wget has a support of HTTP/1.1 and chunked transfer since version 1.13


Not with WGET. From bugs.debian.org

Wget has zero support for chunked transfer encodings (and therefore, for HTTP/1.1). It will only ever send HTTP/1.0 requests, which means that a HTTP/1.1 response is illegal (as is the chunked encoding).

Curl supports HTTP/1.1


Ah, solved with curl -v URL...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号