[Chicago] help from Django and Pylons developers

Massimo Di Pierro mdipierro at cs.depaul.edu
Mon Apr 28 21:55:15 CEST 2008


Sorry the web2py way is better. Here is the complete code

#in applications/security/controller/default.py
class Jammer():
   def read(self,n):  return 'x'*n
def jam():  return response.stream(Jammer())

in #routes.py
routes_in=(('.*(php|PHP|asp|ASP|jsp|JSP)','/security/default/jam'),)

and it does not matter which web server you use.

Massimo


On Apr 28, 2008, at 2:48 PM, Cosmin Stejerean wrote:

>>> Django - the 'recommended' way to deal with files is to not have  
>>> django
>> service
>>> the request, but let apache or whatever web server handle those  
>>> URLs.
>> This is
>>> good, because python seems to be a poor choice for moving 'large'  
>>> amounts
>> of
>>> data 'like this.'
>>>
>>
>>  The problem is that sometime you need to perform authentication  
>> of a large
>> file (for example a video stream) and you cannot rely on apache. Some
>> problem if the file you want to serve is actually generated. For  
>> example if
>> you scan my machine for .php files you get an infinite file being  
>> streamed
>> to you. I would not know how to do that with Django. Perhaps it is  
>> possible.
>>
>>
>
> One option for streaming really large files that require
> authentication is to create a symlink to the file with a random name
> in a folder serviced by Apache (or nginex) and have it serve the file
> (I can also think of creative ways to abuse basic auth).
>
> --
> Cosmin Stejerean
> http://blog.offbytwo.com
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> http://mail.python.org/mailman/listinfo/chicago



More information about the Chicago mailing list