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 in redirect::remove_sensitive_headers with Authorization header set using struct #171

Closed
gyng opened this issue Jul 24, 2017 · 1 comment
Labels
B-upstream Blocked: upstream. Depends on a dependency to make a change first.

Comments

@gyng
Copy link

gyng commented Jul 24, 2017

I'm getting a panic in redirect::remove_sensitive_headers when I make a request to http://google.com with an Authorization header set using a Basic struct on reqwest 0.7.1.

Code:

extern crate reqwest;

fn main() {
    let mut headers = reqwest::header::Headers::new();
    // headers.set(reqwest::header::Authorization("letmein".to_owned())); // this is okay
    headers.set(reqwest::header::Authorization(reqwest::header::Basic {
        username: "username".to_string(),
        password: Some("password".to_string()),
    }));

    reqwest::Client::new()
        .expect("failed to make client")
        .get("http://google.com") // redirects
        .expect("failed to add get")
        .headers(headers)
        .send()
        .expect("failed to send");
}

Backtrace:

➜  panics git:(master) ✗ RUST_BACKTRACE=1 cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
     Running `target/debug/panics`
thread 'reqwest-internal-sync-core' panicked at 'item.raw must exist', src/libcore/option.rs:794
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
   1: std::panicking::default_hook::{{closure}}
   2: std::panicking::default_hook
   3: std::panicking::rust_panic_with_hook
   4: std::panicking::begin_panic
   5: std::panicking::begin_panic_fmt
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::option::expect_failed
   9: <core::option::Option<T>>::expect
  10: hyper::header::internals::item::Item::into_typed
  11: core::ops::FnOnce::call_once
  12: <core::option::Option<T>>::and_then
  13: hyper::header::Headers::remove
  14: reqwest::redirect::remove_sensitive_headers
  15: <reqwest::async_impl::client::Pending as futures::future::Future>::poll
  16: <futures::future::chain::Chain<A, B, C>>::poll
  17: <futures::future::then::Then<A, B, F> as futures::future::Future>::poll
  18: <alloc::boxed::Box<F> as futures::future::Future>::poll
  19: <futures::task_impl::Spawn<F>>::poll_future_notify::{{closure}}
  20: <futures::task_impl::Spawn<T>>::enter::{{closure}}
  21: futures::task_impl::std::set
  22: <futures::task_impl::Spawn<T>>::enter
  23: <futures::task_impl::Spawn<F>>::poll_future_notify
  24: tokio_core::reactor::Core::dispatch_task::{{closure}}
  25: <scoped_tls::ScopedKey<T>>::set
  26: tokio_core::reactor::Core::dispatch_task
  27: tokio_core::reactor::Core::dispatch
  28: tokio_core::reactor::Core::poll
  29: tokio_core::reactor::Core::run
  30: reqwest::client::ClientHandle::new::{{closure}}
  31: <std::panic::AssertUnwindSafe<F> as core::ops::FnOnce<()>>::call_once
  32: std::panicking::try::do_call
  33: __rust_maybe_catch_panic
  34: std::panicking::try
  35: std::panic::catch_unwind
  36: std::thread::Builder::spawn::{{closure}}
  37: <F as alloc::boxed::FnBox<A>>::call_box
  38: std::sys::imp::thread::Thread::new::thread_start
  39: _pthread_body
  40: _pthread_start
thread 'main' panicked at 'core thread panicked', /Users/_/.cargo/registry/src/github.com-1ecc6299db9ec823/reqwest-0.7.1/src/client.rs:392
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
   1: std::panicking::default_hook::{{closure}}
   2: std::panicking::default_hook
   3: std::panicking::rust_panic_with_hook
   4: std::panicking::begin_panic
   5: reqwest::client::ClientHandle::execute_request
   6: reqwest::client::Client::execute
   7: reqwest::request::RequestBuilder::send
   8: panics::main
   9: __rust_maybe_catch_panic
  10: std::rt::lang_start
  11: main
@seanmonstar
Copy link
Owner

Yikes, looks like a panic in hyper!

@seanmonstar seanmonstar added the B-upstream Blocked: upstream. Depends on a dependency to make a change first. label Jul 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-upstream Blocked: upstream. Depends on a dependency to make a change first.
Projects
None yet
Development

No branches or pull requests

2 participants