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

Bug: 404 NOT FOUND !!! #100

Closed
rawhuul opened this issue Sep 5, 2023 · 6 comments
Closed

Bug: 404 NOT FOUND !!! #100

rawhuul opened this issue Sep 5, 2023 · 6 comments

Comments

@rawhuul
Copy link

rawhuul commented Sep 5, 2023

Hey, there recently I was using this library in my project to download some files where I encountered that I'm receiving something wrong in Response and it is Content-Length which is vital while downloading packets from servers.

Here is code,

fn main() {
    let url = "https://dl.google.com/release2/chrome/adfkdljgj4k6oqm55u6o55rwqovq_116.0.5845.141/116.0.5845.141_chrome_installer.exe#/dl.7z";

    let req1 = ureq::get(url);

    let res1 = req1.call().unwrap();

    let len1 = res1.header("content-length");
    let enc1 = res1.header("content-encoding");

    let req2 = minreq::get(url);

    let res2 = req2.send_lazy().unwrap();

    let len2 = res2.headers.get("content-length");
    let enc2 = res2.headers.get("content-encoding");

    println!(
        "From ureq - Size: {:?}, Encoding: {:?}\nFrom minreq - Size: {:?}, Encoding: {:?}",
        len1, enc1, len2, enc2
    );
}

Here is the output I have received, the first output shows result of sending request not lazily and latter one uses lazy sending of request.

image

To enable HTTPS, I am using https-rustls-probe feature, my Cargo.toml looks like:

[package]
name = "req"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
minreq = { version = "2.9.1", features = ["https-rustls-probe"] }
ureq = "2.7.1"

However on further inspection, just by printing the whole response altogether, I able to figure out that it is due to 404 NOT FOUND ERROR but how does ureq able to fetch the same request neatly?

Last Code:

fn main() {
    let url = "https://dl.google.com/release2/chrome/adfkdljgj4k6oqm55u6o55rwqovq_116.0.5845.141/116.0.5845.141_chrome_installer.exe#/dl.7z";

    let req1 = ureq::get(url);

    let res1 = req1.call().unwrap();

    let len1 = res1.header("content-length");
    let enc1 = res1.header("content-encoding");

    let req2 = minreq::get(url);

    let res2 = req2.send().unwrap();

    let len2 = res2.headers.get("content-length");
    let enc2 = res2.headers.get("content-encoding");

    println!(
        "From ureq - Size: {:?}, Encoding: {:?}\nFrom minreq - Size: {:?}, Encoding: {:?}",
        len1, enc1, len2, enc2
    );

    println!("{:?}\n{:?}", res1, res2);
}

Output:

req on  main [?] is 📦 v0.1.0 via 🦀 v1.71.1 took 2s ❯ cargo r
   Compiling minreq v2.9.1
   Compiling req v0.1.0 (C:\Users\Rahul\tests\req)
    Finished dev [unoptimized + debuginfo] target(s) in 2.23s
     Running `target\debug\req.exe`
