Bug 51436

Summary: ServletRequestListener fails to access request parameters when an Expect-Header is sent
Product: Tomcat 7 Reporter: Simon Olofsson <simon>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Severity: normal    
Priority: P2    
Version: trunk   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Attachments: Acknowledge a request before any listeners are called.

Description Simon Olofsson 2011-06-27 09:56:45 UTC
Created attachment 27209 [details]
Acknowledge a request before any listeners are called.

I wrote a ServletRequestListener that tries to access a Request Parameter in requestInitialized(.) with:

This works fine with POST-Requests. But when I send the "Expect: 100-continue" HTTP Header the Listener hangs, waiting for the Request Body. See the stacktrace at:
This happens because the Request isn't acknowledged and thus the body (containing the parameters) isn't send.

The attached patch fixes this by acknowledging the request before the listeners are called. With the patch applied everything works fine and all tests pass.
Comment 1 Mark Thomas 2011-06-28 17:49:50 UTC
Thanks for the patch. I applied a variation of it (with a little more error handling) to 7.0.x and it will be included in 7.0.17 onwards.
Comment 2 Simon Olofsson 2011-06-29 11:57:44 UTC
Great, thanks Mark.