this prevents compile error with gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12)
../net/HttpRequest.cpp:340:9: error: assuming signed overflow does not occur when assuming that (X + c) >= X is always true [-Werror=strict-overflow]
if (off + VersionLen >= available)
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I46df5d43d0997f6a1e61c05a4df7f9d71af65511
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>
Since it's most efficent to send full blocks at
once (especially so when SSL encryption is done),
we now perform write when the buffer has fewer
than the send-buffer-size bytes. Previously,
we were only getting more data to write to the
socket when the buffer was completely empty,
potentially wasting valuable opportunity to
write more data to the socket while we're at it.
Change-Id: I69a18a042dc2e551ebc5e1af40dae091da3f3d13
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
SocketPoll is captured as weak_ptr into
WebSocketSession and a much better shutdown
support is now available. The new logic
can do async-shutdown after flushing and
will do sync-shutdown if SocketPoll is
no longer around.
Change-Id: Ia206cab58a13f20f7aeb3a6d8c57afee731c8231
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
std::atoi() assumes a null-terminated string and our strings are not
always null-terminated. So add a version that takes a length parameter,
this way we don't have to copy strings around.
Also switch to this in http::StatusLine::parse().
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I449b356c1b9948c562434618596e8e3b38656088
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
And fix an unhandled std::length_error it found.
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I571cdd71caeda84820f2c64088966936637ce2bf
This makes it simpler to call poll repeatedly
within a given timeout, by first calculating
the deadline and passing it to poll to handle
the math.
Change-Id: I7a9311286ec368c853de40f10523b7b98c8f8106
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Useful for debugging, especially for unit-tests.
Change-Id: I820e584203a643a396d26c8817b9af1e750232c7
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Now that the WebSocket functionality is available in
WebSocketHandler, we can cleanup Socket.
Change-Id: Ia3703ab5a2f00fb835eb80493bc400a91dabefad
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
A utility class to create a WebSocket connection based
on WebSocketHandler, http::Request, and SocketPoll.
Change-Id: I00dfd6fc88e210860e0e378587ef1c0a0a65bb5c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This adds support to Web-Socket upgrade handshake
validation. We never had a proper client-side
Web-Socket, so never needed this.
Change-Id: If4b8e42daeab13a430179128750f6a4f17452f28
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This simply reduces the public surface area
of the WebSocketHandler class.
Change-Id: I93be58923f429bceab74a9e239ad0fad11390449
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>