Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-26

ServletInputStream does not override available()

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Major Major
    • 1.0.0.Alpha8
    • None
    • Servlet
    • None

      For AS7-6836, I use Netty's HttpTunnelingServlet to tunnel HornetQ access over HTTP.
      I have a test that passes with JBoss Web and fails with Undertow.

      The netty servlet calls ServletInputStream.available() to check if there are some available bytes to read[1] and create a buffer for them.

      Undertow implementation[2] always return 0, the servlet creates a 0-sized array and reads nothing from the input stream.

      InputStream.available() javadoc states that "This method should be overridden by subclasses".

      So, it's not mandatory but I suspect there are a few servlet implementation that'd rely on having a non-zero value returned by Undertow implementation.

      [1] https://github.com/netty/netty/blob/3/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelingServlet.java#L194
      [2] https://github.com/undertow-io/undertow/blob/master/servlet/src/main/java/io/undertow/servlet/spec/ServletInputStreamImpl.java

              sdouglas1@redhat.com Stuart Douglas (Inactive)
              jmesnil1@redhat.com Jeff Mesnil
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: