- 28 Jan, 2019 1 commit
-
-
Louis Solofrizzo authored
Introduction ------------ This patch introduces full SSL support for the pistache endpoint. The purpose of this patch is to be able to use SSL encryption without a SSL proxy, which is pretty useful for embedded development. It has been tested locally with simple SSL support and certificate connection, my example file is below. Features -------- First of all, in order to enable SSL support in the library, one has to compile with PISTACHE_USE_SSL option ON. One can then configure the endpoint to accept / use SSL connections only: Http::Endpoint server(addr); server.useSSL("./server.crt", "./cert/server.key"); With that done, all the connections to the server shall now be in HTTPS. One can also enable certificate authentication against the server: server.useSSLAuth("./rootCA.crt"); The server will now only accept client connection with a certificate signed with the Certificate Authority passed in the example above. How to use it ------------- Test file: #include <pistache/endpoint.h> using namespace Pistache; struct HelloHandler : public Http::Handler { HTTP_PROTOTYPE(HelloHandler) void onRequest(const Http::Request& request, Http::ResponseWriter writer) { writer.send(Http::Code::Ok, "Hello, World!"); } }; int main(void) { Pistache::Address addr; auto opts = Http::Endpoint::options().threads(1); addr = Pistache::Address(Pistache::Ipv4::any(), Pistache::Port(9080)); Http::Endpoint server(addr); server.init(opts); server.setHandler(std::make_shared<HelloHandler>()); server.useSSL("./cert/server.crt", "./cert/server.key"); server.serve(); return 0; } Compiled with: g++ main.cpp -L../pistache/build/src/ -lpistache -I../pistache/include/ -o server -lpthread -lssl -lcrypto In order to generate a Certificate Authority and server / client certificate and key, please refer to this gist[1]. Tests ----- I've added unit tests to this commit, they should automatically compile / launch with PISTACHE_SSL=ON. Pull Request : https://github.com/oktal/pistache/pull/226 Signed-off-by : Louis Solofrizzo <louis@ne02ptzero.me> (Using Scaleway signing Key) Reviewed-by : mauriciovasquezbernal <mauricio.vasquez@polito.it> Reviewed-by : snilga Commited-by : dennisjenkins75 <dennis.jenkins.75@gmail.com> Origin : denkeep/pistache [1] https://gist.github.com/fntlnz/cf14feb5a46b2eda428e000157447309 _________________________________________ / A man may be so much of everything that \ | he is nothing of anything. -- Samuel | \ Johnson / ----------------------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || ||
-
- 26 Jan, 2019 5 commits
-
-
Dennis Jenkins authored
Implementation of Date::write
-
Arthur de Araújo Farias authored
-
Dennis Jenkins authored
Code improvements: lambdas and tiny changes
-
knowledge4igor authored
-
Arthur de Araújo Farias authored
-
- 25 Jan, 2019 3 commits
-
-
Arthur de Araújo Farias authored
-
Dennis Jenkins authored
Move global type alias size_type inside string_view
-
Wang Boyu authored
-
- 23 Jan, 2019 2 commits
-
-
Dennis Jenkins authored
Work around regex_replace issue in GCC<4.9
-
chrisvroberts authored
GCC pre 4.9 has issue with template arg deduction which means old call passing char[2] to std::regex_replace as replacement string fails to build.
-
- 22 Jan, 2019 6 commits
-
-
Dennis Jenkins authored
Tiny code improvements
-
knowledge4igor authored
-
knowledge4igor authored
-
Dennis Jenkins authored
Macro for simple HTTP headers
-
Miguel Sacristan authored
-
Miguel Sacristan authored
-
- 20 Jan, 2019 1 commit
-
-
Dennis Jenkins authored
Second step of fixing memory leaks in Client
-
- 19 Jan, 2019 3 commits
-
-
knowledge4igor authored
-
Dennis Jenkins authored
First step of fixing memory leaks in Client
-
knowledge4igor authored
-
- 18 Jan, 2019 2 commits
-
-
Dennis Jenkins authored
Move to C++14
-
knowledge4igor authored
-
- 16 Jan, 2019 3 commits
-
-
Dennis Jenkins authored
Change Cmakefiles > Issue #357
-
hwaan2 authored
-
hwaan2 authored
Update GCC Version Check and CXX_STANDARD Setting Issue #357 > Add Target pistache_shared, pistache_static
-
- 08 Jan, 2019 1 commit
-
-
Dennis Jenkins authored
Delete obsolete transport_ field in Client class
-
- 07 Jan, 2019 1 commit
-
-
knowledge4igor authored
-
- 04 Jan, 2019 2 commits
-
-
Dennis Jenkins authored
Fix data races in Client desctruction
-
knowledge4igor authored
-
- 02 Jan, 2019 1 commit
-
-
Dennis Jenkins authored
Ephemeral port unit tests
-
- 01 Jan, 2019 8 commits
-
-
Dennis Jenkins authored
-
Dennis Jenkins authored
Ipv6 support
-
Dennis Jenkins authored
Fix data races in client connection state logic
-
knowledge4igor authored
-
Dennis Jenkins authored
Move static utility method for detecting ipv6 support from Listener (server) to Net (common), to make it cleaner to use in the client.
-
Dennis Jenkins authored
-
Dennis Jenkins authored
-
-
- 31 Dec, 2018 1 commit
-
-
Dennis Jenkins authored
Resolves bug #323: double invocation of router's notFound handler.
-