Community
Participate
Working Groups
Build Identifier: 7.2.2.v20101205 Calling .available() on org.eclipse.jetty.server.HttpInput always returns 0, even when data is available. In out application (eXist-db), we previously used .available() to determine if a request contained any POST data to read, this is unfortunately now broken. I did briefly discuss this with 'gregw' in the Jetty IRC channel on Freenode, the transcript follows - _delirium our project embeds jetty and some functionality now breaks because we called available() on that InputStream to determine if any data had been sent to the server, but now in 7.2.2.v20101205 - available() always seems to return 0, even when data is available should I avoid calls to available() or is this a bug? 10:56 gregw _delirium, let me have a little peek at the code.... 10:56 _delirium my code or the jetty code? 10:57 gregw jetty code.... I have to remember how we implement available and check if we have a test harness that sees a non-zero return from it 10:57 _delirium gregw: okay cool thanks 10:57 gregw I'll be about 15 minutes as I'm just doing something else, but I will have a peek soon and get back to you 10:58 _delirium gregw: sure no worries I will just hangout here 11:16 gregw _delirium, for some reason, the available method is not wired up to the underlying implementation?? 11:16 gregw can you raise a bug and I will fix/test in the next week or so. 11:17 _delirium gregw: a lot of undelying implemetations e.g. just return 0 anyway gregw: do you have a link to the code? 11:17 gregw no - we have an implementation that works 11:17 _delirium gregw: wouldnt mind a quick peek 11:17 gregw in HttpParser 11:17 _delirium ah okay, so this is definetely a bug then? 11:17 gregw HttpParser@available() yes - not sure why the link was dropped we definitely implement available in the parser 11:18 _delirium okay cool will raise a bug - thanks for looking 11:18 gregw so assuming that implementation is OK, it is a simple matter for HttpInput to call it Reproducible: Always Steps to Reproduce: 1. POST some data to Jetty 2. Call .available() on the HttpInput and the result is 0 3.
r2638 wired up to existing implementation and added test harnesses.