Bug 51436 - ServletRequestListener fails to access request parameters when an Expect-Header is sent
Summary: ServletRequestListener fails to access request parameters when an Expect-Head...
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Catalina (show other bugs)
Version: trunk
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-27 09:56 UTC by Simon Olofsson
Modified: 2019-12-05 16:33 UTC (History)
0 users



Attachments
Acknowledge a request before any listeners are called. (1.81 KB, patch)
2011-06-27 09:56 UTC, Simon Olofsson
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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:
 sre.getServletRequest().getParameter("x");

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:
 http://pastebin.com/r2J0P3qx
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.