summaryrefslogtreecommitdiffhomepage
path: root/lib/utility/cgi.hpp
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-07-26 01:47:32 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2025-07-26 01:47:32 +0100
commitc52dbf5513ae7f106634967162da5cfb01dc5af3 (patch)
treeb6715d0fdacebd48491b9b05cf85f1d92028f84b /lib/utility/cgi.hpp
parent01565adb9cf5ef991196f56c7f5f7b6161daa005 (diff)
feat: SOCL v1.0.2, changelog soon!v1.0.2
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'lib/utility/cgi.hpp')
-rw-r--r--lib/utility/cgi.hpp62
1 files changed, 0 insertions, 62 deletions
diff --git a/lib/utility/cgi.hpp b/lib/utility/cgi.hpp
deleted file mode 100644
index 068adf1..0000000
--- a/lib/utility/cgi.hpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * File: cgi.hpp
- * Author: Amlal El Mahrouss,
- * Copyright 2023-2025, Amlal El Mahrouss all rights reserved.
- */
-
-#ifndef _SNU_CGI_HPP
-#define _SNU_CGI_HPP
-
-#include <cstdio>
-#include <string>
-#include <sstream>
-
-namespace snu
-{
- namespace cgi
- {
- /// @brief CGI Writer class, writes to stdout; as CGI expects.
- class writer final
- {
- writer& eval_(const std::string& mime, const std::stringstream& ss) noexcept
- {
- std::printf("Content-Type: %s\r\n", mime.c_str());
- std::printf("Server: %s\r\n", "snu-cpp-library");
- std::printf("Content-Length: %ld\r\n\r\n", ss.str().size());
- std::printf("%s", ss.str().c_str());
-
- return *this;
- }
-
- public:
- explicit writer() = default;
- ~writer() = default;
-
- writer& operator=(const writer&) = default;
- writer(const writer&) = default;
-
- public:
- writer& eval_html(const std::stringstream& ss_html)
- {
- return this->eval_("text/html", ss_html);
- }
-
- writer& eval_xml(const std::stringstream& ss_html)
- {
- return this->eval_("application/xml", ss_html);
- }
-
- writer& eval_json(const std::stringstream& ss_html)
- {
- return this->eval_("application/json", ss_html);
- }
-
- writer& eval_js(const std::stringstream& ss_html)
- {
- return this->eval_("text/javascript", ss_html);
- }
- };
- } // namespace cgi
-} // namespace snu
-
-#endif // ifndef _SNU_CGI_HPP \ No newline at end of file