Skip to content

Simple request always fails on Mac OS X #508

Closed
@wezm

Description

@wezm

Given this small sample program basically copied from the README:

extern crate hyper;

use std::io::Read;

use hyper::Client;
use hyper::header::Connection;
use hyper::header::ConnectionOption;

fn main() {
    // Create a client.
    let mut client = Client::new();

    // Creating an outgoing request.
    let mut res = client.get("http://files.wezm.net/testpodcast.xml")
        // set a header
        .header(Connection(vec![ConnectionOption::Close]))
        // let 'er go!
        .send().unwrap();

    // Read the Response.
    let mut body = String::new();
    res.read_to_string(&mut body).unwrap();

    println!("Response: {}", body);
}

The request always fails with a HttpIoError (NotConnected):

cargo run --verbose                                                                                                                                      Fresh typeable v0.1.1
       Fresh libc v0.1.6
       Fresh bitflags v0.1.1
       Fresh unicase v0.1.0
       Fresh traitobject v0.0.1
       Fresh lazy_static v0.1.10
       Fresh pkg-config v0.3.4
       Fresh gcc v0.3.5
       Fresh httparse v0.1.1
       Fresh rustc-serialize v0.3.14
       Fresh matches v0.1.2
       Fresh log v0.3.1
       Fresh num_cpus v0.2.4
       Fresh url v0.2.33
       Fresh mime v0.0.11
       Fresh openssl-sys v0.6.2
       Fresh time v0.1.25
       Fresh openssl v0.6.2
       Fresh cookie v0.1.20
       Fresh hyper v0.3.16
       Fresh request v0.1.0 (file:///Users/wmoore/Projects/Musicast/crawler/request)
     Running `target/debug/request`
thread '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: HttpIoError(Error { repr: Os(57) })', /Users/rustbuild/src/rust-buildbot/slave/beta-dist-rustc-mac/build/src/libcore/result.rs:729
Process didn't exit successfully: `target/debug/request` (exit code: 101)

This is with OS X 10.10.3 (14D136) and rustc 1.0.0-beta.4 (850151a75 2015-04-30) (built 2015-04-30). The same program works when run on a Ubuntu 14.04 VM with the same version of rust.

It seems somewhat dependent on the URL, although more fail than don't. E.g. these work:

These do not:

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-clientArea: client.C-bugCategory: bug. Something is wrong. This is bad!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions