Hello, Axis developers,

I found bugs in
org.apache.axis.transport.http.ChunkedOutputStream
and
org.apache.axis.transport.http.ChunkedInputStream
I fixed the bugs and tested with Coyote HTTP/1.1 server in Tomcat.
Would you fix Axis source tree?

----------
[ChunkedInputStream]
Line.85 (source code in Axis1.0)
>>wrong>>        return rc > 0 ? d[0] : rc;
<<right<<        return rc > 0 ? (d[0] & 0xFF) : rc;

InputStream.read() method should return positive int in the range from 0 to
225.
But, byte is cast to int in the range from -128 to 127.
This has no problem for ASCII code, but it has some problems for UTF8, GZIP
and so on.

----------
[ChunkedOutputStream]
Line.116 (source code in Axis1.0)
>>wrong>>        out.write("\r\n0\r\n".getBytes());
<<right<<        out.write("0\r\n\r\n".getBytes());

According to HTTP/1.1: section 3.6.1 Chunked Transfer Coding[1],
       Chunked-Body   = *chunk last-chunk trailer CRLF
       chunk          = chunk-size [ chunk-extension ] CRLF chunk-data CRLF
       last-chunk     = 1*("0") [ chunk-extension ] CRLF

chunk part is implemented in write(byte[] b, int off, int len) method,
last-chunk part is implemented in eos() method.
eos() should write not "CRLF 0 CRLF" but "0 CRLF CRLF".
Note that this code assumes no trailer or chunk-extension.

References:
[1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6.1

Thanks in advance,
Toshiro TAKASE
Internet Technology, Tokyo Research Laboratory, IBM Research
notes ID: Toshiro Takase/Japan/[EMAIL PROTECTED], e-mail: [EMAIL PROTECTED]





Reply via email to