tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From E Cunningham <ea...@yahoo.com>
Subject Re: IIS mod_jk2 2.0.4 Bug???
Date Thu, 08 Apr 2004 18:35:28 GMT

Follow-up:
Using stock Tomcat 4.1.30 and a pretty vanilla
DocUpload servlet we have been able to upload
various sized files with out error. But when adding
IIS and the redirector into the mix then we find
that the files get corrupted if the size of the file
is more than 55.1K (as described below).

This is a major bug with JK2 2.0.4.

The upload breaks between 56,462 and 56,562 bytes
(where the 56,462 works and 56,562 fails). 
I've tested with the following sized files (in the
format: archive size/actual size. '*' denotes
breakage):

2,149 bytes 1k
11,184 bytes 10k
21,224 bytes 20k
41,302 bytes 40k
51,340 bytes 50k
56,360 bytes 55k
56,462 bytes 55.1k
56,562 bytes 55.2k *
56,864 bytes 55.5k *
61,380 bytes 60k   *
81,458 bytes 80k   *

Every one of these tests works without the IIS
redirector. This is highly repeatable.

Here is the DocUpload servlet:


import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.Hashtable;

public class Upload extends HttpServlet
{
public void service(ServletRequest request,
ServletResponse response)
        throws IOException
{
	PrintWriter out = null;
	try {
  		int id=0;

		out = response.getWriter();

  		String file = new String("");

      		MultipartParser parser = new
MultipartParser((HttpServletRequest)request, 1024 *
1024);
      		Part aPart;
	    	Hashtable formElements = new Hashtable();
 	    	while( (aPart = parser.readNextPart()) != null
) {
	      		if( aPart.isParam() == true ) {
          			ParamPart pPart = (ParamPart)aPart;
	        		String field = pPart.getName();
          			String value = pPart.getStringValue();
          			if(field != null) {
		        		if(value == null)
			        		value = "";
            				formElements.put(field, value);
		      		}
	      		}
        		else if( aPart.isFile() == true ) {
		      		FilePart fPart = (FilePart)aPart;
          			String field = fPart.getName();
		      		String fileName = fPart.getFileName();
          			if(fileName != null) {
		        		//write the image to a file
		        		String dir = "";  
		        		File theFile = new File(dir, fileName);
					fPart.writeTo(theFile);
		        		formElements.put(field, fileName);
           			}
        		}
      		}
    		out.println("File upload success");
  	} catch (Exception e) {
		out.println("An error occurred.");
		e.printStackTrace(out);
  	}
	out.flush();
}
}





--- E Cunningham <eac26@yahoo.com> wrote:
> 
> We just downloaded the recently released 2.0.4
> mod_jk2
> 
> connector and found a bug. 
> 
> Upload a binary document that is larger than 48K 
> using a servlet that has been well tested for a few
> years against straight Tomcat, mod_jk and previous
> versions of mod_jk2 (v2.0.3) for both IIS and NSAPI.
> 
> Then download using another well tested servlet only
> 
> to find that the document was corrupted.
> 
> Documents are missing 4 bytes at the 48305, 48318,
> or
> 48320 byte marker (varies depending on attempt;
> reproduced with the same file uploaded several
> times.
> 
> We have not verified this yet using stock Tomcat
> (4.1.29) and the stock doc upload servlet. 
> 
> Is there some sort of new configuration that is
> needed
> 
> to accompany this point release of mod_jk2?
> 
> thanks,
> e
> 
> 
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Finance Tax Center - File online. File on
> time.
> http://taxes.yahoo.com/filing.html
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway 
http://promotions.yahoo.com/design_giveaway/

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message