115 Commits

Author SHA1 Message Date
Fred Nicolson
bbcf185202 Improved build system
Examples and tests now build on Windows
2017-05-31 16:23:35 +01:00
Fred Nicolson
0a00f0ca61 Merge remote-tracking branch 'origin/master' 2017-05-31 09:35:00 +01:00
Unknown
128ebbd272 Updated readme to include Travis CI build status badge 2017-05-30 20:09:38 +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
a6a652e72b Fixed CMake build issues
Tests and examples however, still do not work on Windows and so are disabled by default for now.
2017-05-30 10:51:42 +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
Unknown
1eec21c679 Fixed Cmake error 2017-05-29 19:04:44 +01:00
Unknown
1b64bbbb67 Cleaned up mess 2017-05-29 18:59:33 +01:00
Unknown
bf8a6345d7 Merge remote-tracking branch 'origin/master' 2017-05-29 18:57:47 +01:00
Unknown
c4fea83a2c Added support for examples to the build system. Cleaned up examples.
Examples can now be automatically built with the project, if enabled. And I've cleaned up MiaoDX's examples to be more compliant with frnetlib's coding style.
2017-05-29 18:57:39 +01:00
Fred Nicolson
0385ea57f9 Merge pull request #8 from MiaoDX-fork-and-pruning/more_examples
More examples, and fix the link problem in linux introduced by my careless.
2017-05-29 18:55:18 +01:00
miaodx
7dccf41b76 specify the ip and port. 2017-05-29 23:49:03 +08:00
miaodx
8a380c6620 add FRNETLIB_LIB for apple and linux. 2017-05-29 23:48:31 +08:00
miaodx
bb9eaa3981 tcpsocket client and server example. 2017-05-29 23:19:27 +08:00
Fred Nicolson
2d1cf169db Merge pull request #7 from MiaoDX-fork-and-pruning/add_some_examples
Make build with `SSL` support optional, and add some examples.
2017-05-29 09:06:14 +01:00
miaodx
1de53ef6e8 add some examples. 2017-05-29 09:42:14 +08:00
miaodx
f1d1d0849e reorganize the include files according to the SSL_ENABLED flag.
So that we can build without ssl support.
2017-05-29 09:36:20 +08:00
Unknown
5778310798 Fixed incompatabilities between GCC and MSCV
Build errors have been fixed, but there are build warnings remaining about unsafe conversions, because Visual C++'s network conversion functions have a differing return type to mine. To be fixed in the future.
2017-05-28 18:09:29 +01:00
Fred Nicolson
ae61464aee Removed is_connected flag in fr::Socket
The socket descriptor is now checked, to see if it's greater than 0, instead. This means that the flag doesn't have to be manually updated.
2017-05-25 16:21:39 +01:00
Fred Nicolson
b2bb3ce60b Fixed fr::HttpResponse parse bug
The spacing between the header and the body was being added into the body.
2017-05-24 14:38:01 +01:00
Fred Nicolson
e0f68fb037 Added const specifiers to fr::URL members 2017-05-24 13:45:33 +01:00
Fred Nicolson
64cce75bda Added port detection to URL parser, if not specified.
Before, if you parsed a URL using fr::URL, and a port wasn't explicitly mentioned in the URL, then fr::URL::get_port() would return an empty string. 

Now, it will try to detect the port type if none is specified. For example, URLs beginning with http, will be given a port of 80. This is to simplify usage of the URL class.
2017-05-24 11:05:14 +01:00
Fred Nicolson
431f646bae Moved URL class into fr namespace
It should not have been in the global namespace, as it's a part of the library.
2017-05-24 09:54:19 +01:00
Fred Nicolson
c110fb6c81 Updated ReadMe to be compatable with code changes and fixed typos
The SSLConect interface has changed, and so the readme text explaining it has been updated.

There were various typos which have been corrected.
2017-05-23 21:57:32 +01:00
Fred Nicolson
7d0edb160e Bug fixes. Added ability to set ai_family on SSL listeners.
fr::Listener's destructor wasn't virtual, so children's destructors weren't being called.

