Browse Source

server: Flush headers when using wait=true and stream=true

Many http clients will missbehave unless they get an initial http-
response, even when long-polling. It also saves the user/client from
having to handle headers on the first action of the watch, but rather
handle the response immediately.

Original commit: 2338481bb1d5ab3af95188d21db70512b03ccf38
From: Christoffer Vikström
Yicheng Qin 11 years ago
parent
commit
e587402c26
1 changed files with 1 additions and 0 deletions
  1. 1 0
      etcd/v2_http_get.go

+ 1 - 0
etcd/v2_http_get.go

@@ -59,6 +59,7 @@ func (p *participant) handleWatch(key string, recursive, stream bool, waitIndex
 	closeChan := cn.CloseNotify()
 
 	p.writeHeaders(w)
+	w.(http.Flusher).Flush()
 
 	if stream {
 		// watcher hub will not help to remove stream watcher