3

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  --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

And the file is (obviously) empty

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

4

3 に答える 3

5

バージョン 1.13 以降、Wget は HTTP/1.1 とチャンク転送をサポートしています。

于 2015-01-20T22:29:48.283 に答える
4

WGET ではありません。bugs.debian.orgから

Wget は、チャンク転送エンコーディングをまったくサポートしていません (したがって、HTTP/1.1 もサポートしていません)。HTTP/1.0 リクエストのみを送信します。つまり、HTTP/1.1 レスポンスは (チャンク エンコーディングと同様に) 違法です。

Curl は HTTP/1.1 をサポートしています

于 2011-04-05T21:19:21.590 に答える
0

ああ、curl -v URLで解決しました...

于 2011-04-05T21:14:04.200 に答える