Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QUrl changed/odd behaviour
We recently moved our project from 4.8 to 5.6 and we discovered that our pseudo urls( i.e. something://1234 ) stopped working. I identified that it was caused by QUrl change that automatically now tries to convert any numerical hostname to quad doted ipv4 address so https://5123 will be https://0.0.20.3.
I tried to find some information about that change or that behaviour but there's nothing. Should this be considered as bug or unexpected feature? This is quite annoying one since there no convenient method to convert it back.
Thanks for thinking along! :)
Should this be considered as bug or unexpected feature?
You had relied on an implementation detail, and since the implementation has changed your code doesn't work. Your code not working, although you find it annoying, is neither a bug in
QUrlnor unexpected consequence.
@kshegunov Well that blows, but I guess I'll have to deal with it.
Perhaps you could try adding a few letters to the mix, so
QUrlis fooled into thinking it's a hostname again?
@kshegunov That idea crossed my mind but in that case older data wouldn't still work since that whole source comes from DB and is not dynamically composed. Another painful way would be to use **InetPton/inet_pton ** and transform it back to original number but I didn't have any success implenting it yeasterday. https://msdn.microsoft.com/en-us/library/windows/desktop/cc805843(v=vs.85).aspx?f=255&MSPPError=-2147217396
Another painful way would be to use **InetPton/inet_pton ** and transform it back to original number but I didn't have any success implenting it yeasterday.
What's the reason to use this exactly? You should know how numerical systems work, right? So you have a number that has 4 digits in a numerical system with base 256 (this is what the IPv4 is). The conversion to decimal is trivial:
0.0.20.3 => 0 * 256^3 + 0 * 256^2 + 20*256 + 3 = 5123
@kshegunov I guess this wasn't my birghtest moent. Thanks for directing me. Problem solved.