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

QHttpAbstractServer does not follow server listen() convention

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 6.4.0 Beta1
    • 6.0
    • Network: HTTP
    • None

    Description

      I don't think QAbstractHttpServer::listen() returning the port or -1 on failure is a good idea. QTcpServer sets precedent and QWebSockerServer, QSctpServer follow, where listen() is a bool:
      bool QTcpServer::listen(const QHostAddress &address = QHostAddress::Any, quint16 port = 0);
      quint16 QTcpServer::serverPort() const;

      I'd expect the convention to be followed? It's going to mess me up if I have to check for -1 return on some listens() and not others. For example:

      if (server.listen(8080)) {
      // I expect to be listening
      }
      

      Will execute as expected for all but the HTTP servers, but will still execute as success when QAbstractHttpServer returns -1 when it actually failed.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            mikhailsvetkin Mikhail Svetkin
            jasonapk Jason Hihn
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes