Review Board 1.7.22


ConcatProxyServlet sets the HTTP response status after writing the response

Review Request #3006 - Created Dec. 4, 2011 and submitted

Ryan Baxter
SHINDIG-1667
Reviewers
shindig
brianlil, jcian
shindig
After we return from doFetchConcatResources(..) we set the status in doGet. So lets say we return false from doFetchConcatResources and the content written to the response was bigger than the buffer. This means we will flush the buffer and set the status to the OK status then write the rest of the content and set the status to bad request, but it will be to late we already set the status to OK
Ran unit tests and rendered gadgets in common container
Ship it!
Posted (Dec. 5, 2011, 4:08 p.m.)
LGTM
Posted (Dec. 5, 2011, 7:15 p.m.)
In doFetchConcatResources, if one of the 2nd through nth requests encounters an error such that false would be returned, we still have the content from the 1st up to the failing request in the VerbatimConcatOutputStream, and when we do the close on that stream, it will be written out as well as the the 400 error code.   Seems like the cases where that might occur are probably remote, and having extra data in the response shouldn't matter.  Not sure that it needs to be fixed .. just pointing it out.
  1. Yeah I thought of that too Brian.  I think setting the error code when we return should let be an indication to ignore the content in the response.  Jesse would you agree?
  2. Yup - I saw that too and thought it was odd but that's the way it worked before your changes so I'm fine with leaving it as is.  At least with your changes in place we should get back proper 400 codes consistently even if the previously buffered content is large enough to fill the response buffer.
Ship it!
Posted (Dec. 5, 2011, 7:18 p.m.)
Never seen this one happening but good catch
Posted (Dec. 6, 2011, 2:30 p.m.)
Committed revision 1210933.