Opened 4 years ago
Last modified 10 months ago
#16155 new enhancement
BHttpRequest doesn't check for connection before resolving
Reported by: | fatigatti | Owned by: | nobody |
---|---|---|---|
Priority: | normal | Milestone: | Unscheduled |
Component: | Kits/Network Kit | Version: | R1/Development |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Platform: | All |
Description
Currently Haiku's BHttpRequest is not able to check for connection on a specified IP address/port pair before actually resolving the hostname to that pair. That means, if the first server in the DNS response is down or has its port closed for some reason, the request will simply fail.
I've run into this while making some small improvements for the StreamRadio app last year. Basically, a stream address would resolve to two different IPs, and one of them wasn't working. Instead of trying to connect to the next one, BHttpRequest would simply fail. I've tried the same stream on other software (VLC on Windows) and it worked every time.
I asked for advice, and while some people thought that the app itself should take care of this situation, the major part of the responses said that BHttpRequest should handle this better, and @pulkomandy asked me for a bug report.
I did an ugly hack on StreamRadio to make it work, but it doesn't handle HTTPS right. Besides, every application using BHttpRequest will benefit of this (I don't know how WebPositive handles this at the moment, for example).
Change History (2)
comment:1 by , 4 years ago
comment:2 by , 10 months ago
Component: | Network & Internet/IPv4 → Kits/Network Kit |
---|---|
Keywords: | BHttpRequest NetworkKit removed |
Owner: | changed from | to
As a starting point, BNetworkAddress::SetTo only allows to get the first address for a given family from getaddrinfo. BNetworkAddressResolver itself is fine and allows getting all of them.
Then BHttpRequest needs to handle retrying with different addresses until one works, I guess.