Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use chunked transfer encoding (default for go 1.15)
Since the event-stream is using a chunked transfer-encoding, we have to calculate the size of the data so that client knows how big the chunk was format for every chunked event: size(in hex)\r\n data\r\n data itself has to be a sever-sent event following the spec (https://html.spec.whatwg.org/multipage/server-sent-events.html#server-sent-events) Whent the stream is done, before closing the connection, we have to end the chunk stream by sending the following data: 0\r\n \r\n Sending a 0 length data with along with an empty line will end the keep-alive event-stream connection. [rfc2616 3.6.1](https://tools.ietf.org/html/rfc2616#section-3.6.1) Context: We have to hijack the connection so that bbs can be shutdown in the case of blocked write (slow consumer). If the connection is not in the hijacked state, ifrit can't terminate the process until the process get io. [Previous story](https://www.pivotaltracker.com/n/projects/1003146/stories/146272021). Refers cloudfoundry/diego-release#552
- Loading branch information