Response streaming does not work
See original GitHub issueThe following code inspired by the documentation does not work. The result is buffered and sent to the client at once.
import cherrypy
import time
class Root:
@cherrypy.expose
def thing(self):
cherrypy.response.headers['Content-Type'] = 'text/plain'
def content():
yield "Hello, "
time.sleep(3)
yield "world"
return content()
thing._cp_config = {'response.stream': True}
print(cherrypy.__version__)
cherrypy.quickstart(Root())
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Issue in Streaming response from backend server to Client - IBM
We have enbaled streaming in this case so that Datapower does not process the response and streams the response to Client.On the MPG...
Read more >Streaming response is not displayed #10506 - GitHub
Describe the Issue I have created a filtered stream on Twitter. I can stream the responses using curl https://api.twitter.com/2/tweets/search/ ...
Read more >"Streaming Server Bad Response" | Switcher Studio Help Center
In rare instances, the "Streaming Server Bad Response" error message could mean there is a problem with the streaming destination. Many platforms provide...
Read more >What to do with errors when streaming the body of an Http ...
One of the following should do it: Close the connection (reset or normal close); Write a malformed chunk (and close the connection) which ......
Read more >Streaming requests and responses | Apigee Edge
By default, HTTP streaming is disabled and HTTP request and response payloads are written to a buffer in memory before they are processed...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In Windows all the clients seem to buffer, so it seems to be a lower level problem in Windows.
Both Firefox and curl on Linux stream the output as expected, regardless of whether the CherryPy server runs on Windows or Linux.
Both Firefox and curl on Windows buffer the output. The output of curl on Windows shows the correct timestamps, but the whole content is displayed at once at the end.
The documentation already says:
Perhaps it is worth adding:
I will run my scripts from Firefox running on Ubuntu on VirtualBox, so I can keep track of the progress without rewriting them. It’s an horrible workaround, but it’s the easiest way for me.
Thanks for your help
I’ve already confirmed that it is working. You may check this with command I posted above.
Here’s handler yielding additional timestamps:
Do you see timestamps? Their difference is 6 seconds. The output to console has stopped for 6 seconds as in handler too. This is my proof.
So look for bottlenecks in your scripts.