diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-03-31 12:48:36 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-03-31 12:48:36 +0200 |
| commit | 67ab14c72982fbd806b363a581b2b5518269a552 (patch) | |
| tree | f5bfd2499a634f016e2a53ae7bc2902152b34904 /lib/stdx/cgi.hpp | |
| parent | 3bb8bf9bfd88ba1b6077fcb98688b50b796c1c5f (diff) | |
fix: CI and include directory.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'lib/stdx/cgi.hpp')
| -rw-r--r-- | lib/stdx/cgi.hpp | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/lib/stdx/cgi.hpp b/lib/stdx/cgi.hpp deleted file mode 100644 index ae2b650..0000000 --- a/lib/stdx/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 _STDX_CGI_HPP -#define _STDX_CGI_HPP - -#include <cstdio> -#include <string> -#include <sstream> - -namespace astdx -{ - namespace web - { - /// @brief CGI Writer class, writes to stdout; as CGI expects. - class cgi_writer final - { - cgi_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", "astdx-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 cgi_writer() = default; - ~cgi_writer() = default; - - cgi_writer& operator=(const cgi_writer&) = default; - cgi_writer(const cgi_writer&) = default; - - public: - cgi_writer& eval_html(const std::stringstream& ss_html) - { - return this->eval_("text/html", ss_html); - } - - cgi_writer& eval_xml(const std::stringstream& ss_html) - { - return this->eval_("application/xml", ss_html); - } - - cgi_writer& eval_json(const std::stringstream& ss_html) - { - return this->eval_("application/json", ss_html); - } - - cgi_writer& eval_js(const std::stringstream& ss_html) - { - return this->eval_("text/javascript", ss_html); - } - }; - } // namespace web -} // namespace astdx - -#endif // ifndef _STDX_CGI_HPP
\ No newline at end of file |
