Bug 236578

Summary: filter output is corrupted
Product: Red Hat Enterprise Linux 4 Reporter: Martin Poole <mpoole>
Component: mod_pythonAssignee: Joe Orton <jorton>
Status: CLOSED DUPLICATE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 4.4   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-04-16 15:43:57 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
mod_python-3.1.3-buflen.patch buffer read fixes none

Description Martin Poole 2007-04-16 15:27:28 UTC
Description of problem:

---Problem Description---
On RHEL4U4 mod_python 3.1.3 is included. When passing large files through a
python script these files get corrupted. When building and installing mod_python
3.2.8 from EL5 the problem is fixed and the files are passed through correctly.
This URL http://issue s.apache.org/bugzilla/show_bug.cgi?id=41468 is about the
same issue but filed wrongly for httpd itself.


Contact Information = Tim Verhoeven/tim.verhoeven.com

---uname output---
Linux wegdaap40 2.6.9-42.EL #1 Wed Jul 12 23:15:20 EDT 2006 x86_64 x86_64 x86_64
GNU/Linux

Machine Type = VMWare ESX 3.0 guest

---Debugger---
A debugger is not configured

Version-Release number of selected component (if applicable):

mod_python-3.1.3-5.1

How reproducible:

always

Steps to Reproduce:

1. Install the following filter under DocumentRoot

import time
from mod_python import apache

def outputfilter(filter):


   # extract important info
   request = filter.req
   connection = request.connection
   (address,port) = connection.remote_addr

   # if requesting this file, don't return it
   if request.the_request.find("watcher.py") != -1:
       filter.close()
       return

   # pass-through filter
   s = filter.read()
   while s:
       filter.write(s)
       s = filter.read()
   if s is None:
       filter.close()

2. Add the following statements to the directory section containing the file in
the httpd config to enable python parsing :
           AddHandler mod_python .py
           PythonOutputFilter watcher WATCHER
           AddOutputFilter WATCHER ks.cfg
           AddOutputFilter WATCHER .rpm
           AddOutputFilter WATCHER .xml
           AddOutputFilter WATCHER .py

3. Put a small and large file ending in .rpm of .xml in the same dir and
retrieve the file using mozilla, wget, ...

  additional. The file only needs to be >8192 bytes

4. When using mod_python 3.1.3 the file is corrupted at the end with 3.2.8 not.
  
Actual results:

Corrupted file

Expected results:

clean file.

Additional info:

backported two lines of fix from the 3.2.8 version included with RHEL5, patch
attached.

Comment 1 Martin Poole 2007-04-16 15:27:35 UTC
Created attachment 152700 [details]
mod_python-3.1.3-buflen.patch buffer read fixes

Comment 2 Joe Orton 2007-04-16 15:43:57 UTC

*** This bug has been marked as a duplicate of 231065 ***