Commit graph

5051 commits

Author SHA1 Message Date
Ashod Nakashian
925934d09d nb: set the Date in http header
Change-Id: I71e3388c1f204135c6dc72ad27890bffe53792b3
2017-03-10 10:47:41 +01:00
Ashod Nakashian
0759d1afbc nb: http error cases in file server
Change-Id: I81b0ef3f080ba61836d99fbdde0fb94e1a44a625
2017-03-10 10:47:41 +01:00
Ashod Nakashian
1bb29282f1 nb: serve files using non-blocking sockets
Change-Id: I254288980f72f197d29b7b57ec9c88a01a5a1d03
2017-03-10 10:47:40 +01:00
Ashod Nakashian
ba8d3c8eb1 nb: log requests as debug and not error
Change-Id: Ic3ec3257f98c80e959c9d980fe6b1d8d6f40f604
2017-03-10 10:47:40 +01:00
Ashod Nakashian
784dd41eae nb: simplify WS sendMessage interface
No need to construct vector<char> where
a simple char*/size_t suffice.

Change-Id: Ic70ad65a2078a1f653695504a79532f7831d88be
2017-03-10 10:47:40 +01:00
Ashod Nakashian
70b5aad1a6 nb: for now disable the broken WS tests
Change-Id: I2fdb5ce976f0c29a89fbcaa4e25a14c73644dd83
2017-03-10 10:47:40 +01:00
Ashod Nakashian
c8619bed1f nb: respond with HTTP 200 on root
Change-Id: Icfcf8d79d5b6370b7965584e89e9006d7bd451b3
2017-03-10 10:47:40 +01:00
Ashod Nakashian
de92b1627e nb: send files over HTTP
Change-Id: I346e97cd19a8dbbdee493d23b89c390ea6e3c948
2017-03-10 10:47:40 +01:00
Ashod Nakashian
0d9bbac18c nb: serve wopi discovery XML
Change-Id: I7bb4910f948e8b4e89f3bbdf2a62a8b1540eef2f
2017-03-10 10:47:40 +01:00
Ashod Nakashian
9bf8720d2b nb: SSL socket support in wsd
Change-Id: I21e8b2d04caf7da872fe07b4950b02a8c52a3552
2017-03-10 10:47:40 +01:00
Ashod Nakashian
d488efd3b7 nb: move openssl-specific struct to avoid conflicts
Change-Id: I4cf4ceb5b9ae1748f5087d4884dc40c280f5a00c
2017-03-10 10:47:40 +01:00
Ashod Nakashian
e184a371a0 nb: write socket buffer to socket safely
Since a socket client can push data into
the socket in a different thread than the one
polling (indeed that's the only possible scenario),
the write buffer must be protected by a lock.

On the other hand, the read buffer is always
invoked from a single thread, the polling. So
it is perfectly safe without locks.

Change-Id: Id0b6a01f8e96124a299810f0aacab9cecd1ff979
2017-03-10 10:47:40 +01:00
Ashod Nakashian
c2444bba9e nb: more informative WebSocket message logging
Change-Id: I3229a98dcefc115fe1b730b57fcac71aeb868aad
2017-03-10 10:47:40 +01:00
Ashod Nakashian
fdc658845d nb: always call onDisconnected when socket is closed
Change-Id: Ib42354fd1e8c68e78c6e5c501802a0e145b39260
2017-03-10 10:47:40 +01:00
Ashod Nakashian
2b4e7bd067 nb: SocketHandlerInterface must hold weak_ptr to Socket
Because the socket can be freed while a separate
thread is sending data via the handler, we must
have a locked reference to the socket instance
in the handler.

Change-Id: Iefad3fc2b147f96b8d538d9edd7cac3fce25b5bf
2017-03-10 10:47:40 +01:00
Ashod Nakashian
3b68944226 nb: socket logging
Change-Id: I1ee80eea39b7e910acf4ef0d12ea8aa436937041
2017-03-10 10:47:40 +01:00
Ashod Nakashian
46ccfb165f nb: testLoad -> testLoadSimple
Change-Id: Ief4292f3c7bf8cd6866a83518998d250ebc03355
2017-03-10 10:47:40 +01:00
Ashod Nakashian
576bd3ab4d nb: write WS frame to socket
We need to flush writes to socket as soon as
ready to either send or, if buffers are full,
to poll for write.

With WebSocket we do this after writing a frame.

Change-Id: I1bc276e678375a84079e69624414a16271f25351
2017-03-10 10:47:40 +01:00
Ashod Nakashian
9efb14def7 nb: pass the WS frame type explicitly
Change-Id: Iaf4d832af4313b629701c7f07832dcaaf3e53c20
2017-03-10 10:47:40 +01:00
Ashod Nakashian
32b7d5ceee nb: WebSocketSender used to send back loading progress
Change-Id: I3b09c44c4d64db39217d364ebff0a647a82457f4
2017-03-10 10:47:40 +01:00
Ashod Nakashian
5b944cf99b nb: don't own your owner
Change-Id: Ia74dbd3441b8b1f682091ba3d973dd33b2599309
2017-03-10 10:47:40 +01:00
Ashod Nakashian
66bc78aa33 nb: differentiate between incomplete request and processing failure
Change-Id: Ieffae987c9008a92d8040f0c4315afe6625715c4
2017-03-10 10:47:40 +01:00
Ashod Nakashian
221059cd6b nb: move WebSocket upgrade to the ClientRequestDispatcher
Change-Id: Id11b139563a55e50d3f7e216e2231d79e07015b3
2017-03-10 10:47:40 +01:00
Ashod Nakashian
73f9001004 nb: remove HTTP handling from WebSocketHandler
WebSocketHandler now supports upgrading given
the original HTTP header.

Change-Id: Ifb3b8fee9aef8015548a625bbb88e75f4e97255f
2017-03-10 10:47:40 +01:00
Ashod Nakashian
6b28ea0c12 nb: autosave document on client disconnection
Change-Id: Ic75a9796a1cca0bf919fb2dcbe24c504e447e7f1
2017-03-10 10:47:40 +01:00
Ashod Nakashian
3b3b61af30 nb: create and assign ClientSession to DocumentBroker
Change-Id: I684007363de6e25d78f9f1c9236fd623325da509
2017-03-10 10:47:40 +01:00
Ashod Nakashian
3cff4f69c5 nb: find existing DocumentBroker or create a new one
Change-Id: I4e15254a90bc00a77341e8dd85353aa5d68a14e0
2017-03-10 10:47:40 +01:00
Ashod Nakashian
e89e5fb978 nb: create DocumentBroker and attach to ChildProcess
Change-Id: I751ac0b7599400fc9527455f95361cea447d0c69
2017-03-10 10:47:40 +01:00
Ashod Nakashian
1d47d3af8d nb: client request handler outline
Change-Id: I40d403099c7150c5d6365399adbd05ff2c7c386b
2017-03-10 10:47:40 +01:00
Ashod Nakashian
e047f55e3c nb: SessionID and connection throttling support
Change-Id: Ifb871ed42d314038e17d02512c8f3c31c1ab54ad
2017-03-10 10:47:39 +01:00
Ashod Nakashian
7fdb7a1861 nb: StreamSocket takes ownership of SocketHandler instance
Change-Id: Ica99dc8afbcca71c8d79eecb276ba19f6f01fa57
2017-03-10 10:47:39 +01:00
Ashod Nakashian
d9394d7000 nb: Our SSL manager conflicts with Poco's
Change-Id: Ieed6eecabc60997b73636ab6c13bc5ca3682008a
2017-03-10 10:47:39 +01:00
Ashod Nakashian
5e79581952 nb: StreamSocket must always have a handler
And also emits disonnection event.

Change-Id: Ibb60c6fca55c58b886f5ff77c6e22769a128e950
2017-03-10 10:47:39 +01:00
Ashod Nakashian
6d244129b3 nb: more request type handlers
Change-Id: I89ee4d6bf675d2e945199ed63a115f031aec580f
2017-03-10 10:47:39 +01:00
Ashod Nakashian
6dc884160b nb: add ClientSession handler
Change-Id: I5ed2003f07bb5173ea37420d4939cc93b1aef1d8
2017-03-10 10:47:39 +01:00
Ashod Nakashian
3602526f5b nb: add request-specific handlers
Change-Id: I219fc9ef23c6c9e646dd609bb3ece2607ca78828
2017-03-10 10:47:39 +01:00
Ashod Nakashian
d9d6bfdb80 nb: new ClientRequestDispatcher added
Requests need to be introspected and
dispatched to the appropriate handler.

File serving, admin, POST request, etc.
are all valid types that we need to support.

But of course the primary one is the WS request
to load to and interact with a document.

Change-Id: Id2c3214deb6b54b06b2735ec3370f09ed7a1ae51
2017-03-10 10:47:39 +01:00
Ashod Nakashian
510c499e70 nb: stop server threads on termination flag
Change-Id: I2eb0bed49b289b96c4c82687ee7b949c3162de31
2017-03-10 10:47:39 +01:00
Ashod Nakashian
2e651f4199 nb: cout -> logger
Change-Id: I44c6d83efc7aef50cb793fc6e88da32e73797c74
2017-03-10 10:47:39 +01:00
Ashod Nakashian
607f7214ba nb: simplify hardcoded test document path
Change-Id: I0e5a078401d4b0be7a2504c5a1a3909ef287d198
2017-03-10 10:47:39 +01:00
Ashod Nakashian
c6fe2452cf nb: take DockBrokers lock where required
Change-Id: I26a1a7f07b4f902dd9f7bbe7bf5eb2571a57099b
2017-03-10 10:47:39 +01:00
Michael Meeks
37e9b25882 Add thread-safe cross-thread callbacks, split out wakeup and simplify 2017-03-10 10:47:39 +01:00
Michael Meeks
2a5823557e Add initial support for socket timeouts. 2017-03-10 10:47:39 +01:00
Michael Meeks
3e9f05d071 Use pseudo-random-ness in test to make strace cleaner. 2017-03-10 10:47:39 +01:00
Jan Holesovsky
a1a46c240e nb: Use the non-blocking socket in the loolwsd.
This so far only builds, but I did not even try to run it yet.

Change-Id: Iceacb5fc5c8994726508e8ea00bd495d758391a8
2017-03-10 10:47:39 +01:00
Jan Holesovsky
ba9239441b nb: Comment out the POCO server in loolwsd.
Change-Id: Ie4f276a6f1c8f3d132b23bb2111466b38f4fb581
2017-03-10 10:47:39 +01:00
Jan Holesovsky
0696082653 Clarify the PrisonerRequestHandler documentation.
Change-Id: Ie3750b17ce4f2d99b80f39f3c0e1374f3e9c1a5a
2017-03-10 10:47:39 +01:00
Michael Meeks
5b7e12c16e Cleanup logging, and add message tracing / dumper. 2017-03-10 10:47:39 +01:00
Jan Holesovsky
205a1453d3 nb: Moved the WebSocketHandler to an own header & cpp.
The cpp is there to keep the header free from the POCO dependency.

Change-Id: I2202c4ed403084ec1ed40001e10b1ec4fc226f7b
2017-03-10 10:47:39 +01:00
Jan Holesovsky
a2d457d778 nb: Abstract WebSocketHandler.
We don't need a special "WebSocket" class, as websocket itself is just an
upgrade of an existing socket / connection, and trying to come up with a
concept where a Socket class magically upgrades to a WebSocket class would be
messy.

So let's have just a WebSocketHandler, that communicates over a StreamSocket
or SslStreamSocket, and be done with that :-)

Change-Id: I449e4d662fbe2c5b1789e308053e4a71376fe481
2017-03-10 10:47:39 +01:00