Michael Meeks
184dcfa96e
Ctrl-c should really terminate this if you keep going.
2017-03-10 10:47:41 +01:00
Ashod Nakashian
f08d9c9ec1
nb: handle bad requests with 400 response
...
Change-Id: I15ecc06a933a88f5ccdd0acfd16aac8b357f29df
2017-03-10 10:47:41 +01:00
Ashod Nakashian
ccdb1bcc6e
nb: proper POST body processing
...
Change-Id: Ic37094e50979e14d2862ae32088295b42d9c4931
2017-03-10 10:47:41 +01:00
Ashod Nakashian
0c19d81fee
nb: read the socket on accept
...
It's necessary to do the SSL handshake
and to get the request (if we get there)
on accepting so by the time we poll we know
what SSL needs to do next. No reason to
read on first poll when we should be
expecting a request upon connection anyway.
Change-Id: I8eecaad5f8450075d45e487702972418cad125bc
2017-03-10 10:47:41 +01:00
Ashod Nakashian
72669bf929
nb: logging
...
Change-Id: Ia67f746a6c71b4753d04b92472eddf1614c0d337
2017-03-10 10:47:41 +01:00
Ashod Nakashian
57235943c0
nb: ignore empty payloads
...
When the socket is closed the last WS frame
will not have any payload, just a frame.
In this case the socket should still fire
handleMessage so this frame could trigger
application logic, however in this case
ClientSession has nothing to do, so we skip it.
Change-Id: Ia2b13026e31460ffceb8f9d9cfa39d36fbc57146
2017-03-10 10:47:41 +01:00
Michael Meeks
aa0a85c16d
Add debug, and set the 'fin' bit on messages as we send them.
2017-03-10 10:47:41 +01:00
Ashod Nakashian
df45db9da2
nb: shutdown socket after file-serving
...
Change-Id: Ibe0b33f371d46e62637f570265fcdf9c8bf60b2d
2017-03-10 10:47:41 +01:00
Ashod Nakashian
2f2ba870b3
nb: handle socket poll exceptions and remove socket
...
Change-Id: Ibdee316f102d6606c38470e5ccacd2a7bd7ea7ce
2017-03-10 10:47:41 +01:00
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