Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QUrl changed/odd behaviour
QtWS25 Last Chance

QUrl changed/odd behaviour

Scheduled Pinned Locked Moved Solved General and Desktop
qurl
7 Posts 2 Posters 1.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DonRico
    wrote on last edited by
    #1

    Hi

    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! :)

    kshegunovK 1 Reply Last reply
    0
    • D DonRico

      Hi

      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! :)

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by
      #2

      @DonRico
      Hello,

      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 QUrl nor unexpected consequence.

      Kind regards.

      Read and abide by the Qt Code of Conduct

      D 1 Reply Last reply
      0
      • kshegunovK kshegunov

        @DonRico
        Hello,

        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 QUrl nor unexpected consequence.

        Kind regards.

        D Offline
        D Offline
        DonRico
        wrote on last edited by
        #3

        @kshegunov Well that blows, but I guess I'll have to deal with it.

        kshegunovK 1 Reply Last reply
        0
        • D DonRico

          @kshegunov Well that blows, but I guess I'll have to deal with it.

          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by
          #4

          @DonRico
          Perhaps you could try adding a few letters to the mix, so QUrl is fooled into thinking it's a hostname again?

          Read and abide by the Qt Code of Conduct

          D 1 Reply Last reply
          0
          • kshegunovK kshegunov

            @DonRico
            Perhaps you could try adding a few letters to the mix, so QUrl is fooled into thinking it's a hostname again?

            D Offline
            D Offline
            DonRico
            wrote on last edited by
            #5

            @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

            kshegunovK 1 Reply Last reply
            0
            • D DonRico

              @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

              kshegunovK Offline
              kshegunovK Offline
              kshegunov
              Moderators
              wrote on last edited by
              #6

              @DonRico said:

              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
              

              (here ^ denotes power)

              Kind regards.

              Read and abide by the Qt Code of Conduct

              D 1 Reply Last reply
              1
              • kshegunovK kshegunov

                @DonRico said:

                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
                

                (here ^ denotes power)

                Kind regards.

                D Offline
                D Offline
                DonRico
                wrote on last edited by
                #7

                @kshegunov I guess this wasn't my birghtest moent. Thanks for directing me. Problem solved.

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved