Clever NPH header handling in CherryPy?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Clever NPH header handling in CherryPy?

Gloria W

Hi, I may be asking for the impossible, but I figured I'd try anyway.
I'm looking for NPH header support in CherryPy, so that, in theory, I
could somehow return a portion of my data at a time, repeatedly passing
the data back to the same session.
I realize this implies some connectivity which CherryPy does not
support.
I also realize I could kludge this by generating my output to a log
file, and using a Perl, PHP, or Javascript NPH header script to refresh
the page contents from the log file.
But being the purist that I am, I'm hoping to use one single tool for
all of HTML header needs.
Is there any clever way to add this functionality to CherryPy, where if
you turn on an NPH parameter for a particluar method, CherryPy can
stream output to a browser indefinitely, placing the responsibility and
management of how and when it runs/ends in the developer's hands?
Thank you in advance,
Gloria


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Clever NPH header handling in CherryPy?

Robert Brewer

Gloria wrote:
> Hi, I may be asking for the impossible, but I figured
> I'd try anyway. I'm looking for NPH header support in
> CherryPy

Pedantic answer: you already have it, for the most part. Set any headers
you want.

> so that, in theory, I could somehow return a portion
> of my data at a time, repeatedly passing the data back
> to the same session. I realize this implies some
> connectivity which CherryPy does not support.

On the contrary, CherryPy supports this in 2 ways:

1) See http://www.cherrypy.org/wiki/ReturnVsYield. This technique can be
used in CherryPy 2 and 3.

2) Starting last week, CherryPy's wsgiserver will use the "chunked"
Transfer-Encoding on the response if:
   a. both the server and client are HTTP/1.1
   b. you don't set any "Content-Length" response header
   c. you set cherrypy.response.stream = True
   d. the response status is one of (200, 203, 206).


Robert Brewer
System Architect
Amor Ministries
[hidden email]

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Clever NPH header handling in CherryPy?

Gloria W

Oh, excellent! This tool is really growing on me.
Thank you,
Gloria


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---