summaryrefslogtreecommitdiffhomepage
path: root/examples/cgi/cgi.cc
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-11-23 20:16:02 -0500
committerGitHub <noreply@github.com>2025-11-23 20:16:02 -0500
commit85f89ee4bb137100cbeffcbc10168eb8ea52e6cc (patch)
treef6e2063319ceaaa02f523fb5c289e4f37411a2df /examples/cgi/cgi.cc
parent9a70f32ddaec0eef99efbf7ff5597c2adf08f45a (diff)
parent65a8349aa5526d071b18cd4d42586c46faaa3823 (diff)
Merge pull request #18 from amlel-el-mahrouss/developv1.0.48
OCL v1.0.48
Diffstat (limited to 'examples/cgi/cgi.cc')
-rw-r--r--examples/cgi/cgi.cc75
1 files changed, 75 insertions, 0 deletions
diff --git a/examples/cgi/cgi.cc b/examples/cgi/cgi.cc
new file mode 100644
index 0000000..b837433
--- /dev/null
+++ b/examples/cgi/cgi.cc
@@ -0,0 +1,75 @@
+/*
+ cgi example
+ written by Amlal El Mahrouss.
+ licensed under the Boost Software License
+ */
+
+#include <utility/cgi.hpp>
+
+static ocl::basic_chunk_string<char> text_sample = R"(
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>Error | OCL</title>
+ <style>
+ body {
+ font-family: monospace;
+ background: white;
+ color: black;
+ margin: 2em;
+ }
+ h1 {
+ font-size: 1.5em;
+ }
+ hr {
+ border: none;
+ border-top: 1px solid #ccc;
+ }
+ table {
+ width: 100%;
+ border-collapse: collapse;
+ }
+ td {
+ padding: 0.2em 0.5em;
+ }
+ td:first-child {
+ white-space: nowrap;
+ }
+ a {
+ color: blue;
+ text-decoration: none;
+ }
+ a:hover {
+ text-decoration: underline;
+ }
+ </style>
+</head>
+<body>
+ <h1>Uh Oh!</h1>
+ <address>No index file was found in this directory.</address>
+ <hr>
+ <table>
+ <tr><th>Name</th></tr>
+ <tr><td colspan="3"><hr></td></tr>
+
+ <tr>
+ <td><a href="javascript:window.location.reload();">Refresh</a></td>
+ </tr>
+
+ <tr><td colspan="3"><hr></td></tr>
+ </table>
+ <address>OCL's Common Gateway Server.</address>
+</body>
+</html>
+)";
+
+/* finally test it */
+/* @brief this stub loads a 'index.html' or returns an error message if not found. */
+int main(int argc, char** argv)
+{
+ ocl::cgi::basic_writer<> writer;
+ writer << text_sample;
+
+ return 0;
+}