fix(server): add remote_addr back to Request when using Http::bind
The `Request::remote_addr()` method has been deprecated. Closes #1410
This commit is contained in:
		| @@ -58,13 +58,9 @@ impl<B> Request<B> { | ||||
|     #[inline] | ||||
|     pub fn body_ref(&self) -> Option<&B> { self.body.as_ref() } | ||||
|  | ||||
|     /// The remote socket address of this request | ||||
|     /// | ||||
|     /// This is an `Option`, because some underlying transports may not have | ||||
|     /// a socket address, such as Unix Sockets. | ||||
|     /// | ||||
|     /// This field is not used for outgoing requests. | ||||
|     #[doc(hidden)] | ||||
|     #[inline] | ||||
|     #[deprecated(since="0.11.12", note="This method will be gone in future versions.")] | ||||
|     pub fn remote_addr(&self) -> Option<SocketAddr> { self.remote_addr } | ||||
|  | ||||
|     /// The target path of this Request. | ||||
| @@ -196,6 +192,10 @@ pub fn split<B>(req: Request<B>) -> (RequestHead, Option<B>) { | ||||
|     (head, req.body) | ||||
| } | ||||
|  | ||||
| pub fn addr<B>(req: &mut Request<B>, addr: SocketAddr) { | ||||
|     req.remote_addr = Some(addr); | ||||
| } | ||||
|  | ||||
| #[cfg(test)] | ||||
| mod tests { | ||||
|     /* | ||||
|   | ||||
		Reference in New Issue
	
	Block a user