2008-09-24 34 views
1

我想發佈一個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. 

回答

1

我看了看源代碼給wget用於Windows,並且盡我所能當wget無法正確解析響應時,告訴調試輸出來自通用錯誤條件。看起來這只是wget的限制,所以你可能不得不使用curl或其他方法來避免遇到這個問題。