~exprez135/castor

bb7926a5fb31a4df69442ae1bb2aa3a2e0690eec — Julien Blanchard 1 year, 5 months ago 11097f9 0.8.6
Prefer IPV4

.to_socket_addrs() returns IPV6 first and some servers seem to have
issues
3 files changed, 4 insertions(+), 3 deletions(-)

M src/finger/client.rs
M src/gemini/client.rs
M src/gopher/client.rs
M src/finger/client.rs => src/finger/client.rs +1 -1
@@ 11,7 11,7 @@ pub fn get_data<T: Protocol>(url: T) -> Result<(Option<Vec<u8>>, Vec<u8>), Strin
    let host = url.host_str().unwrap().to_string();
    let urlf = format!("{}:79", host);
    let socket = match urlf.to_socket_addrs() {
        Ok(mut iter) => iter.next(),
        Ok(iter) => iter.rev().next(),
        Err(_) => None,
    };


M src/gemini/client.rs => src/gemini/client.rs +1 -1
@@ 24,7 24,7 @@ pub fn get_data<T: Protocol>(url: T) -> Result<(Option<Vec<u8>>, Vec<u8>), Strin
    let connector = builder.build().unwrap();

    match urlf.to_socket_addrs() {
        Ok(mut addrs_iter) => match addrs_iter.next() {
        Ok(addrs_iter) => match addrs_iter.rev().next() {
            Some(socket_addr) => {
                let stream = TcpStream::connect_timeout(&socket_addr, Duration::new(5, 0));


M src/gopher/client.rs => src/gopher/client.rs +2 -1
@@ 15,8 15,9 @@ pub fn get_data<T: Protocol>(url: T) -> Result<(Option<Vec<u8>>, Vec<u8>), Strin
        None => 70,
    };
    let urlf = format!("{}:{}", host, port);

    let socket = match urlf.to_socket_addrs() {
        Ok(mut iter) => iter.next(),
        Ok(iter) => iter.rev().next(),
        Err(_) => None,
    };