DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42573>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42573

           Summary: mod_jk 1.2.23 transfer data corrupted
           Product: Tomcat 5
           Version: 5.0.20
          Platform: PC
        OS/Version: Windows Server 2003
            Status: NEW
          Severity: major
          Priority: P2
         Component: Native:JK
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I have to use a iis6 + jboss4.0.5(tomcat 5.5.20) to serve our web site(both with
jsp and asp). The mod_jk is 1.2.23(isapi_redirect.dll) and the normal html file
looks fine. 
I have some privilege restricted image files that i should send with the
servlet(response.write...) after the privilege check had be done. So, i use the
ServletOutputStream to write image file's byte array to the remote browser. But
i find the image file transfered by the jk oftentimes corrupted(error occurs
about 10%). I test this servlet file download on http connector 8080 and this
kind of data error has never been shown. When the file size is 100K-200K, this
error is more easy to re-produce on my windows machine and the server log
nothing exceptions or errors.

private void writeFileToResponse(FileInputStream fi, HttpServletResponse
response, Attachment af, int filelength)
    throws IOException {
        String ContentType = af.getMime();
        
        int C_BUFSIZE = 1024*32;
        byte[] buf = new byte[C_BUFSIZE];
        
       
response.setContentType((ContentType==null)?"application/octstream":ContentType);
        response.setContentLength(filelength);
        response.setHeader("Content-Disposition", "inline; filename=" + fname );
        ServletOutputStream bout = response.getOutputStream();
        try {
            int i = 0;
            while((i = fi.read(buf)) > 0) {
                // if the user leave, then break the loop
               bout.write(buf, 0, i);
            }
            bout.flush();
        } catch(IOException ioe) {
            //  write to the client error or read file error, but do not log
anything
        }
        finally {
            //bout.close();
        }
        
    }

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to