Skip to content

Fix #2034 #2048

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

Merged
merged 8 commits into from
Feb 10, 2025
Merged

Fix #2034 #2048

merged 8 commits into from
Feb 10, 2025

Conversation

yhirose
Copy link
Owner

@yhirose yhirose commented Feb 10, 2025

No description provided.

Comment on lines +2369 to +2374
bool process_client_socket(
socket_t sock, time_t read_timeout_sec, time_t read_timeout_usec,
time_t write_timeout_sec, time_t write_timeout_usec,
time_t global_timeout_msec,
std::chrono::time_point<std::chrono::steady_clock> start_time,
std::function<bool(Stream &)> callback);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it make sense at some point to move those/some parameters into a Session or SocketConfig struct? It's quite unwieldy already.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the code can be refactored later.

@falbrechtskirchinger
Copy link
Contributor

falbrechtskirchinger commented Feb 10, 2025

Do you want to see my solution to this at all? It would have the added benefit of making requests cancellable in the future if that were ever desired. Also, it keeps additional timeout logic out of the stream classes, which partially clashes with my stream handler requirements (though, that can be worked around). And I intend to address the DNS issue as well. That's not (yet) included in your global timeout.

I'll need another day or two to get it ready.

Edit: Never mind, canceling doesn't require event pipes and is already implemented.

@yhirose yhirose merged commit 8a7c536 into master Feb 10, 2025
7 checks passed
@yhirose
Copy link
Owner Author

yhirose commented Feb 10, 2025

Do you want to see my solution to this at all? It would have the added benefit of making requests cancellable in the future if that were ever desired. Also, it keeps additional timeout logic out of the stream classes, which partially clashes with my stream handler requirements (though, that can be worked around). And I intend to address the DNS issue as well. That's not (yet) included in your global timeout.

I'll need another day or two to get it ready.

Edit: Never mind, canceling doesn't require event pipes and is already implemented.

Currently, I am not very much interested in it unless it is absolutely needed. But if there are things that improve the httplib code base, could you split your change into several smaller pull requests? I usually don't accept a big pull request, because I don't have time to understand such.

As for the DNS issue, could you take a look at #1601? If you have a multi platform solution, could you send it as a pull request? Thanks!

@falbrechtskirchinger
Copy link
Contributor

Do you want to see my solution to this at all? It would have the added benefit of making requests cancellable in the future if that were ever desired. Also, it keeps additional timeout logic out of the stream classes, which partially clashes with my stream handler requirements (though, that can be worked around). And I intend to address the DNS issue as well. That's not (yet) included in your global timeout.
I'll need another day or two to get it ready.
Edit: Never mind, canceling doesn't require event pipes and is already implemented.

Currently, I am not very much interested in it unless it is absolutely needed. But if there are things that improve the httplib code base, could you split your change into several smaller pull requests?

I've thought more about it and my code no longer adds anything of value to the core of httplib.

I usually don't accept a big pull request, because I don't have time to understand such.

Well, I hope you might accept a larger PR (WebSockets) as part of example/ or possibly contrib/.

As for the DNS issue, could you take a look at #1601? If you have a multi platform solution, could you send it as a pull request? Thanks!

Unfortunately, I was only interested in the issue as a vehicle to get WebSockets-related code included/reviewed. Sorry! I use httplib mostly for IPC using UNIX domain sockets and right now WebSockets for interacting locally with Chrome DevTools.
I would have just used threads. It's not great, but it works everywhere.

@yhirose yhirose deleted the issue2034 branch February 10, 2025 23:08
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

Successfully merging this pull request may close these issues.

2 participants