diff options
author | randomdan <randomdan@localhost> | 2012-05-14 17:50:58 +0000 |
---|---|---|
committer | randomdan <randomdan@localhost> | 2012-05-14 17:50:58 +0000 |
commit | ad49fa24d0ed9aaf5f3c773507503075e7ead9c2 (patch) | |
tree | 79235d647c913e82810b315ab524b4f9d896fc1b | |
parent | Don't bother setting locale on writing HTTP headers (diff) | |
download | project2-ad49fa24d0ed9aaf5f3c773507503075e7ead9c2.tar.bz2 project2-ad49fa24d0ed9aaf5f3c773507503075e7ead9c2.tar.xz project2-ad49fa24d0ed9aaf5f3c773507503075e7ead9c2.zip |
Move output encoding somewhere cacheable
-rw-r--r-- | project2/cgi/cgiAppEngine.cpp | 2 | ||||
-rw-r--r-- | project2/cgi/cgiEnvironment.cpp | 2 | ||||
-rw-r--r-- | project2/cgi/cgiEnvironment.h | 1 | ||||
-rw-r--r-- | project2/cgi/cgiOutputOptions.cpp | 3 | ||||
-rw-r--r-- | project2/cgi/cgiOutputOptions.h | 4 |
5 files changed, 7 insertions, 5 deletions
diff --git a/project2/cgi/cgiAppEngine.cpp b/project2/cgi/cgiAppEngine.cpp index 566b979..cc7a3aa 100644 --- a/project2/cgi/cgiAppEngine.cpp +++ b/project2/cgi/cgiAppEngine.cpp @@ -140,7 +140,7 @@ CgiApplicationEngine::process() const TransformSourcePtr final = finalTransformSource(ts); ScopeObject emptyFinal([final] { final->clearTargets(); }); final->addTarget(new CgiResult(header, IO, - rs && rs->root ? rs->root->value("encoding", _env->outputEncoding) : VariableType(_env->outputEncoding)), NULL); + rs && rs->outputOptions ? rs->outputOptions->Encoding().as<std::string>() : OutputOptions::encoding), NULL); BOOST_FOREACH(const PresenterCachePtr & p, rs->caches) { final->addTarget(p, NULL); } diff --git a/project2/cgi/cgiEnvironment.cpp b/project2/cgi/cgiEnvironment.cpp index 2e977b2..babeeea 100644 --- a/project2/cgi/cgiEnvironment.cpp +++ b/project2/cgi/cgiEnvironment.cpp @@ -52,8 +52,6 @@ CgiEnvironment::CgiEnvironment() : "The module with which to implement session management") ("cgi.hostRegex", hpi, "Regular expression used to define a hostname -> platform association") - ("cgi.outputEncoding", Options::value(&outputEncoding, "utf-8"), - "The encoding to use when outputing to the web server") ; } diff --git a/project2/cgi/cgiEnvironment.h b/project2/cgi/cgiEnvironment.h index 27b1694..a2867be 100644 --- a/project2/cgi/cgiEnvironment.h +++ b/project2/cgi/cgiEnvironment.h @@ -60,7 +60,6 @@ class CgiEnvironment : public Environment { std::string onErrorPresent; std::string defaultPresenter; std::string sessionModule; - std::string outputEncoding; }; #endif diff --git a/project2/cgi/cgiOutputOptions.cpp b/project2/cgi/cgiOutputOptions.cpp index ba4d621..59b034d 100644 --- a/project2/cgi/cgiOutputOptions.cpp +++ b/project2/cgi/cgiOutputOptions.cpp @@ -7,8 +7,10 @@ bool OutputOptions::timing; bool OutputOptions::environment; bool OutputOptions::url; bool OutputOptions::parameters; +std::string OutputOptions::encoding; OutputOptions::OutputOptions(ScriptNodePtr p) : + Encoding(p, "encoding", encoding), Core(p, "core", core), Session(p, "session", session), Timing(p, "timing", timing), @@ -22,6 +24,7 @@ OutputOptionsLoader::OutputOptionsLoader() : opts("CGI default output options") { opts + ("cgi.output.encoding", Options::value(&OutputOptions::encoding, "utf-8"), "Default out encoding") ("cgi.output.core", Options::value(&OutputOptions::core, true), "Core messages") ("cgi.output.session", Options::value(&OutputOptions::session, true), "Session values") ("cgi.output.timing", Options::value(&OutputOptions::timing, true), "Timing") diff --git a/project2/cgi/cgiOutputOptions.h b/project2/cgi/cgiOutputOptions.h index faace67..a975fa0 100644 --- a/project2/cgi/cgiOutputOptions.h +++ b/project2/cgi/cgiOutputOptions.h @@ -9,6 +9,7 @@ class OutputOptions : public IntrusivePtrBase { public: OutputOptions(ScriptNodePtr); + const Variable Encoding; const Variable Core; const Variable Session; const Variable Timing; @@ -16,9 +17,10 @@ class OutputOptions : public IntrusivePtrBase { const Variable URL; const Variable Parameters; - private: // defaults friend class OutputOptionsLoader; + static std::string encoding; + private: static bool core; static bool session; static bool timing; |