213 Commits

Author SHA1 Message Date
Fred Nicolson
00f13e41e7
Added the ability to set write timeouts
Similar to read timeouts.
2019-04-02 10:34:31 +01:00
Fred Nicolson
6814219cbb
Bug fixes. fr::Socket::send_raw now behaves like receive_raw.
Added missing virtual destructors in abstract classes.
2019-03-21 16:24:22 +00:00
Fred Nicolson
7343529302 Add support for extracting std::vector<bool> from packets 2019-01-17 11:51:18 +00:00
Fred Nicolson
2c771fa46e Disable copying/moving of SSLContext 2019-01-15 13:12:16 +00:00
Fred Nicolson
992fbc885e Added NoRouteToHost error. Fixed Disconnect not being returned by Socket 2019-01-15 11:09:11 +00:00
Fred Nicolson
d53cc86fb9 Fixed Windows build 2019-01-14 15:57:39 +00:00
Fred Nicolson
1ccde3f324 Fix tests 2019-01-14 13:38:35 +00:00
Fred Nicolson
16ee36f5d2 Merge remote-tracking branch 'origin/master' 2019-01-14 13:33:12 +00:00
Fred Nicolson
cb532d41b2 Improvements to error reporting 2019-01-14 13:33:08 +00:00
Fred Nicolson
0610ccec2f
Don't build concurrent HTTP example on Windows 2018-12-13 15:52:40 +00:00
Fred Nicolson
16bb072c12 Remove unused variable from HttpRequest. Remove redundant noexcept. 2018-12-11 16:02:42 +00:00
Fred Nicolson
8ee8e264b9
Remove Opaque object on failure to add to EPOLL
delete shouldn't have been used.
2018-11-28 21:51:22 +00:00
Fred Nicolson
094c211f7f Better Concurrent HTTP Server example 2018-11-28 13:44:44 +00:00
Fred Nicolson
60316be04c Fix Windows build error 2018-11-28 13:32:41 +00:00
Fred Nicolson
8ea8eafdd8 SocketSelector fixes. Set SO_REUSEPORT. 2018-11-28 13:21:50 +00:00
Fred Nicolson
87f8ee21b1 Fix missing \r after Connection:keep-alive header in HTTP requests 2018-11-26 16:40:18 +00:00
Fred Nicolson
dd1322385b Return opaque data when socket is removed 2018-11-23 15:59:53 +00:00
Fred Nicolson
dc247c556d Fix fr::Socket receive_all bug
Introduced with disconnect tweaking a few days ago.
2018-11-19 17:01:57 +00:00
Fred Nicolson
697573cbaf Don't throw an exception if epoll_wait is interrupted 2018-11-19 16:02:07 +00:00
Fred Nicolson
252a4788b5 Added ability to set/get HTTP response/request version
+ Additional tests
2018-11-19 15:23:10 +00:00
Fred Nicolson
9b22eb4604 SocketSelector bug fixes. Don't disconnect socket on read/write error. 2018-11-16 16:45:18 +00:00
Fred Nicolson
4377dcc66e Use working version of gtest 2018-10-25 10:57:04 +01:00
Fred Nicolson
5aecba03ef URL Parse fix 2018-10-25 10:41:21 +01:00
Fred Nicolson
f26225946c Fix cmake 2018-10-01 15:40:55 +01:00
Fred Nicolson
0ae3887d28 Merge remote-tracking branch 'origin/master' 2018-10-01 15:36:18 +01:00
Fred Nicolson
322f53841b Removed SocketReactor. Switched SocketSelector implementation to EPOLL
Should result in better performance, although a Windows implementation is not yet ready.
2018-10-01 15:36:13 +01:00
Fred Nicolson
6f80a61d92
Update LICENSE.md 2018-08-22 20:38:35 +01:00
Fred Nicolson
f5d8dd201b Add additional fr::Packet utility functions. Fixed some build warnings.
Fixed some sign comparison warnings.

Added utility functions to fr::Packet's for:

Getting read cursor position.
Relative read cursor seeking.
Asserting that data remains in the packet
Getting the amount of data remaining
Getting the size of the packet
2018-08-22 16:18:11 +01:00
Fred Nicolson
257e918646 Fix Windows build error 2018-08-16 11:42:22 +01:00
Fred Nicolson
6a0cf23519 Don't reconfigure socket if not connected 2018-08-16 11:37:48 +01:00
Fred Nicolson
8a4ee937b1 Added ability to set/get recv timeouts. Fixed HTTP receive bug.
Recv timeouts can now be specified for sockets, which is the maximum amount of time to wait before returning during a receive. They will return WouldBlock if no data was received during the wait time.

