Commit Graph
92 Commits
Author SHA1 Message Date
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
Cloaked9000 8ec22b7c56 Windows compatability fixes 2017-02-15 14:29:05 +00:00
Cloaked9000 9c520c3a0b Disable SIGPIPE, should disconnect socket now instead 2017-02-14 17:04:21 +00:00
Cloaked9000 11fac2aa12 Merged branch master into master 2017-02-10 10:56:14 +00:00
Cloaked9000 7fccf5dda4 Added more HTTP status codes. Added packet read/write raw. 2017-02-10 10:56:08 +00:00
Cloaked9000 a50529bf90 Update README.md 2017-02-02 12:00:09 +00:00
Cloaked9000 5c021761a8 Merged branch master into master 2017-02-02 11:51:43 +00:00
Cloaked9000 5c94b3f6df Added 'fr::Packetable' to allow custom objects to be packed into packets
Can be used by inheriting the 'pack' and 'unpack' members of fr::Packetable. The 'pack' function should add your class members to the packet, and the 'unpack' function should take them back out.
2017-02-02 11:51:31 +00:00
Cloaked9000 1251c303db Removed needless default constructor 2017-01-30 12:09:26 +00:00
Cloaked9000 cc68e4d32d Added missing header 2017-01-30 12:04:55 +00:00
Cloaked9000 fcef4e7164 Update CMakeLists.txt 2017-01-30 11:43:41 +00:00
Cloaked9000 15d20388c1 Added more type support to fr::Packet
Added std::pair<> support.

Added enum/enum class support
2017-01-27 15:36:36 +00:00
Fred Nicolson 24195e402f Bug fixes
Fixed deadlock in fr::Socket::receive.

Fixed fr::Packet's second constructor not delegating to first, causing it's intenal buffer to remain unitialised.
2017-01-26 21:58:20 +00:00
Fred Nicolson 2abe108d57 Merge fix 2017-01-25 22:59:56 +00:00
Fred Nicolson fad7d0b81f Packet and socket optimisations
Sending/receiving data on a socket is roughly 5.5x faster, after removing data copies and buffer re-allocations.
2017-01-25 22:57:11 +00:00
Cloaked9000 7691ed0a76 Added uint8_t support for packets 2017-01-23 17:56:20 +00:00
Cloaked9000 78098c7d32 Merged branch master into master 2017-01-23 09:15:44 +00:00
Cloaked9000 657c8e21ad Mutex changes 2017-01-23 09:15:40 +00:00
Fred Nicolson 6b2947932a Bux fixes
Fixed typo causing fr::Packet string extraction to fail.
Fixed Windows compilation error.
2017-01-22 14:20:24 +00:00
Fred Nicolson f8aa22d223 Performance improvements and fixes
Greatly improvded fr::Packet>> performance.
Added buffer overflow protection to fr::Packet>>.
Added fr::Packet::reset_read_cursor to reset the packet data read position back to the beginning.
2017-01-22 12:11:17 +00:00
Cloaked9000 64f35e2a92 Increased receive chunk size to 4096 bytes 2017-01-13 15:30:11 +00:00
Cloaked9000 db6c7e4c41 Added support for sending and receiving of std::vectors
Provided that in std::vector<T>, T is a supported packet type (std::string, uintXX_t, intXX_t....)
2017-01-10 15:21:34 +00:00
Cloaked9000 02ab3634c4 Fixed Windows SocketSelector Exception
In Windows, if fr::SocketSelector::wait(...) was called, and the socket selector was empty, then an exception would be thrown as a result of Windows behaving differently to UNIX sockets. Now, the call will sleep for timeout before returning false, to match UNIX behaviour.
2017-01-06 16:15:04 +00:00
Cloaked9000 f0894e9d35 Merged branch master into master 2017-01-06 15:22:34 +00:00