fr::TcpListener did not have a destructor, and so did not close its socket on destruction. 

fr::SSLListener now uses fr::TcpListener's 'listen' function instead of its own, as a temporary hack, as mbedtls does not support setting the address families.

Added get/set functions to the listeners for their socket descriptors.
2017-05-23 21:17:39 +01:00
Fred Nicolson
68c214ef7e Merge pull request #5 from Cloaked9000/Mbedtls_Modified
Mbedtls modified
2017-05-23 20:48:45 +01:00
Fred Nicolson
ca95bb326e Fixed CMake error
Accidentally set CXX flags twice
2017-05-23 17:04:06 +01:00
Fred Nicolson
b34ada36d1 Compilation error fixed 2017-05-23 16:57:21 +01:00
Fred Nicolson
40f8ccb067 Added URL parsing class
Allows the parsing of full URLs into easy chunks. Added as a helper class for users of the library dealing with URLs, and to potentially replace some of the HTTP parsing code in the future.
2017-05-23 16:52:55 +01:00
Fred Nicolson
3ad56ad798 Cast fix 2017-05-11 14:46:47 +01:00
Fred Nicolson
4ac6347add Merge pull request #4 from Cloaked9000/revert-3-Mbedtls_Modified
Revert "Compatability with mbedtls fork"
2017-05-11 14:44:03 +01:00
Fred Nicolson
1f93408179 Revert "Compatability with mbedtls fork" 2017-05-11 14:43:52 +01:00
Fred Nicolson
6c2f0a677c Merge pull request #3 from Cloaked9000/Mbedtls_Modified
Compatability with mbedtls fork
2017-05-11 14:40:35 +01:00
Fred Nicolson
dd3efa88cf Windows compile issue 2017-05-11 14:37:57 +01:00
Fred Nicolson
5e83ec3b33 Compatability with mbedtls fork 2017-05-11 14:11:44 +01:00
Fred Nicolson
60dfd44c0f Fixed errors not returning from SSLContext load crt 2017-05-11 14:09:55 +01:00
Fred Nicolson
9646d72e74 Added ability to set address family for sockets. Improved sslcontext.
Certs can now either be loaded from memory or disk.

You can specify if you want to use ipv4/ipv6/either when connecting or accepting.
2017-05-11 11:43:01 +01:00
Fred Nicolson
7ea87cced8 Added helpers for detecting mimetype
fr::Http::get_mimetype(filename) will return the mimetype of a given filename or file extention. This should be used to set the 'content-type' header when creating fr::HttpResponses.
2017-05-07 10:44:33 +01:00
Fred Nicolson
53ab6e2090 Header names are automatically lower-cased now. 2017-04-11 10:39:23 +01:00
Fred Nicolson
561b395e93 Removed debugging text. Fixed header parsing issue.
An extra character was been included in the header data.
2017-04-11 09:43:52 +01:00
Fred Nicolson
6b1ef27764 Re-wrote HTML request/response parsing
It's now much more robust, supports requests received over multiple recvs. Supports POST variables. Supports 'content-length' header.
2017-04-10 17:24:57 +01:00
Fred Nicolson
eaefd93096 Re-arranged things 2017-04-07 09:22:31 +01:00
Fred Nicolson
5757eb776c Preparing to add support for larger HTTP requests 2017-04-06 14:07:03 +01:00
Fred Nicolson
5f07ebad73 Removed unneeded line of code 2017-04-06 11:32:28 +01:00
Fred Nicolson
3c6e6ec1b6 Added 'shutdown' to listeners 2017-03-31 14:37:31 +01:00
Fred Nicolson
f101dc5718 Added missing access specifier to Listener 2017-03-31 12:28:39 +01:00
Fred Nicolson
e15afb3d87 Cleaned up Listener code
Now inherits a 'Listener' class, instead of Socket.
2017-03-31 12:15:13 +01:00
Fred Nicolson
4512bd49e7 Made a few read/write tweaks 2017-03-24 20:18:08 +00:00