tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Herko ter Horst" <herko.ter.ho...@aidministrator.nl>
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 java.io.InputStream.

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

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

Solution:
diff for org.apache.tomcat.service.connector.Ajp13ConnectorRequest.java (<
BUG, > FIXED) from the jakarta-tomcat-3.2.1-src package:
255c255
<         return bodyBuff[pos++];
---
>         return bodyBuff[pos++] & 0xFF;

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


Mime
View raw message