1

I was playing with the Netty example org.jboss.netty.example.http.snoop and I noticed that Firefox does 4 requests leading to the creation of 4 HttpRequestHandler instances and Internet Explorer 8/9 does 2 request leading to the creation of 2 HttpRequestHandler instances.

I think this is due to the HTTP 1.1 pipelining, however even after changing the network.http.pipelining.* keys for FireFox and the HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings registry entries for IE, Netty behaves the same way.

My question is, is this expected and correct or am I missing something and is it possible to configure Netty to drop subsequent idempotent requests or this has to be implemented by the HttpRequestHandler eventually?

4

1 回答 1

1

您应该打印出路径以找出 FF 请求的内容。我很确定它是 favicon.ico 多次请求(重试机制),因为 Snoop 示例发送的格式无效。

编辑。我验证了,确实是favicon,被请求了3次:

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
于 2011-11-29T12:31:50.657 回答