@@ -70,7 +70,7 @@ use std::{
7070 } ,
7171} ;
7272
73- use :: http:: Extensions ;
73+ use :: http:: { Extensions , HeaderValue } ;
7474
7575#[ cfg( feature = "tokio" ) ]
7676pub use self :: http:: { HttpConnector , HttpInfo } ;
@@ -101,6 +101,7 @@ pub trait Connection {
101101pub struct Connected {
102102 pub ( super ) alpn : Alpn ,
103103 pub ( super ) is_proxied : bool ,
104+ pub ( crate ) proxy_basic_auth : Option < HeaderValue > ,
104105 pub ( super ) extra : Option < Extra > ,
105106 pub ( super ) poisoned : PoisonPill ,
106107}
@@ -151,6 +152,7 @@ impl Connected {
151152 Connected {
152153 alpn : Alpn :: None ,
153154 is_proxied : false ,
155+ proxy_basic_auth : None ,
154156 extra : None ,
155157 poisoned : PoisonPill :: healthy ( ) ,
156158 }
@@ -184,6 +186,17 @@ impl Connected {
184186 self . is_proxied
185187 }
186188
189+ /// Set the Proxy-Authorization header value for HTTP Proxy authentication.
190+ pub fn proxy_basic_auth ( mut self , auth : HeaderValue ) -> Connected {
191+ self . proxy_basic_auth = Some ( auth) ;
192+ self
193+ }
194+
195+ /// Get the Proxy-Authorization header value for HTTP Proxy authentication.
196+ pub fn get_proxy_basic_auth ( & self ) -> Option < & HeaderValue > {
197+ self . proxy_basic_auth . as_ref ( )
198+ }
199+
187200 /// Set extra connection information to be set in the extensions of every `Response`.
188201 pub fn extra < T : Clone + Send + Sync + ' static > ( mut self , extra : T ) -> Connected {
189202 if let Some ( prev) = self . extra {
@@ -228,6 +241,7 @@ impl Connected {
228241 Connected {
229242 alpn : self . alpn ,
230243 is_proxied : self . is_proxied ,
244+ proxy_basic_auth : self . proxy_basic_auth . clone ( ) ,
231245 extra : self . extra . clone ( ) ,
232246 poisoned : self . poisoned . clone ( ) ,
233247 }
0 commit comments