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

Avoid thrown/caught exceptions when using HttpClient.openUrl (and related methods) with hostnames #52423

Closed
DanTup opened this issue May 17, 2023 · 2 comments
Assignees
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. cherry-pick-candidate Candidates to be cherry-picked library-io P2 A bug or feature request we're likely to work on

Comments

@DanTup
Copy link
Collaborator

DanTup commented May 17, 2023

In a recent change (d884d1a) to fix #50868, there are calls to _InternetAddress.fromString() that will throw (and then catch) ArgumentError whenever the URI contains a hostname and not an IP address.

This is not itself a bug/problem and everything works as expected. However, a lot of users are running with "break on all exceptions" ticked in VS Code and breaking here is causing some confusion. I've explained the issue here although that's not very visible unless you read the entire thread.

I think that issue should probably be closed (because as far as I can tell everything is working as expected), but since fetching URLs using hostnames is very common I thought it was worth seeing if that code could be altered to not rely on throwing/catching for this flow. While I think users shouldn't generally run with "Break on all exceptions" enabled (the default is "Break on uncaught exceptions"), the less "noise" there is when running in that mode, the easier it'll be to track down actual issues caused by unexpected exceptions being thrown and caught.

@lrhn lrhn added area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io labels May 17, 2023
@devmarwat
Copy link

I am facing the same kind of issue, please seek it out on time.
I have explained my problems in this video 👇👇👇👇👇
https://youtu.be/lRtrcG_Sz8U

@a-siva a-siva added P2 A bug or feature request we're likely to work on cherry-pick-candidate Candidates to be cherry-picked labels May 22, 2023
copybara-service bot pushed a commit that referenced this issue May 22, 2023
Bug:#52423
Change-Id: I3574cf9a33bd72d02a619afcf20a8a6eec835438
Tested: covered by existing tests
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304827
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
@brianquinlan
Copy link
Contributor

A fix is in place. I'll go through the cherrypick process tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. cherry-pick-candidate Candidates to be cherry-picked library-io P2 A bug or feature request we're likely to work on
Projects
None yet
Development

No branches or pull requests

5 participants