On 15 November 2010 12:37, Carl Nobile <carl.nob...@gmail.com> wrote: > This is really a WSGI question which is explained in the PEP 0333 spec below. > > http://www.python.org/dev/peps/pep-0333/ > > What you want to do uses the HTTP chunk response.
Technically it is wrong to refer to it as chunked response as WSGI specification doesn't deal with issue of chunked responses in as much as that term is used in HTTP. Anyway, the short of it is that you should simply not set a Content-Length response header. Rather than return an array of strings, you would use yield to return successive blocks of data for the response. Alternatively, you write a custom iterable with appropriate next() method for returning next block of data. In other words, use a generator like object. You can find a lot of articles on WSGI referenced from: http://www.wsgi.org/wsgi/Learn_WSGI Graham > The spec shows how to write an iterator that creates a list that would > be sent out. > > ~Carl > > On Sun, Nov 14, 2010 at 8:29 PM, Gelonida <gelon...@gmail.com> wrote: >> Hi, >> >> I'd like to write an application, which generates https output of an >> unkown length >> >> It will basically be a python function >> yielding a number of strings. >> >> >> What do I have to return as Content-Length ??? >> >> 0, >> -1, >> not send the Content-Length Header? >> >> something else? >> >> >> Currently I have a wrapper function collecting the strings, calculation >> their size and returning a list of all entries. >> >> Is ths really the only solution? >> >> >> thanks in advance for suggestions / ideas >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "modwsgi" group. >> To post to this group, send email to modw...@googlegroups.com. >> To unsubscribe from this group, send email to >> modwsgi+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/modwsgi?hl=en. >> >> > > > > -- > ------------------------------------------------------------------------------- > Carl J. Nobile (Software Engineer) > carl.nob...@gmail.com > ------------------------------------------------------------------------------- > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To post to this group, send email to modw...@googlegroups.com. > To unsubscribe from this group, send email to > modwsgi+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/modwsgi?hl=en. > > -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To post to this group, send email to modw...@googlegroups.com. To unsubscribe from this group, send email to modwsgi+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.