From ureq - Size: Some("97126448"), Encoding: None
From minreq - Size: Some("1449"), Encoding: None
Response[status: 200, status_text: OK, url: https://dl.google.com/release2/chrome/adfkdljgj4k6oqm55u6o55rwqovq_116.0.5845.141/116.0.5845.141_chrome_installer.exe#/dl.7z]
Response { status_code: 404, reason_phrase: "Not Found", headers: {"server": "downloads", "x-content-type-options": "nosniff", "x-frame-options": "SAMEORIGIN", "date": "Tue, 05 Sep 2023 13:13:45 GMT", "content-length": "1449", "alt-svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000", "content-type": "text/html; charset=utf-8", "x-xss-protection": "0"}, body: [10, 60, 33, 68, 79, 67, 84, 89, 80, 69, 32, 104, 116, 109, 108, 62, 10, 60, 104, 116, 109, 108, 32, 108, 97, 110, 103, 61, 101, 110, 62, 10, 32, 32, 60, 109, 101, 116, 97, 32, 99, 104, 97, 114, 115, 101, 116, 61, 117, 116, 102, 45, 56, 62, 10, 32, 32, 60, 109, 101, 116, 97, 32, 110, 97, 109, 101, 61, 118, 105, 101, 119, 112, 111, 114, 116, 32, 99, 111, 110, 116, 101, 110, 116, 61, 34, 105, 110, 105, 116, 105, 97, 108, 45, 115, 99, 97, 108, 101, 61, 49, 44, 32, 109, 105, 110, 105, 109, 117, 109, 45, 115, 99, 97, 108, 101, 61, 49, 44, 32, 119, 105, 100, 116, 104, 61, 100, 101, 118, 105, 99, 101, 45, 119, 105, 100, 116, 104, 34, 62, 10, 32, 32, 60, 116, 105, 116, 108, 101, 62, 69, 114, 114, 111, 114, 32, 52, 48, 52, 32, 40, 78, 111, 116, 32, 70, 111, 117, 110, 100, 41, 33, 33, 49, 60, 47, 116, 105, 116, 108, 101, 62, 10, 32, 32, 60, 115, 116, 121, 108, 101, 62, 10, 32, 32, 32, 32, 42, 123, 109, 97, 114, 103, 105, 110, 58, 48, 59, 112, 97, 100, 100, 105, 110, 103, 58, 48, 125, 104, 116, 109, 108, 44, 99, 111, 100, 101, 123, 102, 111, 110, 116, 58, 49, 53, 112, 120, 47, 50, 50, 112, 120, 32, 97, 114, 105, 97, 108, 44, 115, 97, 110, 115, 45, 115, 101, 114, 105, 102, 125, 104, 116, 109, 108, 123, 98, 97, 99, 107, 103, 114, 111, 117, 110, 100, 58, 35, 102, 102, 102, 59, 99, 111, 108, 111, 114, 58, 35, 50, 50, 50, 59, 112, 97, 100, 100, 105, 110, 103, 58, 49, 53, 112, 120, 125, 98, 111, 100, 121, 123, 109, 97, 114, 103, 105, 110, 58, 55, 37, 32, 97, 117, 116, 111, 32, 48, 59, 109, 97, 120, 45, 119, 105, 100, 116, 104, 58, 51, 57, 48, 112, 120, 59, 109, 105, 110, 45, 104, 101, 105, 103, 104, 116, 58, 49, 56, 48, 112, 120, 59, 112, 97, 100, 100, 105, 110, 103, 58, 51, 48, 112, 120, 32, 48, 32, 49, 53, 112, 120, 125, 42, 32, 62, 32, 98, 111, 100, 121, 123, 98, 97, 99, 107, 103, 114, 111, 117, 110, 100, 58, 117, 114, 108, 40, 47, 47, 119, 119, 119, 46, 103, 111, 111, 103, 108, 101, 46, 99, 111, 109, 47, 105, 109, 97, 103, 101, 115, 47, 101, 114, 114, 111, 114, 115, 47, 114, 111, 98, 111, 116, 46, 112, 110, 103, 41, 32, 49, 48, 48, 37, 32, 53, 112, 120, 32, 110, 111, 45, 114, 101, 112, 101, 97, 116, 59, 112, 97, 100, 100, 105, 110, 103, 45, 114, 105, 103, 104, 116, 58, 50, 48, 53, 112, 120, 125, 112, 123, 109, 97, 114, 103, 105, 110, 58, 49, 49, 112, 120, 32, 48, 32, 50, 50, 112, 120, 59, 111, 118, 101, 114, 102, 108, 111, 119, 58, 104, 105, 100, 100, 101, 110, 125, 105, 110, 115, 123, 99, 111, 108, 111, 114, 58, 35, 55, 55, 55, 59, 116, 101, 120, 116, 45, 100, 101, 99, 111, 114, 97, 116, 105, 111, 110, 58, 110, 111, 110, 101, 125, 97, 32, 105, 109, 103, 123, 98, 111, 114, 100, 101, 114, 58, 48, 125, 64, 109, 101, 100, 105, 97, 32, 115, 99, 114, 101, 101, 110, 32, 97, 110, 100, 32, 40, 109, 97, 120, 45, 119, 105, 100, 116, 104, 58, 55, 55, 50, 112, 120, 41, 123, 98, 111, 100, 121, 123, 98, 97, 99, 107, 103, 114, 111, 117, 110, 100, 58, 110, 111, 110, 101, 59, 109, 97, 114, 103, 105, 110, 45, 116, 111, 112, 58, 48, 59, 109, 97, 120, 45, 119, 105, 100, 116, 104, 58, 110, 111, 110, 101, 59, 112, 97, 100, 100, 105, 110, 103, 45, 114, 105, 103, 104, 116, 58, 48, 125, 125, 35, 108, 111, 103, 111, 123, 98, 97, 99, 107, 103, 114, 111, 117, 110, 100, 58, 117, 114, 108, 40, 47, 47, 119, 119, 119, 46, 103, 111, 111, 103, 108, 101, 46, 99, 111, 109, 47, 105, 109, 97, 103, 101, 115, 47, 108, 111, 103, 111, 115, 47, 101, 114, 114, 111, 114, 112, 97, 103, 101, 47, 101, 114, 114, 111, 114, 95, 108, 111, 103, 111, 45, 49, 53, 48, 120, 53, 52, 46, 112, 110, 103, 41, 32, 110, 111, 45, 114, 101, 112, 101, 97, 116, 59, 109, 97, 114, 103, 105, 110, 45, 108, 101, 102, 116, 58, 45, 53, 112, 120, 125, 64, 109, 101, 100, 105, 97, 32, 111, 110, 108, 121, 32, 115, 99, 114, 101, 101, 110, 32, 97, 110, 100, 32, 40, 109, 105, 110, 45, 114, 101, 115, 111, 108, 117, 116, 105, 111, 110, 58, 49, 57, 50, 100, 112, 105, 41, 123, 35, 108, 111, 103, 111, 123, 98, 97, 99, 107, 103, 114, 111, 117, 110, 100, 58, 117, 114, 108, 40, 47, 47, 119, 119, 119, 46, 103, 111, 111, 103, 108, 101, 46, 99, 111, 109, 47, 105, 109, 97, 103, 101, 115, 47, 108, 111, 103, 111, 115, 47, 101, 114, 114, 111, 114, 112, 97, 103, 101, 47, 101, 114, 114, 111, 114, 95, 108, 111, 103, 111, 45, 49, 53, 48, 120, 53, 52, 45, 50, 120, 46, 112, 110, 103, 41, 32, 110, 111, 45, 114, 101, 112, 101, 97, 116, 32, 48, 37, 32, 48, 37, 47, 49, 48, 48, 37, 32, 49, 48, 48, 37, 59, 45, 109, 111, 122, 45, 98, 111, 114, 100, 101, 114, 45, 105, 109, 97, 103, 101, 58, 117, 114, 108, 40, 47, 47, 119, 119, 119, 46, 103, 111, 111, 103, 108, 101, 46, 99, 111, 109, 47, 105, 109, 97, 103, 101, 115, 47, 108, 111, 103, 111, 115, 47, 101, 114, 114, 111, 114, 112, 97, 103, 101, 47, 101, 114, 114, 111, 114, 95, 108, 111, 103, 111, 45, 49, 53, 48, 120, 53, 52, 45, 50, 120, 46, 112, 110, 103, 41, 32, 48, 125, 125, 64, 109, 101, 100, 105, 97, 32, 111, 110, 108, 121, 32, 115, 99, 114, 101, 101, 110, 32, 97, 110, 100, 32, 40, 45, 119, 101, 98, 107, 105, 116, 45, 109, 105, 110, 45, 100, 101, 118, 105, 99, 101, 45, 112, 105, 120, 101, 108, 45, 114, 97, 116, 105, 111, 58, 50, 41, 123, 35, 108, 111, 103, 111, 123, 98, 97, 99, 107, 103, 114, 111, 117, 110, 100, 58, 117, 114, 108, 40, 47, 47, 119, 119, 119, 46, 103, 111, 111, 103, 108, 101, 46, 99, 111, 109, 47, 105, 109, 97, 103, 101, 115, 47, 108, 111, 103, 111, 115, 47, 101, 114, 114, 111, 114, 112, 97, 103, 101, 47, 101, 114, 114, 111, 114, 95, 108, 111, 103, 111, 45, 49, 53, 48, 120, 53, 52, 45, 50, 120, 46, 112, 110, 103, 41, 32, 110, 111, 45, 114, 101, 112, 101, 97, 116, 59, 45, 119, 101, 98, 107, 105, 116, 45, 98, 97, 99, 107, 103, 114, 111, 117, 110, 100, 45, 115, 105, 122, 101, 58, 49, 48, 48, 37, 32, 49, 48, 48, 37, 125, 125, 35, 108, 111, 103, 111, 123, 100, 105, 115, 112, 108, 97, 121, 58, 105, 110, 108, 105, 110, 101, 45, 98, 108, 111, 99, 107, 59, 104, 101, 105, 103, 104, 116, 58, 53, 52, 112, 120, 59, 119, 105, 100, 116, 104, 58, 49, 53, 48, 112, 120, 125, 10, 32, 32, 60, 47, 115, 116, 121, 108, 101, 62, 10, 32, 32, 60, 97, 32, 104, 114, 101, 102, 61, 47, 47, 119, 119, 119, 46, 103, 111, 111, 103, 108, 101, 46, 99, 111, 109, 47, 62, 60, 115, 112, 97, 110, 32, 105, 100, 61, 108, 111, 103, 111, 32, 97, 114, 105, 97, 45, 108, 97, 98, 101, 108, 61, 71, 111, 111, 103, 108, 101, 62, 60, 47, 115, 112, 97, 110, 62, 60, 47, 97, 62, 10, 32, 32, 60, 112, 62, 60, 98, 62, 52, 48, 52, 46, 60, 47, 98, 62, 32, 60, 105, 110, 115, 62, 84, 104, 97, 116, 226, 128, 153, 115, 32, 97, 110, 32, 101, 114, 114, 111, 114, 46, 60, 47, 105, 110, 115, 62, 10, 32, 32, 60, 112, 62, 32, 32, 60, 105, 110, 115, 62, 84, 104, 97, 116, 226, 128, 153, 115, 32, 97, 108, 108, 32, 119, 101, 32, 107, 110, 111, 119, 46, 60, 47, 105, 110, 115, 62, 10] }
req on  main [?] is 📦 v0.1.0 via 🦀 v1.71.1 took 3s ❯

For a minute, I thought it could be due to feature https-rustls-probe but again I tried with other features that enable HTTPS and I am still getting same response.

@neonmoe
Copy link
Owner

neonmoe commented Sep 5, 2023

This is caused by the #/dl.7z at the end of the URL, which minreq passes into the HTTP request, while other http clients appear to cut it out. I'll look into fixing this, but in the meantime, you can just remove that part at the end to work around the issue.

@rawhuul
Copy link
Author

rawhuul commented Sep 5, 2023

Okay, so should I close this issue for sometime or let it be?

@neonmoe
Copy link
Owner

neonmoe commented Sep 5, 2023

Let it be, I'll close it once the issue is fixed :)

@rawhuul
Copy link
Author

rawhuul commented Sep 5, 2023

Thanks, I'll also look into it, if I could provide any help

@neonmoe
Copy link
Owner

neonmoe commented Sep 5, 2023

Fixed in 7c26e37, releasing it in 2.10.0. Thanks for the issue report!

@neonmoe neonmoe closed this as completed Sep 5, 2023
@rawhuul
Copy link
Author

rawhuul commented Sep 5, 2023

hey there, thanks for ultimately fast response, i really appreciate it

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

2 participants