Commit Graph

10 Commits

Author SHA1 Message Date
Lucie Gérard 57b0db0896 Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
License files are organized under LICENSES directory.

Pick-to: 6.4
Task-number: QTBUG-67283
Change-Id: I657c36f679b9448ec68d411a492171bc39df1411
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
2022-06-22 17:35:22 +02:00
Maurice Kalinowski 51734cd595 Fix build against 6.0
Fixes: QTBUG-89381
Change-Id: I79d0329f06005434c691416f92fbdac0d7252385
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
2020-12-16 19:10:36 +01:00
Mikhail Svetkin 4b2790aa6d Add cmake support for Qt6/dev branch
Change-Id: Icca0edab01d6028d786b76f99fba388565bd6e76
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-05-05 19:43:56 +02:00
Mikhail Svetkin f46cb8832f Add QHttpServerLiterals
Currently we have a lot of duplication of most common HTTP headers and their
values.
This patch moves them to one place.

Change-Id: Idf9ddc5164e81649b4cc37ed92a516eb1eedab3a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Tasuku Suzuki <tasuku.suzuki@qbc.io>
2019-08-21 22:07:26 +02:00
Mikhail Svetkin 055d36692b QHttpServerResponder: refactor and extend the API
Currently QHttpServerResponder is not flexible enough:
 - Does not allow to rewrite headers
 - Does not allow to write headers without storing them internaly first
 - Does not provide API to make your own HTTP response

This patch will help to implement QHttpServerResponse
setHeaders/addHeaders

Change-Id: If9e21f7f7a58629bfedad0f10cab67d67fce0a89
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-08-20 18:40:26 +02:00
Tasuku Suzuki f72ced1671 Fix tests failure introduced by the mime type detection
Commit 4f64330b39 changes some mime types
of responses to text/plain.
The commit also FIXED the "No newline at end of file" warning in a test
data for QHttpServerResponder.

Change-Id: I9b6b1878a2b61bf80db1e39b81ae75c4cedce615
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-05-09 13:57:18 +00:00
Jesus Fernandez 11fb154a84 Fix several build issues and fix the unit tests
It is required to have continuous integration enabled in the
repository.

Change-Id: I71728a6e89841640e77c50a05cf59f34d697f897
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-02-28 09:47:48 +00:00
Jesus Fernandez fe96330ca0 Fix license headers
Change-Id: Ie15244adb917e2938fe7897c30d4616218d26ac0
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-01-31 11:31:21 +00:00
Mikhail Svetkin 2e7a824526 Refactor QHttpServerResponder::write(QIODevice, ...)
The current implementation has several problems.

1. The function takes an ownership the QIODevice and puts it into a smartpointer.
Also we conntected socket's destroyed signal to lambda which has captured the
smartpointer.
So if responder does not find the file, the smartpointer will
call deleteLater which then will call socket::destroyed and then lambda
will be called and try to access the smartpointer which does not exist
anymore.

2. The function takes an ownership the file(QIODevice)
and puts it into a smartpointer.
Also we conntected the QTemporaryFile's aboutToClose signal to lambda which has captured the
smartpointer.
So when the QTemporaryFile calls destructor it will emit aboutToClose
signal which will call the lambda and this lambda will try to access the smartpointer
which does not exist anymore.

3. If we send a file smaller than chunksize,
IOChunkedTransfer we will never be deleted.

4. Does not check a socket connection type (keep-alive).

5. Does not send anything if file is not found or opened in wrong
mode.

Change-Id: I699e7d5a462c4b8d195908747bf0386132b19973
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
2018-10-04 08:12:29 +00:00
Jesus Fernandez f53818c8ef Introduce QHttpServerResponder
It encapsulates the socket and gives an API to answer the received
requests.

Change-Id: Ic95db2c50224a650a02b206faca9a0ff8d1cc62b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ryan Chu <ryan.chu@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-09-26 12:38:56 +00:00