-
Notifications
You must be signed in to change notification settings - Fork 490
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
Add option --no-keepalive (curl option) #3253
Comments
In fact, I needed to add a delay to get a correct response from my API endpoint. |
Hello @jcamiel ! I'd love to work on this feature! I assume Thanks! |
@theoforger I've the impression that the right option to disable reusing connection is not CURLOPT_TCP_KEEPALIVE, but something like CURLOPT_FRESH_CONNECT or CURLOPT_FORBID_REUSE. I've to dig to understand the difference but |
@jcamiel Thanks for the info! I did some testing on all three options: let mut easy = Easy::new();
easy.url("http://127.0.0.1:8080")?;
easy.fresh_connect(false)?; // CURLOPT_FRESH_CONNECT
easy.tcp_keepalive(true)?; // CURLOPT_TCP_KEEPALIVE
easy.forbid_reuse(false)?; // CURLOPT_FORBID_REUS
easy.perform()?;
println!("Response code: {}", easy.response_code()?); while monitoring the connections with For some reasons no matter what options I use, libcurl doesn't keep any connection open afterwards. What's happening here? |
It think it may also depends on the HTTP version protocol. I don't think there is any reuse with a server responding HTTP/1.0, you should try with a "known" host like https://google.com |
You're right. It's working now! My understanding is that:
Either of them can stop reuse. Do we want to combine them or keep them as two separate flags? Also is there still an interest for |
Don't think there is a need to |
@fabricereix one thing to note it that there is no curl cli equivalent of |
Hello again! I just filed a PR. I mainly used #2468 as a reference to work on this. Let me know if there's any changes you wish to make 🙏 |
This |
@jcamiel I would still love to contribute though. If there's anything I can work on, feel free to let me know! 🙏 |
@theoforger Of course, let us just check something that will be merged without problem, so we don't waste your time this time! |
By default, Hurl keeps connections alive between requests (like curl).
It might be useful to disable it.
I've tested an API endpoint that didn't return any content (HTTP 204).
In order to get the response content (HTTP 200), I needed to disable the keep-alive (and force HTTP1.1 over HTTP2)
The text was updated successfully, but these errors were encountered: