mirror of
				https://github.com/aler9/gortsplib
				synced 2025-11-01 02:52:36 +08:00 
			
		
		
		
	serverconn: allow passing of raw base.Response.Body from Describe callbacks
When a server handler implements `OnDescribe()` it may return a `base.Reponse` that carries a body, along with a `nil` stream. `handleRequest()` should support that, and not override `res.Body`, and, more importantly, not dereference the returned `nil` pointer.
This commit is contained in:
		 Daniel Mack
					Daniel Mack
				
			
				
					committed by
					
						 Alessandro Ros
						Alessandro Ros
					
				
			
			
				
	
			
			
			 Alessandro Ros
						Alessandro Ros
					
				
			
						parent
						
							dae5a1f040
						
					
				
				
					commit
					23458a27b6
				
			| @@ -357,8 +357,11 @@ func (sc *ServerConn) handleRequest(req *base.Request) (*base.Response, error) { | |||||||
|  |  | ||||||
| 				res.Header["Content-Base"] = base.HeaderValue{req.URL.String() + "/"} | 				res.Header["Content-Base"] = base.HeaderValue{req.URL.String() + "/"} | ||||||
| 				res.Header["Content-Type"] = base.HeaderValue{"application/sdp"} | 				res.Header["Content-Type"] = base.HeaderValue{"application/sdp"} | ||||||
|  |  | ||||||
|  | 				if stream != nil { | ||||||
| 					res.Body = stream.Tracks().Write() | 					res.Body = stream.Tracks().Write() | ||||||
| 				} | 				} | ||||||
|  | 			} | ||||||
|  |  | ||||||
| 			return res, err | 			return res, err | ||||||
| 		} | 		} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user