diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-07-26 01:47:32 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-07-26 01:47:32 +0100 |
| commit | c52dbf5513ae7f106634967162da5cfb01dc5af3 (patch) | |
| tree | b6715d0fdacebd48491b9b05cf85f1d92028f84b /examples/cgi | |
| parent | 01565adb9cf5ef991196f56c7f5f7b6161daa005 (diff) | |
feat: SOCL v1.0.2, changelog soon!v1.0.2
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'examples/cgi')
| -rw-r--r-- | examples/cgi/CMakeLists.txt | 12 | ||||
| -rw-r--r-- | examples/cgi/cgi.cc | 91 |
2 files changed, 0 insertions, 103 deletions
diff --git a/examples/cgi/CMakeLists.txt b/examples/cgi/CMakeLists.txt deleted file mode 100644 index 391899f..0000000 --- a/examples/cgi/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ - -cmake_minimum_required(VERSION 3.15...3.31) - -project( - CGI - VERSION 1.0 - LANGUAGES CXX) - -add_executable(CGI cgi.cc) - -set_property(TARGET CGI PROPERTY CXX_STANDARD 20) -target_include_directories(CGI PUBLIC ../../) diff --git a/examples/cgi/cgi.cc b/examples/cgi/cgi.cc deleted file mode 100644 index b4c0b34..0000000 --- a/examples/cgi/cgi.cc +++ /dev/null @@ -1,91 +0,0 @@ -/* - cgi example - written by Amlal El Mahrouss. - licensed under the MIT license - */ - -#include <lib/utility/cgi.hpp> -#include <fstream> -#include <sstream> -#include <string> - -const std::string g_not_found = R"( -<!DOCTYPE html> -<html> -<head> - <meta charset="UTF-8"> - <title>error | snu-lib</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>snu'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) -{ - // ... let's assume we serve data. - - snu::cgi::cgi_writer writer; - std::stringstream ss_file; - - std::ifstream fp("index.html"); - - if (fp.good()) - ss_file << fp.rdbuf(); - else - ss_file << g_not_found; - - fp.close(); - - writer.eval_html(ss_file); - - return 0; -} |
