Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http server arbitrarily finishes requests #580

Closed
hoisie opened this issue Feb 2, 2010 · 4 comments
Closed

http server arbitrarily finishes requests #580

hoisie opened this issue Feb 2, 2010 · 4 comments

Comments

@hoisie
Copy link
Contributor

hoisie commented Feb 2, 2010

What steps will reproduce the problem?
1. Run this code, which tries to keep a connection open to send data:
http://pastie.org/805167

What is the expected output? What do you see instead?
The expected output is 1..10. Instead, finishRequest is called and nothing 
gets sent to the client. 

What is your $GOOS?  $GOARCH?
linux/amd64

Which revision are you using?  (hg identify)
47bb38c01374+ tip

Please provide any additional information below.
The http server should never finish a request unless finishRequest is 
explicitly called by the user. This makes it impossible to write real-time 
web apps with go.
@rsc
Copy link
Contributor

rsc commented Feb 2, 2010

Comment 1:

I can't make sense of what you're trying to do.  The web server assumes, quite 
reasonably, that when the handler returns, the request is done being handled.  HTTP 
is a synchronous protocol, one request at a time on the wire; there's no other 
possible implementation.
If there are multiple connections then there will be multiple handlers executing in 
parallel and they can do whatever "real time web apps" need to do. 
Leaving open because the documentation should be clearer about the fact that the 
handler returning signals that the request is done.

Labels changed: added documentation.

Owner changed to r...@golang.org.

Status changed to Accepted.

@gopherbot
Copy link
Contributor

Comment 2 by jesse.dailey:

The real test should be whether, if the Handler doesn't return and doesn't call 
.Close(), but calls Conn.Flush() periodically, does the http.Response return from 
http.Get() immediately after the first flush, and then does Body.Read() keep reading 
all the data (not just data from the first flush).

@rsc
Copy link
Contributor

rsc commented Feb 5, 2010

Comment 3:

@jesse.dailey: yes that works fine, but it's considered bad practice in today's web 
applications.

@rsc
Copy link
Contributor

rsc commented Feb 12, 2010

Comment 4:

This issue was closed by revision 58d5d6f.

Status changed to Fixed.

Merged into issue #-.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc removed their assignment Jun 22, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants