Re: State of X-Sendfile support?

2011-03-28 Thread Gabriel Hurley
FWIW, I vaguely recall how the last thread on X-sendfile and the files API got conflated (derailed?) and as far as I understood it then and as far as I understand it now, they're related only because some backends (which we currently don't directly support) are difficult to work with without suc

Re: State of X-Sendfile support?

2011-03-28 Thread Jacob Kaplan-Moss
On Mon, Mar 28, 2011 at 1:13 PM, Waldemar Kornewald wrote: > That's a good goal and as long as you only focus on file downloads > it's possible to reuse the middlewares setting. However, if you ever > want to provide an abstract file uploads API we're back to the same > problem. I'm trying to tal

Re: State of X-Sendfile support?

2011-03-28 Thread Waldemar Kornewald
On Mon, Mar 28, 2011 at 6:40 PM, Jacob Kaplan-Moss wrote: > On Mon, Mar 28, 2011 at 11:22 AM, Waldemar Kornewald > wrote: >> I do agree that it's too complicated (esp., the forms) and I plan to >> improve django-filetransfers in this regard. The biggest complexity >> comes largely from file uploa

Re: State of X-Sendfile support?

2011-03-28 Thread Christophe Pettus
On Mar 28, 2011, at 9:40 AM, Jacob Kaplan-Moss wrote: > If I've got that wrong, you need to explain to me (and > anyone else) why uploads and downloads belong together in the same > patch and why a simple "just support X-Sendfile and friends" patch > can't possibly work. +1. It's entirely possi

Re: State of X-Sendfile support?

2011-03-28 Thread Jacob Kaplan-Moss
On Mon, Mar 28, 2011 at 11:22 AM, Waldemar Kornewald wrote: > I do agree that it's too complicated (esp., the forms) and I plan to > improve django-filetransfers in this regard. The biggest complexity > comes largely from file upload handling (which I understand isn't a > problem you're trying to

Re: State of X-Sendfile support?

2011-03-28 Thread Waldemar Kornewald
On Mon, Mar 28, 2011 at 5:05 PM, Jacob Kaplan-Moss wrote: > On Sat, Mar 26, 2011 at 8:45 AM, Waldemar Kornewald > wrote: >> That's pretty much exactly what django-filetransfers tries to do on >> the download side: >> http://www.allbuttonspressed.com/projects/django-filetransfers >> Hotever it's n

Re: State of X-Sendfile support?

2011-03-28 Thread Jacob Kaplan-Moss
On Sat, Mar 26, 2011 at 8:45 AM, Waldemar Kornewald wrote: > That's pretty much exactly what django-filetransfers tries to do on > the download side: > http://www.allbuttonspressed.com/projects/django-filetransfers > Hotever it's not only for X-Sendfile, but also for any other file > serving mecha

Re: State of X-Sendfile support?

