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] http api timeout doesn't work #4050

Closed
qu1ck opened this issue May 4, 2022 · 11 comments
Closed

[bug] http api timeout doesn't work #4050

qu1ck opened this issue May 4, 2022 · 11 comments

Comments

@qu1ck
Copy link

qu1ck commented May 4, 2022

Describe the bug

Timeout value passed as parameter in HttpOptions has no effect.

Reproduction

    var client = await http.getClient(
        { connectTimeout: 2, maxRedirections: 3 });
    var response = await client.get(
        "https://httpstat.us/200?sleep=9000",
        {responseType: ResponseType.Text, timeout: 2});

Expected behavior

The request times out

Platform and versions

Environment
  › OS: Windows 10.0.19044 X64
  › Webview2: 101.0.1210.32
  › MSVC:
      - Visual Studio Community 2019
  › Node.js: 16.14.2
  › npm: 8.5.0
  › pnpm: Not installed!
  › yarn: Not installed!
  › rustup: 1.24.3
  › rustc: 1.59.0
  › cargo: 1.59.0
  › Rust toolchain: stable-x86_64-pc-windows-msvc

Packages
  › @tauri-apps/cli [NPM]: 1.0.0-rc.9
  › @tauri-apps/api [NPM]: 1.0.0-rc.4
  › tauri [RUST]: git+https://github.com/tauri-apps/tauri.git?rev=eaf9e5a#eaf9e5a9a6c0959be46d2969a423ef7689ea9225 (1.0.0-rc.8),
  › tauri-build [RUST]: 1.0.0-rc.7,
  › tao [RUST]: 0.8.3,
  › wry [RUST]: 0.15.1,

Stack trace

No response

Additional context

No response

@qu1ck qu1ck added the type: bug label May 4, 2022
@lucasfernog
Copy link
Member

I just tested with both client options and it worked fine:
Network Error: error sending request for url (https://httpstat.us/200?sleep=9000): operation timed out: error sending request for url (https://httpstat.us/200?sleep=9000): operation timed out: operation timed out
Network Error: Io Error: timed out: Io Error: timed out

Did you configure httpstat's URL in your HTTP scope? I can reopen this issue if you can provide a minimal repro for this.

@qu1ck
Copy link
Author

qu1ck commented May 5, 2022

Yes, I have all urls allowed and I get a 200 response after 9 seconds, no errors at all.
Let me try to put together minimal repro.

@qu1ck
Copy link
Author

qu1ck commented May 5, 2022

httptimeoutrepro.zip
@lucasfernog Here is minimal repro.

@lucasfernog
Copy link
Member

This is what I see in the inspector on macOS:
Unhandled Promise Rejection: Network Error: Io Error: timed out: Io Error: timed out.

@lucasfernog
Copy link
Member

If this is a windows-only issue i'll remove the http api entirely 😂

@qu1ck
Copy link
Author

qu1ck commented May 6, 2022

I see a 200 response :|

@lucasfernog
Copy link
Member

Can you try with enabling the reqwest-client feature?

# src-tauri/Cargo.toml
[dependencies]
tauri = { git = "...", features = ["reqwest-client", "..."] }

@lucasfernog lucasfernog reopened this May 6, 2022
@qu1ck
Copy link
Author

qu1ck commented May 6, 2022

Network Error: error sending request for url (https://httpstat.us/200?sleep=9000): operation timed out
That works.

@lucasfernog
Copy link
Member

I can confirm attohttpc timeout isn't working on Windows omg 😂

@lucasfernog
Copy link
Member

sbstp/attohttpc#118

@lucasfernog
Copy link
Member

attohttpc is still fixing the issue, so i'll just make a change to set read_timeout to fix this on Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants