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

Writing a deferred http response

    XMLWordPrintable

    Details

    • Type: Suggestion
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Done
    • Affects Version/s: 6.0 (Next Major Release)
    • Fix Version/s: None
    • Component/s: Network: HTTP
    • Labels:
      None

      Description

      Hi.
      I would really love to be able to handle http requests asynchronously from route handler execution.

      httpServer.route("/", [] (const QHttpServerRequest &request) {
          QTimer::singleShot(100, [httpServer, request] () {
              if(httpServer.isValid(request))
                  request.respond("Hello, world.");
          }
      
          return QHttpServer::DeferredResponse;
      });
      

      Basicaly, I'd like to store some context in the route handler, send a queued signal to object in other thread, do something there, return via queued signal back to the http server thread, and, finally, write a response.

      Do you mind telling, if there is a way to modify QHttpServer to make this possible, or do I just stick to QAbstractHttpServer?

      Thanks.

        Attachments

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

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes