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

How does Response.Write make sure that client can receive reponse-bytes immediately without Flush() opt ? #40

Closed
stormgbs opened this issue Jan 21, 2016 · 2 comments
Labels

Comments

@stormgbs
Copy link

As described in the title. How does Response.Write make sure that client can receive reponse-bytes immediately without Flush() opt ?

@stormgbs stormgbs changed the title How does Response.Write make sure that client receive reponse-bytes without Flush() opt ? How does Response.Write make sure that client can receive reponse-bytes immediately without Flush() opt ? Jan 21, 2016
@valyala
Copy link
Owner

valyala commented Jan 21, 2016

There were two options for sending responses with fasthttp until today:

  1. Via fasthttp.Server. The server automatically sends http response after user's code returns from the outer RequestHandler . See Server.serveConn implementation for details.
  2. Via Response.Write call. In this case the caller must call bufio.Writer.Flush in order to make sure the response is sent to the client.

After the commit f8c0d95 yet another approach has been appeared for sending responses - using Response.WriteTo.

@valyala valyala closed this as completed Jan 21, 2016
@stormgbs
Copy link
Author

Thank @valyala , fasthttp is owesome:) . I am writeing a http router(http reverse proxy) based on fasthttp, I modified some fasthttp code, so that I can copy response bytes from lower conn(proxy<-->backend server) to upper-conn(client <--> proxy) directly.

zwirec pushed a commit to zwirec/fasthttp that referenced this issue Jul 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants