فهرست منبع

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.
Christoffer Vikström 12 سال پیش
والد
کامیت
2338481bb1
1فایلهای تغییر یافته به همراه1 افزوده شده و 0 حذف شده
  1. 1 0
      server/v2/get_handler.go

+ 1 - 0
server/v2/get_handler.go

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