Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-13464

QUrl::setHost() does not escape the IPv6 address before re-inserting it back into QUrl string

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Out of scope
    • Icon: P4: Low P4: Low
    • 4.8.x
    • 4.7.0, 4.8.x
    • Network
    • None
    • a91a9d014adaeaa58640641579e30b5ff2383e99

      QUrl::host() returns an unescapped (ie. unencoded) IPv6 address literal, as it should.
      QUrl::setHost() does not escape the IPv6 address before re-inserting it back into QUrl string.

      int main()
      {
              QUrl u( "http://[::1]:8080/test" );
              qDebug( "1. host: %s", qPrintable( u.host()));
              qDebug( "1. url: %s", qPrintable( u.toString()));
      
              u.setHost( u.host());
              qDebug( "2. host: %s", qPrintable( u.host()));
              qDebug( "2. url: %s", qPrintable( u.toString()));
      
              u = QUrl( u.toString());
              qDebug( "3. host: %s", qPrintable( u.host()));
              qDebug( "3. url: %s", qPrintable( u.toString()));
              return 0;
      }
      

      returns,

      1. host: ::1
      1. url: http://[::1]:8080/test
      2. host: ::1
      2. url: http://::1:8080/test
      3. host: 
      3. url: 
      

        1. qurl.diff
          0.6 kB
          Adam Majer
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            thiago Thiago Macieira
            adamm Adam Majer
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes