2011-11-29 71 views
1

我是用Netty的例子org.jboss.netty.example.http.snoop打我注意到 Firefox沒有4個請求導致產生4個HttpRequestHandler實例和Internet Explorer 8/9做2請求導致產生2個HttpRequestHandler實例。的Netty ChannelUpstreamHandler和HTTP管道

我認爲這是由於HTTP 1.1流水線造成的,但是即使在更改Firefox的network.http.pipelining.*密鑰和IE的HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings註冊表項之後,Netty的行爲方式也是如此。

我的問題是,這是預期的和正確的,或者我錯過了一些東西,是否有可能配置Netty丟棄後續的冪等請求或最終由HttpRequestHandler實施?

回答

1

你應該打印出路徑來找出FF正在請求的內容。我很確定它是多次請求的favicon.ico(重試機制),因爲Snoop示例發送的格式無效。

編輯。我驗證了它,它的確是被請求三次圖標:

Thread[New I/O server worker #1-3,5,main] - [id: 0x57c52e72, /0:0:0:0:0:0:0:1:63056 => /0:0:0:0:0:0:0:1:8080] RECEIVED: DefaultHttpRequest(chunked: false) GET/HTTP/1.1 Host: localhost:8080 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip, deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Connection: keep-alive 
Thread[New I/O server worker #1-3,5,main] - GET 
Thread[New I/O server worker #1-3,5,main] -/

Thread[New I/O server worker #1-3,5,main] - [id: 0x57c52e72, /0:0:0:0:0:0:0:1:63056 => /0:0:0:0:0:0:0:1:8080] RECEIVED: DefaultHttpRequest(chunked: false) GET /favicon.ico HTTP/1.1 Host: localhost:8080 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0 Accept: image/png,image/*;q=0.8,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip, deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Connection: keep-alive 
Thread[New I/O server worker #1-3,5,main] - GET 
Thread[New I/O server worker #1-3,5,main] - /favicon.ico 

Thread[New I/O server worker #1-3,5,main] - [id: 0x57c52e72, /0:0:0:0:0:0:0:1:63056 => /0:0:0:0:0:0:0:1:8080] RECEIVED: DefaultHttpRequest(chunked: false) GET /favicon.ico HTTP/1.1 Host: localhost:8080 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip, deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Connection: keep-alive 
Thread[New I/O server worker #1-3,5,main] - GET 
Thread[New I/O server worker #1-3,5,main] - /favicon.ico 

Thread[New I/O server worker #1-3,5,main] - [id: 0x57c52e72, /0:0:0:0:0:0:0:1:63056 => /0:0:0:0:0:0:0:1:8080] RECEIVED: DefaultHttpRequest(chunked: false) GET /favicon.ico HTTP/1.1 Host: localhost:8080 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip, deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Connection: keep-alive 
Thread[New I/O server worker #1-3,5,main] - GET 
Thread[New I/O server worker #1-3,5,main] - /favicon.ico 
+0

我覺得這是在FF的一個錯誤,因爲FF請求與接受,hreader設置爲圖標的text/html,是application/xhtml + xml,application/xml在最後兩個請求中。有人有更多的信息嗎? –

+0

謝謝 - 將會驗證並更新結果。 –

+0

Japer - 確認;奇怪的確,FF爲favicon要求3次,Chrome和IE對單個favicon請求感到滿意:)。 –