[Development] QNetworkRequest: allow overriding connect host
Justin Karneges
justin at affinix.com
Fri May 10 04:36:45 CEST 2013
On 05/09/2013 06:44 PM, Thiago Macieira wrote:
> On quinta-feira, 9 de maio de 2013 18.00.36, Justin Karneges wrote:
>>> I understand the feature would be useful in certain conditions, but I'm
>>> not
>>> sure yours is one of them. You can probably just easily override the
>>> QNetworkAccessManager class and do the IP address verification. If it
>>> fails, return a QNetworkReply that indicates the error condition. If it
>>> passes, proceed with the actual QNetworkAccessManager call.
>>
>> Hi Thiago,
>>
>> You're saying to validate the IP address, and if that succeeds then
>> request the original URL? This would work most of the time, but it is
>> not airtight. The domain could end up resolving somewhere else after the
>> check succeeds.
>
> QHostInfo has a short-lived cache, so it should work.
Mmmm, if QHostInfo's cache behaves like any other DNS cache then I don't
see this making a difference. Unless every cache hit causes the cache
time to extend, there's always a chance for expiration between two resolves.
Also, I'm not using QHostInfo, but rather my own resolver JDNS, because
I want the resolutions to be event-driven.
Justin
More information about the Development
mailing list