From ca78b98f556b12ba7cda782f38bf02c40e89ba27 Mon Sep 17 00:00:00 2001 From: The-EDev Date: Thu, 7 Apr 2022 15:42:47 +0300 Subject: [PATCH] documented CROW_FEATURES --- docs/getting_started/setup/linux.md | 15 ++++++++++++--- docs/getting_started/setup/macos.md | 2 +- docs/guides/compression.md | 2 +- docs/guides/query-string.md | 2 +- docs/guides/ssl.md | 4 ++-- 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/docs/getting_started/setup/linux.md b/docs/getting_started/setup/linux.md index 86f268c16..a1b573153 100644 --- a/docs/getting_started/setup/linux.md +++ b/docs/getting_started/setup/linux.md @@ -6,10 +6,11 @@ Here's how you can install Crow on your favorite GNU/Linux distro. - boost library & development headers (1.64 or later). - **(optional)** ZLib for HTTP Compression. - **(optional)** OpenSSL for HTTPS support. - - **(optional)** CMake and Python3 to build tests and/or examples. -!!!note + - **(optional)** CMake for building tests, examples, and/or installing Crow. + - **(optional)** Python3 to build tests and/or examples. +!!! note - Crow's CI uses `g++-9.3` and `clang-7.0` running on AMD64 (x86_64) and ARM64v8 architectures. + Crow's CI uses `g++-9.4` and `clang-10.0` running on AMD64 (x86_64) and ARM64v8 architectures.

@@ -42,6 +43,10 @@ You can also download the `crow_all.h` file and simply include that into your pr You can ignore `-DCROW_BUILD_EXAMPLES=OFF -DCROW_BUILD_TESTS=OFF` if you want to build the Examples and Unit Tests. +!!! note + + While building you can set the `CROW_FEATURES` variable (as a `;` separated list). You can use an argument such as `-DCROW_FEATURES="ssl;compression"`. + !!! note You can uninstall Crow at a later time using `make uninstall`. @@ -76,6 +81,10 @@ find_package(Crow) target_link_libraries(your_project PUBLIC Crow::Crow) ``` From there CMake should handle compiling and linking your project. +!!! note + + For optional features like HTTP Compression or HTTPS you can set the `CROW_FEATURES` variable using lines such as `set(CROW_FEATURES "ssl;compression")`, `set(CROW_FEATURES ssl compression)`, or `set(CROW_FEATURES ssl)`. + ### Directly using a compiler All you need to do is run the following command: ``` diff --git a/docs/getting_started/setup/macos.md b/docs/getting_started/setup/macos.md index 193eb2706..252b993da 100644 --- a/docs/getting_started/setup/macos.md +++ b/docs/getting_started/setup/macos.md @@ -58,7 +58,7 @@ This will generate a `crow_all.h` file which you can use in the following steps 4. `make -j12` !!! note - You can add options like `-DCROW_ENABLE_SSL`, `-DCROW_ENABLE_COMPRESSION`, or `-DCROW_AMALGAMATE` to `cmake ..` to build their tests/examples. + You can add options like `-DCROW_FEATURES="ssl;compression"` or `-DCROW_AMALGAMATE` to `cmake ..` to build optional tests/examples for HTTP Compression or HTTPS. ## Compiling using a compiler directly All you need to do is run the following command: diff --git a/docs/guides/compression.md b/docs/guides/compression.md index e95033860..abbe10d90 100644 --- a/docs/guides/compression.md +++ b/docs/guides/compression.md @@ -3,7 +3,7 @@ Crow supports Zlib compression using Gzip or Deflate algorithms. ## HTTP Compression HTTP compression is by default disabled in crow. Do the following to enable it:
-- Define `CROW_ENABLE_COMPRESSION` in your compiler definitions (`g++ main.cpp -DCROW_ENABLE_COMPRESSION` for example) or `CMakeLists.txt`. +- Define `CROW_ENABLE_COMPRESSION` in your compiler definitions (`g++ main.cpp -DCROW_ENABLE_COMPRESSION` for example) or `set(CROW_FEATURES compression)` in `CMakeLists.txt`. - Call `#!cpp use_compression(crow::compression::algorithm)` on your Crow app. - When compiling your application, make sure that ZLIB is included as a dependency. Either through `-lz` compiler argument or `find_package(ZLIB)` in CMake. diff --git a/docs/guides/query-string.md b/docs/guides/query-string.md index ed2c58acf..ffbdb350e 100644 --- a/docs/guides/query-string.md +++ b/docs/guides/query-string.md @@ -24,7 +24,7 @@ The key in the map is what's in the brackets (`sub_key1` for example), and the v ## pop_dict(name) **Introduced in: `v0.3`**

Works the same as `get_dict` but removing the values from the query string. -!!!warning +!!! warning if your query string contains both a list and dictionary with the same key, it is best to use `pop_list` before either `get_dict` or `pop_dict`, since a map cannot contain more than one value per key, each item in the list will override the previous and only the last will remain with an empty key. diff --git a/docs/guides/ssl.md b/docs/guides/ssl.md index ce17a53ae..9964ca3a3 100644 --- a/docs/guides/ssl.md +++ b/docs/guides/ssl.md @@ -1,6 +1,6 @@ Crow supports HTTPS though SSL or TLS.

-!!!note +!!! note When mentioning SSL in this documentation, it is often a reference to openSSL, which includes TLS.

@@ -8,7 +8,7 @@ Crow supports HTTPS though SSL or TLS.

To enable SSL, first your application needs to define either a `.crt` and `.key` files, or a `.pem` file. Once you have your files, you can add them to your app like this:
`#!cpp app.ssl_file("/path/to/cert.crt", "/path/to/keyfile.key")` or `#!cpp app.ssl_file("/path/to/pem_file.pem")`. Please note that this method can be part of the app method chain, which means it can be followed by `.run()` or any other method.

-You also need to define `CROW_ENABLE_SSL` in your compiler definitions (`g++ main.cpp -DCROW_ENABLE_SSL` for example) or `CMakeLists.txt`. +You also need to define `CROW_ENABLE_SSL` in your compiler definitions (`g++ main.cpp -DCROW_ENABLE_SSL` for example) or `set(CROW_FEATURES ssl)` in `CMakeLists.txt`. You can also set your own SSL context (by using `boost::asio::ssl::context ctx`) and then applying it via the `#!cpp app.ssl(ctx)` method.