Receiving a HTTP request in non-blocking mode will no longer fail.
2018-08-16 11:24:52 +01:00
Fred Nicolson
decb0b10f9 Fixed broken get_remote_address() for sockets accepted over SSL
+ A few other correctness fixes.
2018-08-13 12:35:52 +01:00
Fred Nicolson
db738e9503 Bug fixes
Added missing move/copy constructor deletors to SSLSocket, to prevent the object from becoming invalid.

Removed noexcept specifier from some constructors where valid exceptions can be thrown.

Exceptions are now thrown from the SSLSocket constructor if it fails to initialise properly, rather than printing something out to stderr and continuing.
2018-08-08 11:04:23 +01:00
Fred Nicolson
3f1deb427e
Update CMakeLists.txt 2018-07-12 12:41:34 +01:00
Fred Nicolson
248e0a8a2a Tweak build file to remove output postfixes, and specify optimisation level 2018-07-12 12:32:49 +01:00
Fred Nicolson
5a790e4caa Added version file. Moved things into correct namespace.
Added version file for getting library info.

Some stuff, like Base64/Sha1 wasn't in the fr namespace. Has been moved into it.
2018-07-12 12:10:55 +01:00
Fred Nicolson
fb28a03c2b Fixed Windows connect() bug for TcpSocket
The socket is put into non-blocking mode prior to connecting. Previously, errno was being checked after connecting to see if the socket would block. This is the correct behaviour on Linux. On Windows however, errno remains 0, and WSAGetLastError() needs to be compared against WSAEWOULDBLOCK instead.
2018-07-12 11:46:59 +01:00
Fred Nicolson
4dec5318f7 Added support for std::map/std::unordered_map to fr::Packet 2018-06-22 09:22:27 +01:00
Fred Nicolson
20a3bd97d8 Fixed Windows build warnings 2018-06-18 10:27:43 +01:00
Unknown
79d2037bc4 Moving network encoding functions into the fr namespace
To prevent collision with msvc.
2018-04-11 19:36:18 +01:00
Fred Nicolson
0f14184bf6 Fixing compile errors on the MSVC compiler 2018-04-10 17:26:14 +01:00
Fred Nicolson
bdc7235246 Fixed compile errors when building with MinGW on Windows 2018-03-28 10:37:04 +01:00
Fred Nicolson
27d02ca055 fr::Packet optimisations & marking Sendable::send() as const
Replaced instances of resize&memcpy with append, which gives a noticeable performance boost.

fr::Packet::operator<<(const char *str) no longer converts str into an std::string before adding it, removing an unneeded copy.

fr::Packet::clear no longer calls erase, should result in more of the internal buffer remaining allocated.

Framing for std::vector's has been changed from a uint64_t to a uint32_t (breaking change for packet framing!)
2018-03-27 12:03:55 +01:00
Fred Nicolson
c0d103da14 Improved network encoding conversion functions
Now uses optimised/inbuilt functions if available.
2018-03-26 17:34:00 +01:00
Fred Nicolson
4207468ef0 Added the ability to add iterator ranges to packets
So, fr::Packet::add_range(std::begin(container), std::end(container));
2018-03-06 14:31:47 +00:00
Fred Nicolson
2040540e94 Removed use of platform dependant type when dealing with vectors
Previously, fr::Packet would use 'size_t' for dealing with vector sizes. This is not ideal though, as the size of size_t is platform depenant, meaning that fr::Packet's sent on one computer might be incompatible with other systems.
2018-03-05 10:37:09 +00:00
Fred Nicolson
addd1cf19b Removed unnecessary copy from fr::Packet:add().
Should improve performance.
2018-03-05 10:28:11 +00:00
Unknown
206e421728 Actually pushed across examples 2018-03-03 16:08:42 +00:00
Unknown
13f709aebb Added examples for a simple WebSocket client and Server.
Removed automatic ping pong response, and disconnection from fr::WebSocket, as it should be handled by the library user, really.

Updated ReadMe.
2018-03-03 16:02:17 +00:00
Unknown
fa843b57c8 Added experimental WebSocket support.
Added Sha1 hash, and Base64 encode implementations which are optionally compiled if websock support is enabled, to assist in the WebSock handshake.

Added WebSocket to manage the WebSock protocol during connections.

Added WebFrame to allow for sending/receiving data through the WebSock protocol easily.
2018-03-01 23:03:05 +00:00