Why does creating a Reqwest Client panic at Option::unwrap()?










0















extern crate reqwest;

fn main()
let client = reqwest::Client::new();



When I run this I get this error.



thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:345:21


I also tried it with the builder but the error remains same.



extern crate reqwest;

fn main()
let mut client = reqwest::Client::builder(); // Panics here
match client.build()
Err(e) => println!(":?", e);
_ =>




Here the full stack backtrace of this code.



 thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:345:21
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: std::sys_common::backtrace::print
at libstd/sys_common/backtrace.rs:71
at libstd/sys_common/backtrace.rs:59
2: std::panicking::default_hook::closure
at libstd/panicking.rs:211
3: std::panicking::default_hook
at libstd/panicking.rs:227
4: std::panicking::rust_panic_with_hook
at libstd/panicking.rs:511
5: std::panicking::continue_panic_fmt
at libstd/panicking.rs:426
6: rust_begin_unwind
at libstd/panicking.rs:337
7: core::panicking::panic_fmt
at libcore/panicking.rs:92
8: core::panicking::panic
at libcore/panicking.rs:53
9: <core::option::Option<T>>::unwrap
at /checkout/src/libcore/macros.rs:20
10: openssl::ssl::SslContextBuilder::set_options
at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/src/ssl/mod.rs:905
11: openssl::ssl::connector::ctx
at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/src/ssl/connector.rs:42
12: openssl::ssl::connector::SslConnectorBuilder::new
at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/src/ssl/connector.rs:67
13: native_tls::imp::TlsConnector::builder
at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/native-tls-0.1.5/src/imp/openssl.rs:186
14: native_tls::TlsConnector::builder
at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/native-tls-0.1.5/src/lib.rs:390
15: reqwest::async_impl::client::ClientBuilder::new
at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/reqwest-0.8.6/src/async_impl/client.rs:79
16: reqwest::client::ClientBuilder::new
at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/reqwest-0.8.6/src/client.rs:63
17: reqwest::client::Client::builder
at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/reqwest-0.8.6/src/client.rs:281
18: project::proj::tp_app::uploader::start
at src/proj/tp_app/uploader.rs:4









