summaryrefslogtreecommitdiffhomepage
path: root/dev/examples/cgi
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-09-04 11:25:04 +0200
committerGitHub <noreply@github.com>2025-09-04 11:25:04 +0200
commit6789dd7d88a192e3f55b95798cb393e7d12f368a (patch)
tree7f04815ad5214f97d0fb2becceceed7ce8089b3d /dev/examples/cgi
parent443588a42fe9cf48b5f63184b94afe483cb0e761 (diff)
parentfda7082c54ad46a56ac885d4686b82bad8dbc7c9 (diff)
Merge pull request #4 from amlel-el-mahrouss/devv1.0.43
OCL — v1.0.43
Diffstat (limited to 'dev/examples/cgi')
-rw-r--r--dev/examples/cgi/CMakeLists.txt4
-rw-r--r--dev/examples/cgi/cgi.cc19
2 files changed, 10 insertions, 13 deletions
diff --git a/dev/examples/cgi/CMakeLists.txt b/dev/examples/cgi/CMakeLists.txt
index 391899f..9c3cbf6 100644
--- a/dev/examples/cgi/CMakeLists.txt
+++ b/dev/examples/cgi/CMakeLists.txt
@@ -6,7 +6,11 @@ project(
VERSION 1.0
LANGUAGES CXX)
+find_package(Boost REQUIRED COMPONENTS container)
+
add_executable(CGI cgi.cc)
+target_link_libraries(CGI PRIVATE Boost::container)
+
set_property(TARGET CGI PROPERTY CXX_STANDARD 20)
target_include_directories(CGI PUBLIC ../../)
diff --git a/dev/examples/cgi/cgi.cc b/dev/examples/cgi/cgi.cc
index 2cb8f3a..692f90c 100644
--- a/dev/examples/cgi/cgi.cc
+++ b/dev/examples/cgi/cgi.cc
@@ -4,17 +4,14 @@
licensed under the MIT license
*/
-#include <lib/utility/cgi.hpp>
-#include <fstream>
-#include <sstream>
-#include <string>
+#include <lib/utility/cgi_writer.hpp>
-const std::string error_html = R"(
+static ocl::basic_chunk_string<char> text_sample = R"(
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
- <title>Error | SOCL</title>
+ <title>Error | OCL</title>
<style>
body {
font-family: monospace;
@@ -62,7 +59,7 @@ const std::string error_html = R"(
<tr><td colspan="3"><hr></td></tr>
</table>
- <address>SOCL's Common Gateway Server.</address>
+ <address>OCL's Common Gateway Server.</address>
</body>
</html>
)";
@@ -71,12 +68,8 @@ const std::string error_html = R"(
/* @brief this stub loads a 'index.html' or returns an error message if not found. */
int main(int argc, char** argv)
{
- snu::cgi::basic_writer<> writer;
-
- std::stringstream ss_file;
- ss_file << error_html;
-
- writer.html(ss_file);
+ ocl::cgi::basic_writer<> writer;
+ writer << text_sample;
return 0;
}