diff options
| author | Mikhail Svetkin <mikhail.svetkin@qt.io> | 2019-03-30 12:48:47 +0300 |
|---|---|---|
| committer | Jesus Fernandez <Jesus.Fernandez@qt.io> | 2019-04-03 15:26:38 +0000 |
| commit | 6f7e8d28b46dea47c9179f4a69bc693e844f4d1b (patch) | |
| tree | 24d592e92b0fa92dd0b5b51521dc0f3f4e93b1f1 /src/httpserver/qhttpserverrequest.cpp | |
| parent | 5ad0dd40505f93f0c7cec17adebfd3bcaf9ee3a8 (diff) | |
Fix HTTP chunked request body handling
Task: QTBUG-74843
Change-Id: I4978c80195246c99a5e6d1e608b3980f56b39207
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Diffstat (limited to 'src/httpserver/qhttpserverrequest.cpp')
| -rw-r--r-- | src/httpserver/qhttpserverrequest.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/httpserver/qhttpserverrequest.cpp b/src/httpserver/qhttpserverrequest.cpp index f48864b..f6c52dd 100644 --- a/src/httpserver/qhttpserverrequest.cpp +++ b/src/httpserver/qhttpserverrequest.cpp @@ -209,7 +209,13 @@ int QHttpServerRequestPrivate::onBody(http_parser *httpParser, const char *at, s qCDebug(lc) << httpParser << QString::fromUtf8(at, int(length)); auto i = instance(httpParser); i->state = State::OnBody; - i->body = QByteArray(at, int(length)); + if (i->body.isEmpty()) { + i->body.reserve( + static_cast<int>(httpParser->content_length) + + static_cast<int>(length)); + } + + i->body.append(at, int(length)); return 0; } |
