{"id":277577,"date":"2016-04-04T11:11:05","date_gmt":"2016-04-04T07:11:05","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=277577"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=277577","title":{"rendered":"\u0424\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a Fastcgi Container"},"content":{"rendered":"<p>       \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043e \u043e\u0446\u0435\u043d\u043a\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 Web UI \u0434\u043b\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e C++ \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0445\u043e\u0440\u043e\u0448\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 <a href=\"https:\/\/github.com\/lmovsesjan\/Fastcgi-Daemon\">Fastcgi Daemon<\/a> \u0431\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a <a href=\"https:\/\/github.com\/lpre\/Fastcgi-Container\">Fastcgi Container<\/a>.<\/p>\n<p>  \u041f\u0440\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0438 \u0432\u0441\u0435\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0430, \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u043e\u0442 \u043d\u0435\u0433\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c:<\/p>\n<ul>\n<li>\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u043d \u043d\u0430 C++11<\/li>\n<li>\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432<\/li>\n<li>\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430<\/li>\n<li>\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0441\u0435\u0441\u0441\u0438\u0439<\/li>\n<li>\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0441\u0435\u0440\u0432\u043b\u0435\u0442\u043e\u0432 (\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438\u0437 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430)<\/li>\n<li>\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d Page Compiler \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f C++ \u0441\u0435\u0440\u0432\u043b\u0435\u0442\u043e\u0432 \u0438\u0437 JSP-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0446<\/li>\n<\/ul>\n<p><a name=\"habracut\"><\/a><br \/>  \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0438 \u0434\u0435\u0442\u0430\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0430 \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u043b\u0438\u0441\u044c \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/habrahabr.ru\/post\/216181\/\">\u0437\u0434\u0435\u0441\u044c<\/a>). \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 <a href=\"https:\/\/github.com\/lpre\/Fastcgi-Container\">Fastcgi Container<\/a>. <\/p>\n<h2>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 C++11<\/h2>\n<p>  \u0424\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a-\u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f Fastcgi Daemon \u0448\u0438\u0440\u043e\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Boost. \u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0431\u044b\u043b\u043e \u0440\u0435\u0448\u0435\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 C++11, \u0437\u0430\u043c\u0435\u043d\u0438\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Boost \u043d\u0430 \u043d\u043e\u0432\u044b\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438. \u0418\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Boost.Any, \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 C++11. \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0431\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0447\u0435\u0440\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <a href=\"https:\/\/github.com\/mnmlstc\/core\">MNMLSTC Core<\/a>.<\/p>\n<h2>\u0424\u0438\u043b\u044c\u0442\u0440\u044b<\/h2>\n<p>  \u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b FastCGI \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442 \u0440\u043e\u043b\u0438 Filter \u0438 Authorizer \u0434\u043b\u044f \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430, \u043e\u0434\u043d\u0430\u043a\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0434\u0443\u043b\u0438 \u0434\u043b\u044f Apache HTTPD \u0438 NGINX) \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u043e\u043b\u044c Responder.<\/p>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u0431\u044b\u043b\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 Fastcgi Container. <\/p>\n<p>  \u0412 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u044b \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 <a href=\"https:\/\/github.com\/lpre\/Fastcgi-Container\/blob\/master\/include\/fastcgi3\/handler.h#L104\"><code>fastcgi::Filter<\/code><\/a>:<\/p>\n<pre><code class=\"cpp\">class Filter { public: \tFilter(); \tvirtual ~Filter(); \tFilter(const Filter&) = delete; \tFilter& operator=(const Filter&) = delete; \tvirtual void onThreadStart(); \tvirtual void doFilter(Request *req, HandlerContext *context, std::function&lt;void(Request *req, HandlerContext *context)&gt; next) = 0; }; <\/code><\/pre>\n<p>  \u0418\u0445 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0434\u0440\u0443\u0433\u0438\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"xml\">&lt;modules&gt; \t&lt;module name=&quot;example&quot; path=&quot;.\/example.so&quot;\/&gt; \t... &lt;\/modules&gt; &lt;components&gt; \t&lt;component name=&quot;example_filter_1&quot; type=&quot;example:filter1&quot;&gt;  \t\t&lt;logger&gt;daemon-logger&lt;\/logger&gt; \t&lt;\/component&gt; \t&lt;component name=&quot;example_filter_2&quot; type=&quot;example:filter2&quot;&gt;  \t\t&lt;logger&gt;daemon-logger&lt;\/logger&gt; \t&lt;\/component&gt; \t... &lt;\/components&gt; <\/code><\/pre>\n<p>  \u0424\u0438\u043b\u044c\u0442\u0440\u044b \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043b\u0438\u0431\u043e \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"xml\">&lt;handlers urlPrefix=&quot;\/myapp&quot;&gt; \t&lt;filter&gt; \t\t&lt;component name=&quot;example_filter_1&quot;\/&gt; \t&lt;\/filter&gt; \t... &lt;\/handlers&gt; <\/code><\/pre>\n<p>  \u043b\u0438\u0431\u043e \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0433\u0440\u0443\u043f\u043f\u044b \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0441 URL, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u043c\u0443 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044e:<\/p>\n<pre><code class=\"xml\">&lt;handlers urlPrefix=&quot;\/myapp&quot;&gt; \t&lt;filter url=&quot;\/.*&quot;&gt; \t\t&lt;component name=&quot;example_filter_2&quot;\/&gt; \t&lt;\/filter&gt; \t... &lt;\/handlers&gt; <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u043d\u0430\u0448\u0451\u043b \u0431\u043e\u043b\u0435\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u0434\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u0432 \u0442\u043e\u0439 \u0436\u0435 \u043e\u0447\u0435\u0440\u0451\u0434\u043d\u043e\u0441\u0442\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u044b\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b.<\/p>\n<p>  \u0414\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u043f\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0443 (\u0438\u043b\u0438 \u0446\u0435\u043b\u0435\u0432\u043e\u043c\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443\/\u0441\u0435\u0440\u0432\u043b\u0435\u0442\u0443, \u0435\u0441\u043b\u0438 \u0444\u0438\u043b\u044c\u0442\u0440 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0438\u043b\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u0438), \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0444\u0438\u043b\u044c\u0442\u0440 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>next<\/code>, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u0443\u044e \u0435\u043c\u0443 \u0447\u0435\u0440\u0435\u0437 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432. \u0414\u043b\u044f \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u0446\u0435\u043f\u043e\u0447\u043a\u0438 \u0444\u0438\u043b\u044c\u0442\u0440 \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u0435\u0437 \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>next<\/code>.<\/p>\n<p>  \u0412 \u043e\u0431\u0449\u0435\u043c, \u043a\u0430\u0436\u0434\u044b\u0439 \u0444\u0438\u043b\u044c\u0442\u0440 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0432\u0430 \u0440\u0430\u0437\u0430: \u0434\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0444\u0438\u043b\u044c\u0442\u0440\u0443 \u0438\u043b\u0438 \u0446\u0435\u043b\u0435\u0432\u043e\u043c\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443\/\u0441\u0435\u0440\u0432\u043b\u0435\u0442\u0443, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0441\u043b\u0435 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u0438\u043b\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\/\u0441\u0435\u0440\u0432\u043b\u0435\u0442\u0430. \u0424\u0438\u043b\u044c\u0442\u0440 \u043c\u043e\u0436\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0442\u0435\u043b\u043e \u043e\u0442\u0432\u0435\u0442\u0430 (response) \u0438\/\u0438\u043b\u0438 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 (HTTP headers) \u043a\u0430\u043a \u0434\u043e, \u0442\u0430\u043a \u0438 \u043f\u043e\u0441\u043b\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0446\u0435\u043b\u0435\u0432\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\/\u0441\u0435\u0440\u0432\u043b\u0435\u0442\u0430 \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438, \u0447\u0442\u043e \u0442\u0435\u043b\u043e \u0438 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u0435\u0449\u0451 \u043d\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b \u043a\u043b\u0438\u0435\u043d\u0442\u0443.<\/p>\n<h2>\u0410\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f<\/h2>\n<p>  \u0410\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u043c\u0438. \u0412 \u0441\u043e\u0441\u0442\u0430\u0432 Fastcgi Container \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u0444\u0438\u043b\u044c\u0442\u0440\u044b \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0442\u0438\u043f\u043e\u0432 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438: <code>Basic access authentication<\/code>, <code>Form authentication<\/code>, \u0438 <code>Delegated authentication<\/code>. <\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0438\u0437 \u043d\u0430\u0437\u0432\u0430\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u0443\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 HTTP \u0441\u0435\u0440\u0432\u0435\u0440\u0443, \u043e\u0436\u0438\u0434\u0430\u044f \u043e\u0442 \u043d\u0435\u0433\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u0430\u043a \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f CGI \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <code>REMOTE_USER<\/code>.<\/p>\n<p>  \u0414\u0432\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u0442\u0438\u043f\u0430 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u044e\u0442 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 <code>Security Realm<\/code>.<\/p>\n<p>  \u041a\u0430\u043a \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432, \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438:<\/p>\n<pre><code class=\"xml\">&lt;modules&gt; \t&lt;module name=&quot;auth&quot; path=&quot;\/usr\/local\/lib64\/fastcgi3\/fastcgi3-authenticator.so&quot;\/&gt;  \t... &lt;\/modules&gt; &lt;components&gt; \t&lt;component name=&quot;form_authenticator&quot; type=&quot;auth:form-authenticator&quot;&gt;  \t\t&lt;form-page&gt;\/login&lt;\/form-page&gt; \t\t&lt;realm&gt;example_realm&lt;\/realm&gt; \t\t&lt;logger&gt;daemon-logger&lt;\/logger&gt; \t\t&lt;store-request&gt;true&lt;\/store-request&gt; \t&lt;\/component&gt; \t&lt;component name=&quot;basic_authenticator&quot; type=&quot;auth:basic-authenticator&quot;&gt;  \t\t&lt;realm&gt;example_realm&lt;\/realm&gt; \t\t&lt;logger&gt;daemon-logger&lt;\/logger&gt; \t&lt;\/component&gt; \t&lt;component name=&quot;delegated_authenticator&quot; type=&quot;auth:delegated-authenticator&quot;&gt;  \t\t&lt;realm&gt;example_realm&lt;\/realm&gt; \t\t&lt;logger&gt;daemon-logger&lt;\/logger&gt; \t&lt;\/component&gt; \t... &lt;\/components&gt; <\/code><\/pre>\n<p>  \u0424\u0438\u043b\u044c\u0442\u0440 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u044b\u043c \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432: <\/p>\n<pre><code class=\"xml\">&lt;handlers urlPrefix=&quot;\/myapp&quot;&gt; \t&lt;filter url=&quot;\/.*&quot;&gt; \t\t&lt;component name=&quot;form_authenticator&quot;\/&gt; \t&lt;\/filter&gt; \t... &lt;\/handlers&gt; <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u0438\u043b\u044c\u0442\u0440\u044b \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 <code>Security Realm<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043a\u0430\u043a \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 <a href=\"https:\/\/github.com\/lpre\/Fastcgi-Container\/blob\/master\/include\/fastcgi3\/security_realm.h\"><code>fastcgi::security::Realm<\/code><\/a>:<\/p>\n<pre><code class=\"cpp\">class Realm : public fastcgi::Component { public: \tRealm(std::shared_ptr&lt;fastcgi::ComponentContext&gt; context); \tvirtual ~Realm(); \tvirtual void onLoad() override; \tvirtual void onUnload() override; \tvirtual std::shared_ptr&lt;Subject&gt; authenticate(const std::string& username, const std::string& credentials); \tvirtual std::shared_ptr&lt;Subject&gt; getSubject(const std::string& username); \tconst std::string& getName() const; protected: \tstd::string name_; \tstd::shared_ptr&lt;fastcgi::Logger&gt; logger_; }; <\/code><\/pre>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <code>Security Realm<\/code> \u0441 \u0437\u0430\u0434\u0430\u043d\u0438\u0435\u043c \u0441\u043f\u0438\u0441\u043a\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Security Realm<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">class ExampleRealm : virtual public fastcgi::security::Realm { public: \tExampleRealm(std::shared_ptr&lt;fastcgi::ComponentContext&gt; context); \tvirtual ~ExampleRealm(); \tvirtual void onLoad() override; \tvirtual void onUnload() override; \tvirtual std::shared_ptr&lt;fastcgi::security::Subject&gt; authenticate(const std::string& username, const std::string& credentials)  override; \tvirtual std::shared_ptr&lt;fastcgi::security::Subject&gt; getSubject(const std::string& username) override; private:     std::unordered_map&lt;std::string, std::shared_ptr&lt;UserData&gt;&gt; users_; };  ExampleRealm::ExampleRealm(std::shared_ptr&lt;fastcgi::ComponentContext&gt; context) : fastcgi::security::Realm(context) {     const fastcgi::Config *config = context-&gt;getConfig();     const std::string componentXPath = context-&gt;getComponentXPath();      std::vector&lt;std::string&gt; users;     config-&gt;subKeys(componentXPath+&quot;\/users\/user[count(@name)=1]&quot;, users);     for (auto& u : users) {         std::string username = config-&gt;asString(u + &quot;\/@name&quot;, &quot;&quot;);          std::shared_ptr&lt;UserData&gt; data = std::make_shared&lt;UserData&gt;();         data-&gt;password = config-&gt;asString(u + &quot;\/@password&quot;, &quot;&quot;);          std::vector&lt;std::string&gt; roles;         config-&gt;subKeys(u+&quot;\/role[count(@name)=1]&quot;, roles);         for (auto& r : roles) {         \tdata-&gt;roles.push_back(config-&gt;asString(r + &quot;\/@name&quot;, &quot;&quot;));         }          users_.insert({username, std::move(data)});     } }  ExampleRealm::~ExampleRealm() { \t; }  void ExampleRealm::onLoad() { \tfastcgi::security::Realm::onLoad(); }  void ExampleRealm::onUnload() { \tfastcgi::security::Realm::onUnload(); }  std::shared_ptr&lt;fastcgi::security::Subject&gt; ExampleRealm::authenticate(const std::string& username, const std::string& credentials) { \tstd::shared_ptr&lt;fastcgi::security::Subject&gt; subject; \tauto it = users_.find(username); \tif (users_.end()!=it && it-&gt;second && credentials==it-&gt;second-&gt;password) { \t\tsubject = std::make_shared&lt;fastcgi::security::Subject&gt;(); \t\tfor (auto &r : it-&gt;second-&gt;roles) { \t\t\tsubject-&gt;setPrincipal(std::make_shared&lt;fastcgi::security::Principal&gt;(r)); \t\t} \t\tsubject-&gt;setReadOnly(); \t} \treturn subject; }  std::shared_ptr&lt;fastcgi::security::Subject&gt; ExampleRealm::getSubject(const std::string& username)  { \tstd::shared_ptr&lt;fastcgi::security::Subject&gt; subject; \tauto it = users_.find(username); \tif (users_.end()!=it && it-&gt;second) { \t\tsubject = std::make_shared&lt;fastcgi::security::Subject&gt;(); \t\tfor (auto &r : it-&gt;second-&gt;roles) { \t\t\tsubject-&gt;setPrincipal(std::make_shared&lt;fastcgi::security::Principal&gt;(r)); \t\t} \t\tsubject-&gt;setReadOnly(); \t} \treturn subject; } <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u0415\u0433\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"xml\">&lt;modules&gt; \t&lt;module name=&quot;example&quot; path=&quot;.\/example.so&quot;\/&gt; \t... &lt;\/modules&gt; &lt;components&gt; \t&lt;component name=&quot;example_realm&quot; type=&quot;example:example-realm&quot;&gt;  \t\t&lt;name&gt;Example Realm&lt;\/name&gt; \t\t&lt;logger&gt;daemon-logger&lt;\/logger&gt; \t\t&lt;users&gt; \t\t\t&lt;user name=&quot;test1&quot; password=&quot;1234&quot;&gt; \t\t\t\t&lt;role name=&quot;ROLE1&quot;\/&gt; \t\t\t\t&lt;role name=&quot;ROLE2&quot;\/&gt; \t\t\t\t&lt;role name=&quot;ROLE3&quot;\/&gt; \t\t\t&lt;\/user&gt; \t\t\t&lt;user name=&quot;test2&quot; password=&quot;5678&quot;&gt; \t\t\t\t&lt;role name=&quot;ROLE1&quot;\/&gt; \t\t\t\t&lt;role name=&quot;ROLE4&quot;\/&gt; \t\t\t&lt;\/user&gt; \t\t&lt;\/users&gt; \t&lt;\/component&gt; \t... &lt;\/components&gt; <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u0438\u043b\u044c\u0442\u0440 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 <code>Form Authentication<\/code> \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0441\u0435\u0441\u0441\u0438\u0439. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u0435\u0441\u0441\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043e\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043d\u0435 \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0438\u0445 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e. <\/p>\n<h2>\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f<\/h2>\n<p>  \u0414\u043b\u044f \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442 <code>&lt;security-constraints&gt;<\/code> \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435: <\/p>\n<pre><code class=\"xml\">&lt;security-constraints&gt; \t&lt;constraint url=&quot;.*&quot; role=&quot;ROLE1&quot;\/&gt;  \t&lt;constraint url=&quot;\/servlet&quot; role=&quot;ROLE2&quot;\/&gt; &lt;\/security-constraints&gt; <\/code><\/pre>\n<p>  \u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e. \u0414\u043b\u044f \u044d\u0442\u043e\u0439 \u0446\u0435\u043b\u0438 \u043a\u043b\u0430\u0441\u0441\u044b <a href=\"https:\/\/github.com\/lpre\/Fastcgi-Container\/blob\/master\/include\/fastcgi3\/request.h#L148\"><code>fastcgi::Request<\/code><\/a> \u0438 <a href=\"https:\/\/github.com\/lpre\/Fastcgi-Container\/blob\/master\/include\/fastcgi3\/http_request.h#L99\"><code>fastcgi::HttpRequest<\/code><\/a> \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u043c\u0435\u0442\u043e\u0434\u044b:<\/p>\n<pre><code class=\"cpp\">std::shared_ptr&lt;security::Subject&gt; Request::getSubject() const; bool Request::isUserInRole(const std::string& roleName) const; template&lt;class T&gt; bool Request::isUserInRole(const std::string &roleName) { \treturn getSubject()-&gt;hasPrincipal&lt;T&gt;(roleName); } <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u043a\u043b\u0438\u0435\u043d\u0442 \u043d\u0435 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d, \u043c\u0435\u0442\u043e\u0434 <code>getSubject()<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442-\u00ab\u0430\u043d\u043e\u043d\u0438\u043c\u00bb \u0441 \u043f\u0443\u0441\u0442\u044b\u043c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c \u0440\u043e\u043b\u0435\u0439 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u043c <code>true<\/code> \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430:<\/p>\n<pre><code class=\"cpp\">bool security::Subject::isAnonymous() const; <\/code><\/pre>\n<p>  <\/p>\n<h2>\u0421\u0435\u0441\u0441\u0438\u0438<\/h2>\n<p>  \u041a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e <code>Simple Session Manager<\/code>. \u0414\u043b\u044f \u0435\u0433\u043e \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"xml\">&lt;modules&gt; \t&lt;module name=&quot;manager&quot; path=&quot;\/usr\/local\/lib64\/fastcgi3\/fastcgi3-session-manager.so&quot;\/&gt;  \t... &lt;\/modules&gt; &lt;components&gt; \t&lt;component name=&quot;session-manager&quot; type=&quot;manager:simple-session-manager&quot;&gt;\t\t\t \t\t&lt;logger&gt;daemon-logger&lt;\/logger&gt; \t&lt;\/component&gt; \t... &lt;\/components&gt; &lt;session attach=&quot;true&quot; component=&quot;session-manager&quot;&gt;     &lt;timeout&gt;30&lt;\/timeout&gt; &lt;\/session&gt; <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0441\u0435\u0441\u0441\u0438\u0438 \u043a\u043b\u0430\u0441\u0441 <a href=\"https:\/\/github.com\/lpre\/Fastcgi-Container\/blob\/master\/include\/fastcgi3\/request.h#L144\"><code>fastcgi::Request<\/code><\/a> \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u0435\u0442\u043e\u0434:<\/p>\n<pre><code class=\"cpp\">std::shared_ptr&lt;Session&gt; Request::getSession(); <\/code><\/pre>\n<p>  \u0421\u0440\u0435\u0434\u0438 \u043f\u0440\u043e\u0447\u0435\u0433\u043e, \u043a\u043b\u0430\u0441\u0441 <a href=\"https:\/\/github.com\/lpre\/Fastcgi-Container\/blob\/master\/include\/fastcgi3\/session.h\"><code>fastcgi::Session<\/code><\/a> \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b:<\/p>\n<pre><code class=\"cpp\">virtual void setAttribute(const std::string &name, const core::any &value); virtual core::any getAttribute(const std::string &name) const; virtual bool hasAttribute(const std::string &name) const; virtual void removeAttribute(const std::string& name); virtual void removeAllAttributes(); std::type_info const& type(const std::string &name) const; std::size_t addListener(ListenerType f); void removeListener(std::size_t index); <\/code><\/pre>\n<p>  <code>Simple Session Manager<\/code> \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u043d\u0430 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0435 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0440\u0435\u0436\u0438\u043c \u00absticky sessions\u00bb.<\/p>\n<p>  \u0412 \u0446\u0435\u043b\u043e\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0435\u0441\u0441\u0438\u0439 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0437\u0431\u0435\u0433\u0430\u0442\u044c \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445, \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u0441\u043e\u043a\u0430\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0435, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0441 \u0441\u0435\u0441\u0441\u0438\u044f\u043c\u0438 \u043f\u043b\u043e\u0445\u043e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u044e\u0442\u0441\u044f.<\/p>\n<h2>\u0421\u0435\u0440\u0432\u043b\u0435\u0442\u044b<\/h2>\n<p>  \u0412 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a \u043a\u043b\u0430\u0441\u0441\u0430\u043c <a href=\"https:\/\/github.com\/lpre\/Fastcgi-Container\/blob\/master\/include\/fastcgi3\/request.h#L68\"><code>fastcgi::Request<\/code><\/a> \u0438 <a href=\"https:\/\/github.com\/lpre\/Fastcgi-Container\/blob\/master\/include\/fastcgi3\/handler.h#L59\"><code>fastcgi::Handler<\/code><\/a>, \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043a\u043b\u0430\u0441\u0441\u044b-\u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438 <a href=\"https:\/\/github.com\/lpre\/Fastcgi-Container\/blob\/master\/include\/fastcgi3\/http_request.h#L36\"><code>fastcgi::HttpRequest<\/code><\/a>, <a href=\"https:\/\/github.com\/lpre\/Fastcgi-Container\/blob\/master\/include\/fastcgi3\/http_response.h#L45\"><code>fastcgi::HttpResponse<\/code><\/a> \u0438 <a href=\"https:\/\/github.com\/lpre\/Fastcgi-Container\/blob\/master\/include\/fastcgi3\/http_servlet.h#L36\"><code>fastcgi::Servlet<\/code><\/a>.<\/p>\n<p>  \u0412 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u00ab\u0441\u0442\u0430\u0440\u044b\u0435\u00bb \u0442\u0430\u043a \u0438 \u00ab\u043d\u043e\u0432\u044b\u0435\u00bb \u043a\u043b\u0430\u0441\u0441\u044b.<\/p>\n<h2>C++ Server Pages \u0438 Page Compiler<\/h2>\n<p>  Page Compiler \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0444\u043e\u0440\u043a\u043e\u043c \u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <a href=\"http:\/\/pocoproject.org\/docs\/PageCompilerUserGuide.html\">POCO<\/a>, \u0438 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u0438 HTML \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0441\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430\u043c\u0438 (C++ server pages, CPSP) \u0432 \u0441\u0435\u0440\u0432\u043b\u0435\u0442\u044b.<\/p>\n<p>  \u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 C++ server page:<\/p>\n<pre><code class=\"html\">&lt;%@ page class=&quot;TimeHandler&quot; %&gt; &lt;%@ component name=&quot;TestServlet&quot; %&gt; &lt;%!     #include &lt;chrono&gt; %&gt; &lt;%     auto p = std::chrono::system_clock::now();     auto t = std::chrono::system_clock::to_time_t(p); %&gt; &lt;html&gt;     &lt;head&gt;         &lt;title&gt;Time Sample&lt;\/title&gt;     &lt;\/head&gt;     &lt;body&gt;         &lt;h1&gt;Time Sample&lt;\/h1&gt;         &lt;p&gt;&lt;%= std::ctime(&t) %&gt;&lt;\/p&gt;     &lt;\/body&gt; &lt;\/html&gt; <\/code><\/pre>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e <a href=\"https:\/\/github.com\/lpre\/Fastcgi-Container\/blob\/master\/page-compiler\/docs\/page_compiler.md\">\u043d\u0430 GitHub \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/a>.       <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/280814\/\"> https:\/\/habrahabr.ru\/post\/280814\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043e \u043e\u0446\u0435\u043d\u043a\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 Web UI \u0434\u043b\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e C++ \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0445\u043e\u0440\u043e\u0448\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 <a href=\"https:\/\/github.com\/lmovsesjan\/Fastcgi-Daemon\">Fastcgi Daemon<\/a> \u0431\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a <a href=\"https:\/\/github.com\/lpre\/Fastcgi-Container\">Fastcgi Container<\/a>.<\/p>\n<p>  \u041f\u0440\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0438 \u0432\u0441\u0435\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0430, \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u043e\u0442 \u043d\u0435\u0433\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c:<\/p>\n<ul>\n<li>\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u043d \u043d\u0430 C++11<\/li>\n<li>\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432<\/li>\n<li>\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430<\/li>\n<li>\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0441\u0435\u0441\u0441\u0438\u0439<\/li>\n<li>\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0441\u0435\u0440\u0432\u043b\u0435\u0442\u043e\u0432 (\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438\u0437 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430)<\/li>\n<li>\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d Page Compiler \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f C++ \u0441\u0435\u0440\u0432\u043b\u0435\u0442\u043e\u0432 \u0438\u0437 JSP-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0446<\/li>\n<\/ul>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-277577","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/277577","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=277577"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/277577\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=277577"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=277577"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=277577"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}