Skip to content

Discussion about Expect: 100-continue #2845

@vnt-dev

Description

@vnt-dev

It seems that reqwest does not support 100-continue, but in some cases it appears to be necessary.

Issue description: In certain network environments, requests sent using reqwest fail with the error message “error sending request for url”, while the same requests work correctly when executed with the curl command. Packet capture analysis shows that the requests from reqwest are actively terminated by the gateway, likely due to the absence of the Expect: 100-continue header. I confirmed this suspicion by switching to the isahc library.

Is there any plan to support 100-continue?

This is the code that works correctly with isahc. If the line header("Expect", "100-continue") is removed, it will fail to send the request properly, just like reqwest.

let upload_url = "";
let body = "";

use isahc::Request;
use isahc::RequestExt;
use isahc::ReadResponseExt;
use isahc::config::ExpectContinue;

let mut response = Request::post(upload_url)
    .tcp_nodelay()
    .expect_continue(ExpectContinue::enabled())
    .header("Content-Type", "application/x-www-form-urlencoded")
    .header("Expect", "100-continue") // Without this line the request fails
    .body(body.to_string())?
    .send()?; 

println!("Status: {}", response.status());
let text = response.text()?;
println!("Response: {}", text);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions