如何让Wget处理HTTP 100-继续响应?
我想发布一个HTML(包含在文件中)使用Wget这样的URL:如何让Wget处理HTTP 100-继续响应?
wget -O- --debug
--header=Content-Type:text/html
--post-file=index.html
http://localhost/www/encoder.ashx
到的HTML被发布的URL是用ASP实现的Web应用程序的终点。净。服务器回复100 (Continue)响应,Wget只是停止响应,而不是继续执行实际响应,即应该接下来。
Can Wget可以以某种方式被告知处理一个100(继续)响应,或者这是该工具的一些众所周知的限制吗?
注:
-
我注意到,Wget的永远不会发送 的
Expect: 100-Continue
头这样 技术上服务器不应该 发出100(继续)响应。UPDATE:看起来这是可能的,因为每§8.2.3 RFC 2616 (Hypertext Transfer Protocol -- HTTP/1.1)的:
原始服务器不应发送100(继续)响应如果 请求消息不包括期望请求 - 如果此请求来自HTTP/1.0 (或更早版本)客户端,则带有“100-继续”期望的首字段 字段,并且不得发送 100(继续)响应。此规则有一个例外:对于 与RFC 2068,的兼容性,服务器可以发送100(继续) 状态,以响应HTTP/1.1 PUT或POST请求,而 不包括带有Expect请求标头字段的“100- 继续”的期望。此例外情况为 ,旨在最大限度地减少与未声明的等待100(继续)状态相关的任何客户端处理延迟,仅适用于 HTTP/1.1请求,而不适用于具有任何其他HTTP- 版本值的请求。
cURL这样的交易没有问题。 它发送一个
Expect: 100-Continue
标题 并继续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.
我看了看源代码给wget用于Windows,并且尽我所能当wget无法正确解析响应时,告诉调试输出来自通用错误条件。看起来这只是wget的限制,所以你可能不得不使用curl或其他方法来避免遇到这个问题。