pub fn http_handle(config: &Config) -> CargoResult<http::Handle> {
    // The timeout option for libcurl by default times out the entire transfer,
    // but we probably don't want this. Instead we only set timeouts for the
    // connect phase as well as a "low speed" timeout so if we don't receive
    // many bytes in a large-ish period of time then we time out.
    let handle = http::handle().timeout(0)
                               .connect_timeout(30_000 /* milliseconds */)
                               .low_speed_limit(10 /* bytes per second */)
                               .low_speed_timeout(30 /* seconds */);
    let handle = match try!(http_proxy(config)) {
        Some(proxy) => handle.proxy(proxy),
        None => handle,
    };
    let handle = match try!(http_timeout(config)) {
        Some(timeout) => handle.connect_timeout(timeout as usize)
                               .low_speed_timeout((timeout as usize) / 1000),
        None => handle,
    };
    Ok(handle)
}
/// Create a new HTTP handle with appropriate global configuration for cargo.
Create a new HTTP handle with appropriate global configuration for cargo.
Create a new HTTP handle with appropriate global configuration for cargo .
pub fn http_handle(config: &Config) -> CargoResult<http::Handle> {
    // The timeout option for libcurl by default times out the entire transfer,
    // but we probably don't want this. Instead we only set timeouts for the
    // connect phase as well as a "low speed" timeout so if we don't receive
    // many bytes in a large-ish period of time then we time out.
    let handle = http::handle().timeout(0)
                               .connect_timeout(30_000 /* milliseconds */)
                               .low_speed_limit(10 /* bytes per second */)
                               .low_speed_timeout(30 /* seconds */);
    let handle = match try!(http_proxy(config)) {
        Some(proxy) => handle.proxy(proxy),
        None => handle,
    };
    let handle = match try!(http_timeout(config)) {
        Some(timeout) => handle.connect_timeout(timeout as usize)
                               .low_speed_timeout((timeout as usize) / 1000),
        None => handle,
    };
    Ok(handle)
}
pub fn http_handle ( config : & Config ) -> CargoResult < http :: Handle > { // The timeout option for libcurl by default times out the entire transfer, // but we probably don't want this. Instead we only set timeouts for the // connect phase as well as a "low speed" timeout so if we don't receive // many bytes in a large-ish period of time then we time out. let handle = http :: handle ( ) . timeout ( 0 ) . connect_timeout ( 30_000 /* milliseconds */ ) . low_speed_limit ( 10 /* bytes per second */ ) . low_speed_timeout ( 30 /* seconds */ ) ; let handle = match try ! ( http_proxy ( config ) ) { Some ( proxy ) => handle . proxy ( proxy ) , None => handle , } ; let handle = match try ! ( http_timeout ( config ) ) { Some ( timeout ) => handle . connect_timeout ( timeout as usize ) . low_speed_timeout ( ( timeout as usize ) / 1000 ) , None => handle , } ; Ok ( handle ) }
Create a new HTTP handle with appropriate global configuration for cargo.
Create a new HTTP handle with appropriate global configuration for cargo .
config
&Config
config
&Config