Seems like this was a bug in clang-format
that is fixed in clang-12.
Change-Id: I8144179d2b290f5d875af41dbd44dedcf4152639
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Instead of supporting char appending,
we now support appending literal strings
with size capturing. This covers both
single- and multi-character appending
without the need for an explicit size.
Change-Id: Iee2c20b7aa2cdb6863c88e91cd770205719c2ba6
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 96e3e88a014960a5249fc83a5b2f3b785ac8737d)
net/HttpRequest.cpp:126:19: error: declaration of 'end' shadows a member of 'this' [-Werror=shadow]
kit/Kit.cpp:163:29: error: missing initializer for member 'statfs::f_bsize' [-Werror=missing-field-initializers]
kit/Kit.cpp:171:14: error: 'OVERLAYFS_SUPER_MAGIC' was not declared in this scope
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Ibbd35ab5af3adad403ed22a0aeb70917b9e21970
When writing to the socket, it's always more efficient
to fill the buffer up to the hardware limit for each
write. This is doubly important for efficiency with
SSL, due to the overhead of encrypting multiple
small buffers instead of one large one.
Currently we don't write more than one message
at a time, primarily due to limitations in
the Poco sockets in the unit-tests, which
have a hard time consuming multiple WS frames
with a single poll (subsequent calls to poll
doesn't enter signalled state until new data
arrives, possibly because the data is read and
buffered internally, making the whole scheme
of using poll unreliable and meaningless).
Change-Id: Ic2e2cf1babfb5ab4116efd93f392977ba234d92b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
And remove the httpheader one, which is not useful, since it uses Poco
for the actual parsing, it did not find anything. (If we switch away
from Poco there in the future, it's easy enough to restore it.)
Also fix some problems found by the fuzzer.
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I254247c46ecc78c9c3e75aac4f10c441b0e10fb3
According to the RFC, HTTP/1.1 assumes persistent
connection unless the client or server sends
'Connection: close' header. See
https://tools.ietf.org/html/rfc7230#section-6.3
Now we fully support disconnecting when we
get this header, which is important for when
reusing the same http::Session (we need to
reconnect in such a case).
Change-Id: Ib278eff21be32c1414478296e90e2e807ab24132
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Since the return value of syncRequest and syncDownload
was derived from Response anyway, there is no reason
to have multiple values for callers to look at.
This simplifies the API.
Change-Id: I0f136e515dd0ef6eda84f6a7cd662b260809d2f1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Improved handling of http::Request and http::Response
in Socket directly with better error handling and
automatic socket shutdown on error.
We shouldn't need to manually serialize into the
socket's buffer when sending a Request or Response.
Change-Id: I6dfcd2fe4f6b88cd2fa8c749045ce25a8c52fe9a
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
A full URI with scheme can now be used to
create http::Session instances.
Change-Id: I3e556e3e1aa247ccb93749d9bd6736a15290f442
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
It's now possible to set a body in http::Response
and it will get serialized out with the header.
Change-Id: If0f01a226bbd7b5ab092d0a246c8b46553a107e0
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
When config.h is not included, the build
configuration is missing from the translation
unit in question. This affects ENABLE_SSL,
for one.
Also, HttpRequest.hpp depends on LOOLWSD_VERSION,
which is defined in config.h.
The config.h header must be included in all
trasnlation-units, and must be the first include.
This is to avoid conflicts and/or mismatching
binaries built with different compile-time values.
We also statically assert if LOOLWSD_VERSION
is not defined, to help the error message.
Change-Id: Ic4b45de879f3360a07e9507fdf04abfa4cec6a71
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
And explain the use of linear search in header().
Change-Id: If6c39bffa738861d0c86684f9560ed6e4a6970e1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
User-Agent is designed for client-side use only,
in http requests. For servers, the Server header
is designed to announce the server name and version.
This tries to normalize the use and documents
the proper intent and usage.
Change-Id: I42d68d65611cab64c45adf03fe74f9466798b093
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This adds writeData() member to write into the output
buffer of the socket directly, instead of serializing
into a string and then copying it over to the buffer.
Change-Id: I42aaa23e96a6120c738bc0bb36bc01f4ed5e70c5
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Here we are more tolerant with regards to the
minimum Status Line length, since a Reason
Phrase is informative and might be omitted.
While technically it should be provided, per
the RFC, we shouldn't break when it's missing.
Change-Id: Ic702db61e5bf4272e18f09d127405033277e5943
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This adds support to parse client request
on the server side.
Unit-tests included.
Change-Id: I90e9ad3007a3215682991fd2383362e1c48589a8
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This converts Poco to http::Request in sync mode,
thereby not changing functionality. In a follow-up,
this will be converted to async.
Change-Id: Ifbecd44ff599394799c1131470d77f803ed8cc45
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>