Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic with simple http request #17

Closed
l1x opened this issue Apr 26, 2019 · 1 comment
Closed

Panic with simple http request #17

l1x opened this issue Apr 26, 2019 · 1 comment
Labels
bug Something isn't working

Comments

@l1x
Copy link

l1x commented Apr 26, 2019

Hi,

I am not sure what is happening:

Cargo.toml:

http_req = {version="0.4.9", default-features = false, features = ["rust-tls"]}

fn fetch_adlist() {
    let adlist_url = "https://gist.githubusercontent.com/l1x/51e7ec94526dc7d0aba77b31378df48b/raw/a4515ac76d41a29df971e4ceab9e9916b71eea1b/tmux.conf";
    let mut writer = Vec::new();
    let res = request::get(adlist_url, &mut writer);
    match res {
        Ok(res) => info!("Status: {} {}", res.status_code(), res.reason()),
        Err(err) => debug!("{:?}", err),
    }
}
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:345:21
@jayjamesjay jayjamesjay added the bug Something isn't working label Apr 27, 2019
@jayjamesjay
Copy link
Owner

The error occurs during parsing headers. I made a wrong assumption that every header contains both double colon and space. It turned out that some headers might contain double colon without the following space / have no value.

I've already prepared the update and I'll release it soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants