!!! Before You apply patch, You need apply my patches
101932 Webware as python module
102188 Basic security for mod_python
* support for large request added ( file upload )
Transaction si now created from dictionary, which has added 'input' and
'output' keys. ( For output see response )
Values of that keys are files ( file, StringIO ... ).
AppServer now does not read all input from browser into memory ( string
), but simply put opened file into Application and in Application into
In AsyncoreThreadedAppServer request and response are buffered if are
smaller than configuring size.
\( In CGI module is bug, all file lines are stored in list
cgi.FieldStorage.lines, serch and delete lines containing string
&quot;self.lines&quot;, 4 ocurences \)
cgi.FieldStorage contais two methods to access upladed file.
form\[&quot;userfile&quot;\].value - which read all file into string
form\[&quot;userfile&quot;\].file and form\[&quot;userfile&quot;\].filename
form\[&quot;userfile&quot;\].file contains opened tmp-file
containing uploaded file
form\[&quot;userfile&quot;\].filename contains filename from
browser \( see cgi-documentation \)
HTTPRequest destroy value from object FieldStorage, and load all file
into memory. I change this behavior. If it's a uploaded file
HTTPRequest.field\[&quot;userfile&quot;\] return tuple \( string filename and opened
req = self.request\(\)
if not data: break
self.writeln\(&quot;Size of %s is %d bytes&quot; % \(
filename, poc \)\)
self.writeln\(&quot;%s is not file&quot; %req.field\(&quot;userfile&quot;\)\)
* support for large response added ( generate file from database and sent
it directly to browser )
In HTTPResponse I change behavior of method deliver. When this method
is called all texts buffered into memory are send to browser. But
response can continue to generating more output. When I want sent large
bundle of data, I call transaction deliver method ( which is the same
as Response.deliver ).
If deliver is called, HTTP-header is send to browse, this mean that
Error messeges cannot overwrite output. Traceback is simple append to
previusly send content of that page. \( Constructor of Transaction must
be changed \).
Output of respond is send to file, which respond gets from transaction,
when transation is created from dictionary \( output \).
file=open\('/dev/hda','r'\) \# some data
for i in range\(1000\):
if not data: return
* protokol on which Adapter communication with AppServer is changed from marshal
to cPickle ( I need this for implementing buffer in AsyncThreadedServer)
* I add argument pidfile main methon of AsyncThreadedAppServer and
ThreadedAppServer. Pid of main-process is write to file $pidfile. This
is needed by running AppServer as demon on Unix.
* some security is added to Examples/Colorize.py