You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@mina.apache.org by br...@gmail.com on 2010/12/21 23:19:04 UTC
asyncweb request parsing problem
I am seeing a problem with asyncweb in a particular case when the
incoming header is spread over two io buffers. I believe that in most
cases, the decode picks up with the next buffer and keeps going
through the entire request, or a problem would have been seen before
now. In fact, in my own testing with various browsers, I see no
problems at all, with the one exception below when I click Refresh on
Firefox. In that case, this problem happens fairly reliably.
My setup is as follows:
Mina 2.01
Async Web trunk: December 9, 2010
JRE 1.6.0_22 64 bit
Win7 x64
initialization:
NioSocketAcceptor acceptor80 = new NioSocketAcceptor();
acceptor80.getFilterChain().addLast("codec",new
ProtocolCodecFilter(new HttpCodecFactory()));
acceptor80.setHandler(new MyHttpHandler());
acceptor80.bind(new InetSocketAddress(80));
The incoming IoBuffers are as follows: (note second buffer has trailing CrLf)
===================================
GET /-1/iv6/gwt/chrome/images/hborder.png HTTP/1.1
Host: local.zzzzzzzzz.net
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US;
rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13
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
Keep-Alive: 115
Connection: keep-alive
Referer: http://local.zzzzzzzzz.net/-1/iv6/gwt/chrome/chrome.css
If-Modified-Since: Fri, 17 Dec 2010 00:01:48 GMT
Cache-Control: ma
===================================
x-age=0
===================================
I am seeing a new request decoding state beginning at the second
buffer, but the request is never completed and sent on to the handler,
and the browser keeps waiting for a response that never comes.
I added some debug output to HttpHeaderDecodingState and
HttpRequestDecodingState to see what was happening. The header fields
are read up to and including "Cache-Control:" but the final header
value is not completed. See deteils below.
If you can provide any guidance for how to resolve this issue, I would
be very grateful.
INIT REQUEST DECODING STATE
READING HEADER NAME
READ HEADER NAME:Host
READING HEADER VALUE
HEADER VALUE:local.zzzzzzzzz.net
READING HEADER NAME
READ HEADER NAME:User-Agent
READING HEADER VALUE
HEADER VALUE:Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US;
rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13
READING HEADER NAME
READ HEADER NAME:Accept
READING HEADER VALUE
HEADER VALUE:image/png,image/*;q=0.8,*/*;q=0.5
READING HEADER NAME
READ HEADER NAME:Accept-Language
READING HEADER VALUE
HEADER VALUE:en-us,en;q=0.5
READING HEADER NAME
READ HEADER NAME:Accept-Encoding
READING HEADER VALUE
HEADER VALUE:gzip,deflate
READING HEADER NAME
READ HEADER NAME:Accept-Charset
READING HEADER VALUE
HEADER VALUE:ISO-8859-1,utf-8;q=0.7,*;q=0.7
READING HEADER NAME
READ HEADER NAME:Keep-Alive
READING HEADER VALUE
HEADER VALUE:115
READING HEADER NAME
READ HEADER NAME:Connection
READING HEADER VALUE
HEADER VALUE:keep-alive
READING HEADER NAME
READ HEADER NAME:Referer
READING HEADER VALUE
HEADER VALUE:http://local.zzzzzzzzz.net/-1/iv6/gwt/chrome/chrome.css
READING HEADER NAME
READ HEADER NAME:If-Modified-Since
READING HEADER VALUE
HEADER VALUE:Fri, 17 Dec 2010 00:01:48 GMT
READING HEADER NAME
READ HEADER NAME:Cache-Control
INIT REQUEST DECODING STATE
Re: asyncweb request parsing problem
Posted by Emmanuel Lecharny <el...@gmail.com>.
On 12/22/10 1:30 AM, bryandonnovan@gmail.com wrote:
> I solved the problem (in my code, anyway) by putting another filter in front
> of the HttpRequestDecoder -- the simple filter just accumulates data until
> it finds the double CrLf, and only then sends it on to HttpRequestDecoder .
>
> Obviously not a permanent solution, but it does the job for now.
>
> I would like to understand enough about the HttpRequestDecoder to fix it,
> but the code is so heavily factored that it is hard for me to follow how it
> works.
AFAIR, the HttpRequestDecoder is based on a StateMachine decoder, and I
have no knowledge about this part of the MINA code.
Obviously, Asyncweb needs some love, as it's currently not released...
If you fill like participating, welcome !
--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com
Re: asyncweb request parsing problem
Posted by br...@gmail.com.
I solved the problem (in my code, anyway) by putting another filter in front
of the HttpRequestDecoder -- the simple filter just accumulates data until
it finds the double CrLf, and only then sends it on to HttpRequestDecoder .
Obviously not a permanent solution, but it does the job for now.
I would like to understand enough about the HttpRequestDecoder to fix it,
but the code is so heavily factored that it is hard for me to follow how it
works.
On Tue, Dec 21, 2010 at 2:19 PM, <br...@gmail.com> wrote:
> I am seeing a problem with asyncweb in a particular case when the
> incoming header is spread over two io buffers. I believe that in most
> cases, the decode picks up with the next buffer and keeps going
> through the entire request, or a problem would have been seen before
> now. In fact, in my own testing with various browsers, I see no
> problems at all, with the one exception below when I click Refresh on
> Firefox. In that case, this problem happens fairly reliably.
>
> My setup is as follows:
>
> Mina 2.01
> Async Web trunk: December 9, 2010
> JRE 1.6.0_22 64 bit
> Win7 x64
>
> initialization:
>
> NioSocketAcceptor acceptor80 = new NioSocketAcceptor();
> acceptor80.getFilterChain().addLast("codec",new
> ProtocolCodecFilter(new HttpCodecFactory()));
> acceptor80.setHandler(new MyHttpHandler());
> acceptor80.bind(new InetSocketAddress(80));
>
> The incoming IoBuffers are as follows: (note second buffer has trailing
CrLf)
>
> ===================================
> GET /-1/iv6/gwt/chrome/images/hborder.png HTTP/1.1
> Host: local.zzzzzzzzz.net
> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US;
> rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13
> 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
> Keep-Alive: 115
> Connection: keep-alive
> Referer: http://local.zzzzzzzzz.net/-1/iv6/gwt/chrome/chrome.css
> If-Modified-Since: Fri, 17 Dec 2010 00:01:48 GMT
> Cache-Control: ma
> ===================================
> x-age=0
>
> ===================================
>
> I am seeing a new request decoding state beginning at the second
> buffer, but the request is never completed and sent on to the handler,
> and the browser keeps waiting for a response that never comes.
>
> I added some debug output to HttpHeaderDecodingState and
> HttpRequestDecodingState to see what was happening. The header fields
> are read up to and including "Cache-Control:" but the final header
> value is not completed. See deteils below.
>
> If you can provide any guidance for how to resolve this issue, I would
> be very grateful.
>
>
> INIT REQUEST DECODING STATE
> READING HEADER NAME
> READ HEADER NAME:Host
> READING HEADER VALUE
> HEADER VALUE:local.zzzzzzzzz.net
> READING HEADER NAME
> READ HEADER NAME:User-Agent
> READING HEADER VALUE
> HEADER VALUE:Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US;
> rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13
> READING HEADER NAME
> READ HEADER NAME:Accept
> READING HEADER VALUE
> HEADER VALUE:image/png,image/*;q=0.8,*/*;q=0.5
> READING HEADER NAME
> READ HEADER NAME:Accept-Language
> READING HEADER VALUE
> HEADER VALUE:en-us,en;q=0.5
> READING HEADER NAME
> READ HEADER NAME:Accept-Encoding
> READING HEADER VALUE
> HEADER VALUE:gzip,deflate
> READING HEADER NAME
> READ HEADER NAME:Accept-Charset
> READING HEADER VALUE
> HEADER VALUE:ISO-8859-1,utf-8;q=0.7,*;q=0.7
> READING HEADER NAME
> READ HEADER NAME:Keep-Alive
> READING HEADER VALUE
> HEADER VALUE:115
> READING HEADER NAME
> READ HEADER NAME:Connection
> READING HEADER VALUE
> HEADER VALUE:keep-alive
> READING HEADER NAME
> READ HEADER NAME:Referer
> READING HEADER VALUE
> HEADER VALUE:http://local.zzzzzzzzz.net/-1/iv6/gwt/chrome/chrome.css
> READING HEADER NAME
> READ HEADER NAME:If-Modified-Since
> READING HEADER VALUE
> HEADER VALUE:Fri, 17 Dec 2010 00:01:48 GMT
> READING HEADER NAME
> READ HEADER NAME:Cache-Control
> INIT REQUEST DECODING STATE
>