You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@teaclave.apache.org by czzmmc <no...@github.com> on 2020/04/08 11:46:03 UTC

[apache/incubator-teaclave-sgx-sdk] Segmentation fault during https request (#221)

My code is like below. I am trying to send https request from enclave. I think that should have worked, but it just gives me segmentation fault error. How should I fix it?
#[no_mangle]
pub extern "C" fn send_http_request(hostname: *const c_char) -> sgx_status_t {
    println!("1");
    let hostname = unsafe { CStr::from_ptr(hostname).to_str() };
    let hostname = hostname.expect("Failed to recover hostname");

    println!("hostname: {:?}", hostname);

    let mut writer = Vec::new(); //container for body of a response
    let res = request::get("https://www.baidu.com", &mut writer).unwrap();

    println!("Status: {} {}", res.status_code(), res.reason());
    println!("{:?}", res);

    sgx_status_t::SGX_SUCCESS
}

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/issues/221

Re: [apache/incubator-teaclave-sgx-sdk] Segmentation fault during https request (#221)

Posted by Yu Ding <no...@github.com>.
Closed #221.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/issues/221#event-3216050193

Re: [apache/incubator-teaclave-sgx-sdk] Segmentation fault during https request (#221)

Posted by Yu Ding <no...@github.com>.
duplicate of #220 

You may refer to [http_req](../tree/master/samplecode/http_req) sample.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/issues/221#issuecomment-611221699