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

QHttpServer HTTP chunked request body handling

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • None
    • 5.12.2
    • Network
    • None
    • Windows

      Related to QTBUG-60105 (jefernan)

      I have been playing a bit with QHttpServer and noticed that it does not handle the HTTP body correctly, for chunked requests - for example if I send HTTP POST, with body that is just plain binary data, the QHttpServerRequest::body() contains only the last chunk received.

      Just from a quick browse through the code:

      int QHttpServerRequestPrivate::onBody(http_parser *httpParser, const char *at, size_t length)
      {
          qCDebug(lc) << httpParser << QString::fromUtf8(at, int(length));
          auto i = instance(httpParser);
          i->state = State::OnBody;
          i->body = QByteArray(at, int(length));
          return 0;
      }
      

      The code should probably check that part of the body was already received? 

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

            mikhailsvetkin Mikhail Svetkin
            dimitar Dimitar Gospodinov
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes