tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Herko ter Horst" <>
Subject Apache/Tomcat multipart/form-data uploads using Ajp13: solution.
Date Mon, 12 Feb 2001 14:14:12 GMT
Various people have reported problems with uploading (binary) data to
systems with Apache and Tomcat 3.x, using the AJP 1.3 protocol. We believe
we have solved this problem in Tomcat 3.2.1, using the fix below.

Problem description:
Binary data (files) of any size could not successfully be uploaded using
Apache and Tomcat with AJP 1.3. The reason for this is a bug in the doRead()
method of Ajp13ConnectorRequest, which causes the doRead(byte[] b, int off,
int len) in that same class to prematurely end processing (outputting a 'Y'
character on stdout). The bug is in the conversion of the value read from
the bodyBuff byte-array, to an integer result. Bytes can have values
from -128 to 127, while the result is expected to be a positive integer (in
the range 0 to 255). A result of -1 is interpreted in the doRead(byte[] b,
int off, int len) method as an error/end of input.

Solution description:
The solution is to make sure that the integer return value is a correctly
transformed byte-value. We have implemented this analogous to the method
used in

Solves the following bugs:
    397 (probably)
    (possibly others as well)

Solves problems discussed in the following threads:
    multipart requests and file uploads problems on the Apache connection
    mod_jk and AJP13 protocol
    (and others)

diff for (<
BUG, > FIXED) from the jakarta-tomcat-3.2.1-src package:
<         return bodyBuff[pos++];
>         return bodyBuff[pos++] & 0xFF;

herko ter horst
aidministrator nederland bv  -
prinses julianaplein 14-b, 3817 cs amersfoort, the netherlands
tel. +31-(0)33-4659987   fax. +31-(0)33-4659987

View raw message