share|improve this question




























    0















    extern crate reqwest;

    fn main()
    let client = reqwest::Client::new();



    When I run this I get this error.



    thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:345:21


    I also tried it with the builder but the error remains same.



    extern crate reqwest;

    fn main()
    let mut client = reqwest::Client::builder(); // Panics here
    match client.build()
    Err(e) => println!(":?", e);
    _ =>




    Here the full stack backtrace of this code.



     thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:345:21
    stack backtrace:
    0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
    at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
    1: std::sys_common::backtrace::print
    at libstd/sys_common/backtrace.rs:71
    at libstd/sys_common/backtrace.rs:59
    2: std::panicking::default_hook::closure
    at libstd/panicking.rs:211
    3: std::panicking::default_hook
    at libstd/panicking.rs:227
    4: std::panicking::rust_panic_with_hook
    at libstd/panicking.rs:511
    5: std::panicking::continue_panic_fmt
    at libstd/panicking.rs:426
    6: rust_begin_unwind
    at libstd/panicking.rs:337
    7: core::panicking::panic_fmt
    at libcore/panicking.rs:92
    8: core::panicking::panic
    at libcore/panicking.rs:53
    9: <core::option::Option<T>>::unwrap
    at /checkout/src/libcore/macros.rs:20
    10: openssl::ssl::SslContextBuilder::set_options
    at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/src/ssl/mod.rs:905
    11: openssl::ssl::connector::ctx
    at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/src/ssl/connector.rs:42
    12: openssl::ssl::connector::SslConnectorBuilder::new
    at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/src/ssl/connector.rs:67
    13: native_tls::imp::TlsConnector::builder
    at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/native-tls-0.1.5/src/imp/openssl.rs:186
    14: native_tls::TlsConnector::builder
    at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/native-tls-0.1.5/src/lib.rs:390
    15: reqwest::async_impl::client::ClientBuilder::new
    at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/reqwest-0.8.6/src/async_impl/client.rs:79
    16: reqwest::client::ClientBuilder::new
    at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/reqwest-0.8.6/src/client.rs:63
    17: reqwest::client::Client::builder
    at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/reqwest-0.8.6/src/client.rs:281
    18: project::proj::tp_app::uploader::start
    at src/proj/tp_app/uploader.rs:4









    share|improve this question


























      0












      0








      0








      extern crate reqwest;

      fn main()
      let client = reqwest::Client::new();



      When I run this I get this error.



      thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:345:21


      I also tried it with the builder but the error remains same.



      extern crate reqwest;

      fn main()
      let mut client = reqwest::Client::builder(); // Panics here
      match client.build()
      Err(e) => println!(":?", e);
      _ =>




      Here the full stack backtrace of this code.



       thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:345:21
      stack backtrace:
      0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
      at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
      1: std::sys_common::backtrace::print
      at libstd/sys_common/backtrace.rs:71
      at libstd/sys_common/backtrace.rs:59
      2: std::panicking::default_hook::closure
      at libstd/panicking.rs:211
      3: std::panicking::default_hook
      at libstd/panicking.rs:227
      4: std::panicking::rust_panic_with_hook
      at libstd/panicking.rs:511
      5: std::panicking::continue_panic_fmt
      at libstd/panicking.rs:426
      6: rust_begin_unwind
      at libstd/panicking.rs:337
      7: core::panicking::panic_fmt
      at libcore/panicking.rs:92
      8: core::panicking::panic
      at libcore/panicking.rs:53
      9: <core::option::Option<T>>::unwrap
      at /checkout/src/libcore/macros.rs:20
      10: openssl::ssl::SslContextBuilder::set_options
      at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/src/ssl/mod.rs:905
      11: openssl::ssl::connector::ctx
      at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/src/ssl/connector.rs:42
      12: openssl::ssl::connector::SslConnectorBuilder::new
      at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/src/ssl/connector.rs:67
      13: native_tls::imp::TlsConnector::builder
      at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/native-tls-0.1.5/src/imp/openssl.rs:186
      14: native_tls::TlsConnector::builder
      at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/native-tls-0.1.5/src/lib.rs:390
      15: reqwest::async_impl::client::ClientBuilder::new
      at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/reqwest-0.8.6/src/async_impl/client.rs:79
      16: reqwest::client::ClientBuilder::new
      at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/reqwest-0.8.6/src/client.rs:63
      17: reqwest::client::Client::builder
      at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/reqwest-0.8.6/src/client.rs:281
      18: project::proj::tp_app::uploader::start
      at src/proj/tp_app/uploader.rs:4









      share|improve this question
















      extern crate reqwest;

      fn main()
      let client = reqwest::Client::new();



      When I run this I get this error.



      thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:345:21


      I also tried it with the builder but the error remains same.



      extern crate reqwest;

      fn main()
      let mut client = reqwest::Client::builder(); // Panics here
      match client.build()
      Err(e) => println!(":?", e);
      _ =>




      Here the full stack backtrace of this code.



       thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:345:21
      stack backtrace:
      0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
      at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
      1: std::sys_common::backtrace::print
      at libstd/sys_common/backtrace.rs:71
      at libstd/sys_common/backtrace.rs:59
      2: std::panicking::default_hook::closure
      at libstd/panicking.rs:211
      3: std::panicking::default_hook
      at libstd/panicking.rs:227
      4: std::panicking::rust_panic_with_hook
      at libstd/panicking.rs:511
      5: std::panicking::continue_panic_fmt
      at libstd/panicking.rs:426
      6: rust_begin_unwind
      at libstd/panicking.rs:337
      7: core::panicking::panic_fmt
      at libcore/panicking.rs:92
      8: core::panicking::panic
      at libcore/panicking.rs:53
      9: <core::option::Option<T>>::unwrap
      at /checkout/src/libcore/macros.rs:20
      10: openssl::ssl::SslContextBuilder::set_options
      at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/src/ssl/mod.rs:905
      11: openssl::ssl::connector::ctx
      at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/src/ssl/connector.rs:42
      12: openssl::ssl::connector::SslConnectorBuilder::new
      at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/src/ssl/connector.rs:67
      13: native_tls::imp::TlsConnector::builder
      at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/native-tls-0.1.5/src/imp/openssl.rs:186
      14: native_tls::TlsConnector::builder
      at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/native-tls-0.1.5/src/lib.rs:390
      15: reqwest::async_impl::client::ClientBuilder::new
      at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/reqwest-0.8.6/src/async_impl/client.rs:79
      16: reqwest::client::ClientBuilder::new
      at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/reqwest-0.8.6/src/client.rs:63
      17: reqwest::client::Client::builder
      at /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/reqwest-0.8.6/src/client.rs:281
      18: project::proj::tp_app::uploader::start
      at src/proj/tp_app/uploader.rs:4






      rust reqwest






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 15 '18 at 15:29









      Shepmaster

      156k14315457




      156k14315457










      asked Nov 14 '18 at 7:56









      Nipun GargNipun Garg

      665




      665






















          1 Answer
          1






          active

          oldest

          votes


















          4














          Quoting the documentation of reqwest::Client::new




          This method panics if native TLS backend cannot be created or initialized. Use Client::builder() if you wish to handle the failure as an Error instead of panicking.







          share|improve this answer






















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53295387%2fwhy-does-creating-a-reqwest-client-panic-at-optionunwrap%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            4














            Quoting the documentation of reqwest::Client::new




            This method panics if native TLS backend cannot be created or initialized. Use Client::builder() if you wish to handle the failure as an Error instead of panicking.







            share|improve this answer



























              4














              Quoting the documentation of reqwest::Client::new




              This method panics if native TLS backend cannot be created or initialized. Use Client::builder() if you wish to handle the failure as an Error instead of panicking.







              share|improve this answer

























                4












                4








                4







                Quoting the documentation of reqwest::Client::new




                This method panics if native TLS backend cannot be created or initialized. Use Client::builder() if you wish to handle the failure as an Error instead of panicking.







                share|improve this answer













                Quoting the documentation of reqwest::Client::new




                This method panics if native TLS backend cannot be created or initialized. Use Client::builder() if you wish to handle the failure as an Error instead of panicking.








                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 14 '18 at 7:58









                hellowhellow

                5,33242242




                5,33242242





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53295387%2fwhy-does-creating-a-reqwest-client-panic-at-optionunwrap%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Use pre created SQLite database for Android project in kotlin

                    Darth Vader #20

                    Ondo