28 Commits

Author SHA1 Message Date
Fred Nicolson
32767786af
Moving enums to enum classes 2019-05-01 17:06:09 +01:00
Fred Nicolson
7343529302 Add support for extracting std::vector<bool> from packets 2019-01-17 11:51:18 +00:00
Fred Nicolson
1ccde3f324 Fix tests 2019-01-14 13:38:35 +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
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
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
4dec5318f7 Added support for std::map/std::unordered_map to fr::Packet 2018-06-22 09:22:27 +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
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
103e0faaae Bug fixes. HTTP parsing improvements. More tests.
Fixed TcpSocket::set_descriptor(nullptr) causing an invalid read from address 0x0.

Improved HTTP response/request parsing so that they report a parse failure if the first few bytes of the HTTP request don't match the expected format rather than continuing to look for an end of header.

Fixed broken fr::Http::url_encode() implementation.

Optimised fr::Http::url_decode() implementation.

Added fr::Http unit tests.
2018-03-01 15:51:57 +00:00
Fred Nicolson
ff25d11089 Removed socket mutexes. Added more tests. Improved examples.
Socket mutexes are no longer really required, and so have been removed.

Added more tests for network encoding functions, and the URL parser.

The URL parser now returns a path preceeded with a '/' instead of cutting it out. Added get_uri() to URL, for getting the whole URI, so users don't have to concat it themselves from the more specialised functions.

Fixed default socket connect timeout checking for the wrong value.

Fixed request_type_strings not containing all of the possible request types.

Fixed README using old socket close syntax.

Cleaned up the examples a bit.
2018-02-01 11:56:34 +00:00
Fred Nicolson
ad847f0052 HTTP parsing bug fixes, added tests
Fixed HTTP request parse failing if the URI was too short. 

Fixed HTTP parser not converting POST/GET data to lowercase before storing it, making post and get data which contained capitals impossible to access.
2018-01-26 13:18:45 +00:00
Fred Nicolson
30354f15bc Added support for connect timeouts.
Both fr::TcpSocket and fr::SSLSocket can have timeouts specified when connecting. This works by putting the socket into non-blocking mode, making a connect, and then selecting on the socket for the requested timeout. If the select times out then we've failed to connect, if it didn't time out then we've connected.
2018-01-10 17:08:16 +00:00
Fred Nicolson
c8e03f2df8 Added more tests. Tweaks.
Receiving an http request/response will now return errors like HttpHeaderTooBig, instead of the type being set to that.

Added fr::Socket::status_to_string for converting status values into English strings.
2017-09-25 16:19:47 +01:00
Fred Nicolson
f1db713069 Made POST/GET/HEADER members case insensitive again
It broke things. Bad.
2017-08-22 13:57:08 +01:00
Fred Nicolson
0bd41ec6bd get_remote_address() now works on SSL sockets accepted through SSLListener
Post/get/... data is no longer case insensitive.
2017-08-02 17:32:16 +01:00
Fred Nicolson
84382cad0b Made some changes recommended by Clang-Tidy. 2017-07-20 15:02:43 +01:00
Fred Nicolson
a0ca16c891 Work on fr::HttpRequest unit tests. Some tweaking.
GET variables are now actually added to the request when constructing them, instead of being ignored.
2017-07-20 10:42:18 +01:00
Fred Nicolson
f2cebd0847 Work on tests. Bug fixes and tweaks.
Started work on tests for fr::HttpRequest.

Fixed the final POST data variable containing header data it shouldn't (\r\n\r\n).

Fixed fr::Http::header_exists, and family, not converting things to lowercase first.
2017-07-19 17:30:43 +01:00
Unknown
028677b01a Added tests. Improved error checking. Bug fixes.
Added fr::TcpListener tests.
2017-06-05 20:13:50 +01:00
Fred Nicolson
bbcf185202 Improved build system
Examples and tests now build on Windows
2017-05-31 16:23:35 +01:00
Unknown
adc891fc84 Tweaked build system 2017-05-30 19:58:40 +01:00
Fred Nicolson
df2425a94d Added fr::Packet tests and Travis CI file. 2017-05-30 17:07:41 +01:00
Fred Nicolson
dd4d45d183 Improved tests
Fixed tests not being linked properly with frnetlib.

Added tests for the URL parser.
2017-05-30 15:32:45 +01:00
Unknown
6c0762bbf2 Integrated googletest into the project
The plan is to add unit tests, to completely test library functionality, alongside continuous integration on GitHub.
2017-05-29 22:55:17 +01:00