2011-03-28 Thread Graham Dumpleton
On Monday, March 28, 2011 9:15:45 PM UTC+11, Gustavo Narea wrote: > > On 26/03/11 11:31, Graham Dumpleton wrote: > > > > Yes and no as nginx also has a X-Sendfile module, again possibly > > optional (can't remember). > > I didn't know there was an X-Sendfile module for Nginx -- Search results > f

Re: State of X-Sendfile support?

2011-03-28 Thread Gustavo Narea
On 26/03/11 11:31, Graham Dumpleton wrote: > > Yes and no as nginx also has a X-Sendfile module, again possibly > optional (can't remember). I didn't know there was an X-Sendfile module for Nginx -- Search results for "nginx xsendfile" point me to X-Accel-Redirect. > In Apache/mod_wsgi when usin

Re: State of X-Sendfile support?

2011-03-26 Thread Waldemar Kornewald
On Sat, Mar 26, 2011 at 2:08 PM, Jacob Kaplan-Moss wrote: > On Sat, Mar 26, 2011 at 6:31 AM, Graham Dumpleton > wrote: >> In short, it is all a mess and trying to provide support for it in one bit >> of code is possibly asking a bit much. > > One possible solution would be to split the problem up

Re: State of X-Sendfile support?

2011-03-26 Thread Jacob Kaplan-Moss
On Sat, Mar 26, 2011 at 6:31 AM, Graham Dumpleton wrote: > In short, it is all a mess and trying to provide support for it in one bit > of code is possibly asking a bit much. One possible solution would be to split the problem up a bit. Django could provide an HttpFileResponse object. This would

Re: State of X-Sendfile support?

2011-03-26 Thread Graham Dumpleton
On Saturday, March 26, 2011 9:15:48 PM UTC+11, Gustavo Narea wrote: > > On 26/03/11 00:17, Graham Dumpleton wrote: > > Why guess in the first place? Apache and Nginx both support 'X-Sendfile: >> ' don't they? (older nginx seemed to only support their >> own syntax, though). >> > Apache require

Re: State of X-Sendfile support?

2011-03-26 Thread Gustavo Narea
On 26/03/11 00:17, Graham Dumpleton wrote: > > Why guess in the first place? Apache and Nginx both support > 'X-Sendfile: > ' don't they? (older nginx seemed to only support their > own syntax, though). > > Apache requires a separate module to be installed which isn't part of > the

Re: State of X-Sendfile support?

2011-03-26 Thread Gustavo Narea
On 25/03/11 14:50, Thomas Guettler wrote: > Maybe you are right. Guessing is bad. But I think to write "nginx" into > the application code is bad, too. Something like this could be in settings.py. I think you're diverging: My point is simply to illustrate how to use wsgi-xsendfile. You wouldn't ha

Re: State of X-Sendfile support?

2011-03-25 Thread Graham Dumpleton
On Friday, March 25, 2011 11:43:39 PM UTC+11, Pascal Germroth wrote: > > On Fri, 2011-03-25 at 12:55 +0100, Łukasz Rekucki wrote: > > On 25 March 2011 12:34, Thomas Guettler wrote: > > > I look at your example code. You need to name the webserver in the > > > code. That's not very nice. I guess

Re: State of X-Sendfile support?

2011-03-25 Thread Thomas Guettler
On 25.03.2011 12:55, Łukasz Rekucki wrote: > On 25 March 2011 12:34, Thomas Guettler wrote: >> Hi, >> >> I look at your example code. You need to name the webserver in the >> code. That's not very nice. I guess it should be possible to >> guess the webserver (apache vs nginx) by looking at reques

Re: State of X-Sendfile support?

2011-03-25 Thread Pascal Germroth
On Fri, 2011-03-25 at 12:55 +0100, Łukasz Rekucki wrote: > On 25 March 2011 12:34, Thomas Guettler wrote: > > I look at your example code. You need to name the webserver in the > > code. That's not very nice. I guess it should be possible to > > guess the webserver (apache vs nginx) by looking at

Re: State of X-Sendfile support?

2011-03-25 Thread Łukasz Rekucki
On 25 March 2011 12:34, Thomas Guettler wrote: > Hi, > > I look at your example code. You need to name the webserver in the > code. That's not very nice. I guess it should be possible to > guess the webserver (apache vs nginx) by looking at request.META. > -1 on guessing anything, especially some

Re: State of X-Sendfile support?

2011-03-25 Thread Thomas Guettler
Hi, I look at your example code. You need to name the webserver in the code. That's not very nice. I guess it should be possible to guess the webserver (apache vs nginx) by looking at request.META. Documentation would be nice Thomas On 25.03.2011 10:23, Gustavo Narea wrote: > Hi all, > >

Re: State of X-Sendfile support?

2011-03-25 Thread Gustavo Narea
Hi all, Just to let you know that there's an X-Sendfile implementation for WSGI apps (inc. Django), which also works with Nginx: https://launchpad.net/wsgi-xsendfile You can use it in Django views via twod.wsgi. For example: """ from twod.wsgi import call_wsgi_app from xsendfile import NginxSend

Re: State of X-Sendfile support?

2011-03-24 Thread Waldemar Kornewald
On Thursday, March 24, 2011 2:40:39 PM UTC+1, Kristaps Kūlis wrote: > > I wish to note that Nginx implements this feature differently than > LigHTTPd and Apache2 > http://wiki.nginx.org/XSendfile , > > Should django implementation consider that ? > > My proposal to implement would be: > 1. HttpFil

Re: State of X-Sendfile support?

2011-03-24 Thread Russell Keith-Magee
On Thu, Mar 24, 2011 at 9:40 PM, Kristaps Kūlis wrote: > I wish to note that Nginx implements this feature differently than > LigHTTPd and Apache2 > http://wiki.nginx.org/XSendfile , > > Should django implementation consider that ? > > My proposal to implement would be: >  1. HttpFileResponse whic

Re: State of X-Sendfile support?

2011-03-24 Thread David De La Harpe Golden
On 24/03/11 13:40, Kristaps Kūlis wrote: > I wish to note that Nginx implements this feature differently than > LigHTTPd and Apache2 > http://wiki.nginx.org/XSendfile , > > Should django implementation consider that ? > I'd also note that wsgi itself apparently has an api abstraction wsgi.file_w

Re: State of X-Sendfile support?

2011-03-24 Thread Kristaps Kūlis
I wish to note that Nginx implements this feature differently than LigHTTPd and Apache2 http://wiki.nginx.org/XSendfile , Should django implementation consider that ? My proposal to implement would be: 1. HttpFileResponse which takes file location (relative to MEDIA_URL ?) 2. HttpFileResponse c

Re: State of X-Sendfile support?

2011-03-24 Thread Russell Keith-Magee
On Wed, Mar 23, 2011 at 5:20 AM, Paul McMillan wrote: > It's worth pointing out that manage.py runserver isn't likely to ever > support serving those files even if the header arrives in core. It's > explicitly not appropriate for any kind of production use, fallback or > otherwise. If you really n

Re: State of X-Sendfile support?

2011-03-22 Thread Paul McMillan
It's worth pointing out that manage.py runserver isn't likely to ever support serving those files even if the header arrives in core. It's explicitly not appropriate for any kind of production use, fallback or otherwise. If you really need support for your development work (and checking the headers

Re: State of X-Sendfile support?

2011-03-19 Thread Russell Keith-Magee
On Sunday, March 20, 2011, Pascal Germroth wrote: > Hi, > > I want to use X-Sendfile to serve some medium-sized files. There > doesn't seem to be built-in support for this, although the soc2009/ > http-wsgi-improvements branch looks like somebody attempted to > implement HttpResponseSendFile (alth

State of X-Sendfile support?

2011-03-19 Thread Pascal Germroth
Hi, I want to use X-Sendfile to serve some medium-sized files. There doesn't seem to be built-in support for this, although the soc2009/ http-wsgi-improvements branch looks like somebody attempted to implement HttpResponseSendFile (although it seems to use the slow path). Building a proper respon