代码之家  ›  专栏  ›  技术社区  ›  Atif Aziz

如何使Wget处理http100继续响应?

  •  1
  • Atif Aziz  · 技术社区  · 17 年前

    我正在尝试使用将HTML(包含在文件中)发布到URL Wget

    wget -O- --debug
         --header=Content-Type:text/html
         --post-file=index.html
         http://localhost/www/encoder.ashx
    

    将HTML发布到的URL是使用ASP.NET实现的Web应用程序端点。服务器用一个 100 (Continue) 响应和Wget只是停止在它的轨道上,而不是继续运行 回答是 应该 下一步。

    Wget是否可以告诉hanlde 100(继续)响应,或者这是该工具的一些众所周知的限制?

    • 我注意到Wget从不发送 这个 Expect: 100-Continue 头so 发出100(继续)响应。

      更新: §8.2.3 属于 RFC 2616 (Hypertext Transfer Protocol -- HTTP/1.1)

      如果发生以下情况,源服务器不应发送100(继续)响应 请求消息不包括Expect请求标头 字段具有“100 continue”期望值,并且不得发送 (或更早)客户。这条规则有一个例外:对于 与RFC 2068的兼容性, 服务器可能会发送100(继续) 响应HTTP/1.1 PUT或POST请求的状态 不包括带有“100”的Expect请求标头字段- 继续“期待”。 此例外情况的目的是 最大限度地减少与 未声明的等待100(继续)状态,仅适用于 版本值。

    • cURL 它发送了一个 预期:100人继续 标题 去真正的那个。

    有关更多信息,请参阅上面显示的调用中事务的完整调试跟踪:

    Setting --post-file (postfile) to index.html
    Setting --header (header) to Content-Type:text/html
    DEBUG output created by Wget 1.10 on Windows.
    
    --13:29:17--  http://localhost/www/encoder.ashx
               => `-'
    Resolving localhost... seconds 0.00, 127.0.0.1
    Caching localhost => 127.0.0.1
    Connecting to localhost|127.0.0.1|:80... seconds 0.00, connected.
    Created socket 296.
    Releasing 0x01621a10 (new refcount 1).
    
    ---request begin---
    POST /www/encoder.ashx HTTP/1.0
    User-Agent: Wget/1.10
    Accept: */*
    Host: localhost
    Connection: Keep-Alive
    Content-Type: text/html
    Content-Length: 30984
    
    ---request end---
    [writing POST file index.html ... done]
    HTTP request sent, awaiting response...
    ---response begin---
    HTTP/1.1 100 Continue
    Server: ASP.NET Development Server/9.0.0.0
    Date: Wed, 24 Sep 2008 11:29:17 GMT
    Content-Length: 0
    
    ---response end---
    100 Continue
    Closed fd 296
    13:29:17 ERROR 100: Continue.
    
    1 回复  |  直到 17 年前
        1
  •  1
  •   Jay    17 年前

    我查看了wget for Windows的源代码,据我所知,调试输出来自wget无法正确解析响应时的一般错误条件。看起来这只是wget的一个限制,所以您可能必须使用curl或其他方法来避免遇到这个问题。

    推荐文章