diff --git a/curl-sys/lib.rs b/curl-sys/lib.rs index f71d99aa5..17b3de0a5 100644 --- a/curl-sys/lib.rs +++ b/curl-sys/lib.rs @@ -588,6 +588,7 @@ pub const CURLOPT_SSL_OPTIONS: CURLoption = CURLOPTTYPE_LONG + 216; // pub const CURLOPT_DNS_LOCAL_IP6: CURLoption = CURLOPTTYPE_OBJECTPOINT + 223; // pub const CURLOPT_LOGIN_OPTIONS: CURLoption = CURLOPTTYPE_OBJECTPOINT + 224; pub const CURLOPT_EXPECT_100_TIMEOUT_MS: CURLoption = CURLOPTTYPE_LONG + 227; +pub const CURLOPT_PROXYHEADER: CURLoption = CURLOPTTYPE_OBJECTPOINT + 228; pub const CURLOPT_PINNEDPUBLICKEY: CURLoption = CURLOPTTYPE_OBJECTPOINT + 230; pub const CURLOPT_UNIX_SOCKET_PATH: CURLoption = CURLOPTTYPE_OBJECTPOINT + 231; pub const CURLOPT_PATH_AS_IS: CURLoption = CURLOPTTYPE_LONG + 234; diff --git a/src/easy/handle.rs b/src/easy/handle.rs index 6d074be1f..90e85474e 100644 --- a/src/easy/handle.rs +++ b/src/easy/handle.rs @@ -846,6 +846,11 @@ impl Easy { self.inner.http_headers(list) } + /// Same as [`Easy2::proxy_headers`](struct.Easy2.html#method.proxy_headers) + pub fn proxy_headers(&mut self, list: List) -> Result<(), Error> { + self.inner.proxy_headers(list) + } + /// Same as [`Easy2::cookie`](struct.Easy2.html#method.cookie) pub fn cookie(&mut self, cookie: &str) -> Result<(), Error> { self.inner.cookie(cookie) diff --git a/src/easy/handler.rs b/src/easy/handler.rs index 66185cc55..be25d6928 100644 --- a/src/easy/handler.rs +++ b/src/easy/handler.rs @@ -384,6 +384,7 @@ struct Inner { header_list: Option, resolve_list: Option, connect_to_list: Option, + proxy_header_list: Option, form: Option
, error_buf: RefCell>, handler: H, @@ -594,6 +595,7 @@ impl Easy2 { header_list: None, resolve_list: None, connect_to_list: None, + proxy_header_list: None, form: None, error_buf: RefCell::new(vec![0; curl_sys::CURL_ERROR_SIZE]), handler, @@ -1593,15 +1595,17 @@ impl Easy2 { self.setopt_ptr(curl_sys::CURLOPT_HTTPHEADER, ptr as *const _) } - // /// Add some headers to send to the HTTP proxy. - // /// - // /// This function is essentially the same as `http_headers`. - // /// - // /// By default this option is not set and corresponds to - // /// `CURLOPT_PROXYHEADER` - // pub fn proxy_headers(&mut self, list: &'a List) -> Result<(), Error> { - // self.setopt_ptr(curl_sys::CURLOPT_PROXYHEADER, list.raw as *const _) - // } + /// Add some headers to send to the HTTP proxy. + /// + /// This function is essentially the same as `http_headers`. + /// + /// By default this option is not set and corresponds to + /// `CURLOPT_PROXYHEADER` + pub fn proxy_headers(&mut self, list: List) -> Result<(), Error> { + let ptr = list::raw(&list); + self.inner.proxy_header_list = Some(list); + self.setopt_ptr(curl_sys::CURLOPT_PROXYHEADER, ptr as *const _) + } /// Set the contents of the HTTP Cookie header. ///