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

QHttpAbstractServer does not follow server listen() convention

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 6.0 (Next Major Release)
    • Fix Version/s: None
    • Component/s: Network: HTTP
    • Labels:
      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

        For Gerrit Dashboard: QTBUG-79411
        # Subject Branch Project Status CR V

          Activity

            People

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

              Dates

              • Created:
                Updated:

                Gerrit Reviews

                There is 1 open Gerrit change