Reduce the uses of MOBILEAPP conditionals by using the isMobileApp
function.
Signed-off-by: Jaume Pujantell <jaume.pujantell@collabora.com>
Change-Id: If541307fbc457b342674cc560b6c53454f3904cf
Replace a few cases of Util::toString(...), too.
Signed-off-by: Aron Budea <aron.budea@collabora.com>
Change-Id: I53c5dbbdf2f60710e94add9dd137aa9becb7bd3e
config.h should be included as the 1st line in each source file.
It should not be included in headers.
config_version.h which changes on every commit should not be
included widely - so remove it from the HttpRequest heeader to
save tinderbox's ccache.
Fetch version info from helper methods rather than in-lining via
defines, to better encapsulate.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: If449a36f1ac61940f04d70d5f4180db389d9b4c4
Still needed to add a bunch of #if !MOBILAPP to disable all of the
Online server's unit testing classes so that the iOS app won't crash
when opening a document.
TODO: the iOS app will not accept text input at all. Is some code
unexpectedly consuming message data sent over the mobile fake socket?
Signed-off-by: Patrick Luby <plubius@neooffice.org>
Change-Id: Ie874ee8e452188a7b4cdf6d5f87708e5ed9b0235
We use our own status codes, which
are type-safe and use streaming
operators to serialize and log.
Change-Id: I0eba7b16694866b5a79476a7ef4b1b78f7f9c176
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This is really a garbage in -> garbage out situation.
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Ic1c33f44081f259e5cf5994ad901e1593fe8dfcf
Given that "digit" is always less than 16, we can avoid the "- digit"
in the condition (because the division turns that into 0 anyway), making
it effectively constexpr.
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Iaf9e53d3543f2237c00768f214114a02a4746020
We currently only recognize HTTP/x.y. Anything
else is invalid.
Change-Id: I45fa7e33052e3847b8a2d9768b12d8eac43f6b0a
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Setting the state to Error in the parser has the
unwanted side-effect of not triggering the proper
callbacks. The better design is to observe the API
and return error (-1) upon hitting parsing errors.
The caller will then invoke the finishing function
that sets the state and triggers the callbacks.
Change-Id: I4957b0fb431f477d71fb21a8dd601d132c3d6a21
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
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
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
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>
Previously, we were parsing the Status Line
and the header, both together. This of course
doesn't work when we had removed the Status
Line already. This wasn't an issue in parsing
responses from servers, but doesn't work when
parsing requests from clients (i.e. in a server).
Also, it's simpler.
Tests extended accordingly.
Change-Id: Id1c9a6385080c86b6072130fa8a169a699c42462
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>
And guard http data dumping with debug directives.
Change-Id: I22a725ba49bfb0399a27889ce9732dfe061e2563
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Limit its length, we know the version length anyway.
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I0db2b9227baf3e10055082ad394c0f555b9898e1
This implements HTTP/1.1 per RFC 7230, partially.
Unit-tests are provided with documentation on usage.
This is desgined to serve as the http implementation
throughout loolwsd, for both synchronous and
asynchronous requests.
Change-Id: Iaf1b8c5fcb8cec032445e27c9f70d2fb807aa4dc
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>