hyperium / hyper-tls

Apache License 2.0
189 stars 96 forks source link

Add client method new_with_connector #22

Closed ernestas-poskus closed 6 years ago

ernestas-poskus commented 6 years ago

This allow to create HttpsConnector with hyper's default HttpConnector reason behind this is extra configuration for HttpConnector like set_nodelay and new set_local_address https://github.com/hyperium/hyper/blob/master/src/client/connect.rs#L254

cc @seanmonstar

witchof0x20 commented 6 years ago

+1 This would also be helpful for using connectors such as SOCKS proxies.

ernestas-poskus commented 6 years ago

cc @seanmonstar please advise how to proceed with this change, you have released new version with new new_ private function on HttpsConnector.. For my use case I need to pass constructed HttpConnector to this struct because I set additional configuration on it such as

        let mut http_connector: HttpConnector =
            HttpConnector::new_with_executor(executor.clone(), None);
        http_connector.set_keepalive(self.hyper_keep_alive_timeout);
        http_connector.set_nodelay(self.hyper_no_delay);
        http_connector.enforce_http(self.hyper_enforce_http);
seanmonstar commented 6 years ago

Sorry I forgot about this! It seems what you want to do can be done with the from constructor. HttpsConnector::from((http, tls)).

ernestas-poskus commented 6 years ago

Awesome :+1: