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

Request's content-length inconsisent depending on features #1971

Open
bryanburgers opened this issue Sep 6, 2023 · 0 comments
Open

Request's content-length inconsisent depending on features #1971

bryanburgers opened this issue Sep 6, 2023 · 0 comments

Comments

@bryanburgers
Copy link
Contributor

Whether the client sends a content-length header depends on what features are enabled.

Should this be inconsistent? Is this even something reqwest can control or is at the level of the tls libraries?

Given the code:

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
    let client = reqwest::Client::new();
    client
        .post("https://en4ai3fohs7sk.x.pipedream.net")
        .query(&[("feature", "rustls-tls")])
        //.query(&[("feature", "native-tls-vendored")])
        .send()
        .await?;
    Ok(())
}

with dependencies

tokio = { version = "1.32.0", features = ["rt-multi-thread", "macros"] }
reqwest = { version = "=0.11.20", default-features = false, features = [
    "json",
    "gzip",
    "rustls-tls",
    # "native-tls-vendored"
] }

When this is run with rustls-tls, the request headers include content-length: 0, but when run with native-tls-vendored the request headers do not include a content-length header.

When the request is made to http://... without any tls features enabled, the request headers do not include a content-length header either.

I have no idea if this requestbin is permanent or not, but you can see my tests here: https://public.requestbin.com/r/en4ai3fohs7sk.

Related: #1873

Byron added a commit to NobodyXu/gitoxide that referenced this issue Mar 21, 2024
In short, reqwest sends a `content-length: 0` header in GET
requests for a reason maybe related to this issue:

seanmonstar/reqwest#1971

For now, let's ignore Content-Length header lines.
Byron added a commit to NobodyXu/gitoxide that referenced this issue Mar 21, 2024
In short, reqwest sends a `content-length: 0` header in GET
requests for a reason maybe related to this issue:

seanmonstar/reqwest#1971

For now, let's ignore Content-Length header lines.
Byron added a commit to NobodyXu/gitoxide that referenced this issue Mar 21, 2024
In short, reqwest sends a `content-length: 0` header in GET
requests for a reason maybe related to this issue:

seanmonstar/reqwest#1971

For now, let's ignore Content-Length header lines.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant