| 
					
				 | 
			
			
				@@ -78,6 +78,19 @@ class Curl 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public function setStream($callback)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        curl_setopt($this->handle, CURLOPT_BUFFERSIZE, 16384);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 检查是否断联,每10秒发送一次心跳
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        curl_setopt($this->handle,CURLOPT_TCP_KEEPALIVE,1);   // 开启
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        curl_setopt($this->handle,CURLOPT_TCP_KEEPIDLE,10);   // 空闲10秒问一次
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        curl_setopt($this->handle,CURLOPT_TCP_KEEPINTVL,10);  // 每10秒问一次
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        curl_setopt($this->handle, CURLOPT_WRITEFUNCTION, function ($ch, $data) use ($callback) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            call_user_func($callback, $data);            
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return strlen($data);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        });
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return $this;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public function setRequest($type)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if ($type == 'post' || $type == 'file') {
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -197,6 +210,9 @@ class Curl 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Dever::log($debug, 'curl');
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Dever::debug($debug, 'curl');
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (isset($setting['stream'])) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                exit;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return $result;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } catch (\Exception $e) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             curl_close($this->handle);
 
			 |