!!! 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
CGI module.
InAsyncoreThreadedAppServerrequestandresponsearebufferedifaresmallerthanconfiguringsize.
\(InCGImoduleisbug,allfilelinesarestoredinlistcgi.FieldStorage.lines,serchanddeletelinescontainingstring"self.lines",4ocurences\)cgi.FieldStoragecontaistwomethodstoaccessupladedfile.form\["userfile"\].value-whichreadallfileintostringform\["userfile"\].fileandform\["userfile"\].filenameform\["userfile"\].filecontainsopenedtmp-filecontaininguploadedfileform\["userfile"\].filenamecontainsfilenamefrombrowser\(seecgi-documentation\)HTTPRequestdestroyvaluefromobjectFieldStorage,andloadallfileintomemory.Ichangethisbehavior.Ifit's a uploaded fileHTTPRequest.field\["userfile"\]returntuple\(stringfilenameandopenedfile\)Example:req=self.request\(\)ifreq.hasField\("userfile"\):iftype\(req.field\("userfile"\)\)==TupleType:filename,file=req.field\("userfile"\)poc=0while1:data=file.read\(1024\)ifnotdata:breakpoc=poc+len\(data\)deldataself.writeln\("Sizeof%sis%dbytes"%\(filename,poc\)\)else:self.writeln\("%sisnotfile"%req.field\("userfile"\)\)
* 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 ).
* 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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
None
!!! 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
CGI module.
* 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 ).
* 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