-
Bug
-
Resolution: Done
-
Major
-
1.0.0.Final
-
None
-
-
Workaround Exists
-
I'm running WildFly 8 on staging to supply HTTP based API, I implemented javax.servlet.ReadListener, ServletInputStream.read() was used to read data in onDataAvailable() method, our Android client use HttpURLConnection to access API, I found servlet got wrong request parameter name sometimes, in fact, 0x00 was added just at the beginning of HTTP posted data.
I did several testing, I located the issue root to ServletInputStreamImpl.read(byte[] b, int off, int len), I haven't digged much more, so I'm not sure it's xnio issue or not. copied byte may be 0 in this method, since it's not -1, it will be returned by ServletInputStreamImpl.read(), and I accepted it, then issue occur; but it will be ok if ServletInputStream.read(byte[]) is used, since output.write(buf, 0, 0) won't write any byte.
Unit test of io.undertow.servlet.test.streams.ServletInputStreamTestCase.testAsyncServletInputStream() will pass through every time, since HTTPClient is used, but not HttpURLConnection, I added new unit test based on HttpURLConnection, they make difference, issue just occur when HttpURLConnection is used. I captured packets via Wireshark and found one difference: HTTPClient commit HTTP header and post body in one tcp packet, HttpURLConnection commit HTTP header in one tcp packet and post body in another tcp packet.