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

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 4 Jul 2016, 14:53 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! :)

    K 1 Reply Last reply 4 Jul 2016, 17:09
    0
    • D DonRico
      4 Jul 2016, 14:53

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

      K Offline
      K Offline
      kshegunov
      Moderators
      wrote on 4 Jul 2016, 17:09 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 4 Jul 2016, 18:00
      0
      • K kshegunov
        4 Jul 2016, 17:09

        @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 4 Jul 2016, 18:00 last edited by
        #3

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

        K 1 Reply Last reply 4 Jul 2016, 18:12
        0
        • D DonRico
          4 Jul 2016, 18:00

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

          K Offline
          K Offline
          kshegunov
          Moderators
          wrote on 4 Jul 2016, 18:12 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 5 Jul 2016, 10:59
          0
          • K kshegunov
            4 Jul 2016, 18:12

            @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 5 Jul 2016, 10:59 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

            K 1 Reply Last reply 5 Jul 2016, 11:35
            0
            • D DonRico
              5 Jul 2016, 10:59

              @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

              K Offline
              K Offline
              kshegunov
              Moderators
              wrote on 5 Jul 2016, 11:35 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 5 Jul 2016, 13:05
              1
              • K kshegunov
                5 Jul 2016, 11:35

                @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 5 Jul 2016, 13:05 last edited by
                #7

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

                1 Reply Last reply
                0

                6/7

                5 Jul 2016, 11:35

                • Login

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