{"id":211853,"date":"2014-02-08T01:10:03","date_gmt":"2014-02-07T21:10:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=211853"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=211853","title":{"rendered":"<span class=\"post_title\">\u041a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u044b\u0439 https \u0441\u0435\u0440\u0432\u0435\u0440 \u0441 \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u043c\u0438 \u0441\u043e\u043a\u0435\u0442\u0430\u043c\u0438. \u0427\u0430\u0441\u0442\u044c 2<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435\u043c \u0441\u0442\u0430\u0442\u0435\u0439:<br \/>  <a href=\"http:\/\/habrahabr.ru\/post\/211474\/\">\u041f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u043a\u0440\u043e\u0441c\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 ssl<\/a><br \/>  <a href=\"http:\/\/habrahabr.ru\/post\/211661\/\">\u041a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u044b\u0439 https \u0441\u0435\u0440\u0432\u0435\u0440 \u0441 \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u043c\u0438 \u0441\u043e\u043a\u0435\u0442\u0430\u043c\u0438 <\/a><br \/>  \u0412 \u044d\u0442\u0438\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445 \u044f \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0438\u0437 \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0432 \u0441\u043e\u0441\u0442\u0430\u0432 OpenSSL \u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 \u043e\u0434\u043d\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u044b\u0439 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440.<br \/>  \u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u00ab\u043d\u0430\u0443\u0447\u0438\u043b\u00bb \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043e\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0438 \u043e\u0442\u0441\u044b\u043b\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0442\u043d\u043e html \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0441 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430\u043c\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430.<br \/>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044e \u043a\u043e\u0434 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u043c\u043e\u0433 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043e\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435. <br \/>  <a name=\"habracut\"><\/a><br \/>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u044f \u0440\u0430\u0437\u043e\u0431\u044c\u044e \u043a\u043e\u0434 \u043d\u0430 \u0434\u0432\u0430 \u0444\u0430\u0439\u043b\u0430: serv.cpp \u0438 server.h<br \/>  \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b serv.cpp \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0432\u043e\u0442 \u00ab\u0432\u044b\u0441\u043e\u043a\u043e\u0438\u043d\u0442\u0435\u043b\u0435\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439\u00bb \u043a\u043e\u0434:  <\/p>\n<pre><code class=\"cpp\">#include &quot;server.h&quot;  int main() { \tserver::CServer(); \treturn 0; } <\/code><\/pre>\n<p>  \u0414\u0430, \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0438\u043d\u0430\u0442\u044c \u043c\u0435\u043d\u044f \u043d\u043e\u0433\u0430\u043c\u0438, \u043d\u043e \u044f \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043f\u0438\u0441\u0430\u043b, \u043f\u0438\u0448\u0443 \u0438 \u0431\u0443\u0434\u0443 \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u0430\u0445 \u0435\u0441\u043b\u0438 \u043c\u043d\u0435 \u044d\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u043e. \u0417\u0430 \u0442\u043e \u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438 \u043b\u044e\u0431\u043b\u044e \u0441++, \u0447\u0442\u043e \u043e\u043d \u0434\u0430\u0435\u0442 \u0441\u0432\u043e\u0431\u043e\u0434\u0443 \u0432\u044b\u0431\u043e\u0440\u0430, \u043d\u043e \u044d\u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u2026<\/p>\n<p>  \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0444\u0430\u0439\u043b\u0443 server.h<br \/>  \u0412 \u0435\u0433\u043e \u043d\u0430\u0447\u0430\u043b\u043e \u044f \u043f\u0435\u0440\u0435\u043d\u0435\u0441 \u0432\u0441\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438, \u043c\u0430\u043a\u0440\u043e\u0441\u044b \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u043d\u044c\u0448\u0435 \u0431\u044b\u043b\u0438 \u0432 serv.cpp, \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0435\u0449\u0435 \u043f\u0430\u0440\u0443 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u0438\u0437 STL:<\/p>\n<pre><code class=\"cpp\">#ifndef _SERVER #define _SERVER #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;memory.h&gt; #include &lt;errno.h&gt; #include &lt;sys\/types.h&gt;  #ifndef WIN32 #include &lt;unistd.h&gt; #include &lt;sys\/socket.h&gt; #include &lt;netinet\/in.h&gt; #include &lt;arpa\/inet.h&gt; #include &lt;netdb.h&gt; #else #include &lt;io.h&gt; #include &lt;Winsock2.h&gt; #pragma comment(lib, &quot;ws2_32.lib&quot;) #endif  #include &lt;openssl\/rsa.h&gt;       \/* SSLeay stuff *\/ #include &lt;openssl\/crypto.h&gt; #include &lt;openssl\/x509.h&gt; #include &lt;openssl\/pem.h&gt; #include &lt;openssl\/ssl.h&gt; #include &lt;openssl\/err.h&gt;  #include &lt;vector&gt; #include &lt;string&gt; #include &lt;sstream&gt; #include &lt;map&gt; #include &lt;memory&gt;  #ifdef WIN32 #define SET_NONBLOCK(socket)\t\\ \tif (true)\t\t\t\t\t\\ \t{\t\t\t\t\t\t\t\\ \t\tDWORD dw = true;\t\t\t\\ \t\tioctlsocket(socket, FIONBIO, &dw);\t\\ \t} #else #include &lt;fcntl.h&gt; #define SET_NONBLOCK(socket)\t\\ \tif (fcntl( socket, F_SETFL, fcntl( socket, F_GETFL, 0 ) | O_NONBLOCK ) &lt; 0)\t\\ \t\tprintf(&quot;error in fcntl errno=%i\\n&quot;, errno); #define closesocket(socket)  close(socket) #define Sleep(a) usleep(a*1000) #define SOCKET\tint #define INVALID_SOCKET\t-1 #endif   \/* define HOME to be dir for key and cert files... *\/ #define HOME &quot;.\/&quot; \/* Make these what you want for cert & key files *\/ #define CERTF  HOME &quot;ca-cert.pem&quot; #define KEYF  HOME  &quot;ca-cert.pem&quot;  #define CHK_ERR(err,s) if ((err)==-1) { perror(s); exit(1); }  <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u044c\u0448\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u043b\u0430\u0441\u0441\u044b CServer \u0438 CClient \u0432\u043d\u0443\u0442\u0440\u0438 namespace server:  <\/p>\n<pre><code class=\"cpp\">using namespace std; namespace server { \tclass CClient \t{ \t\t\/\/\u0414\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0433\u043e \u0441\u043e\u043a\u0435\u0442\u0430 \t\tSOCKET m_hSocket; \t\t\/\/\u0412 \u044d\u0442\u043e\u043c \u0431\u0443\u0444\u0435\u0440\u0435 \u043a\u043b\u0438\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043f\u0440\u0438\u043d\u044f\u0442\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \t\tvector&lt;unsigned char&gt; m_vRecvBuffer;  \t\t\/\/\u0412 \u044d\u0442\u043e\u043c \u0431\u0443\u0444\u0435\u0440\u0435 \u043a\u043b\u0438\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \t\tvector&lt;unsigned char&gt; m_vSendBuffer;  \t\t \t\t\/\/\u0423\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 OpenSSL \t\tSSL_CTX* m_pSSLContext; \t\tSSL* m_pSSL;  \t\t\/\/\u041d\u0430\u043c \u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \t\texplicit CClient(const CClient &client) {}  \tpublic: \t\tCClient(const SOCKET hSocket) :  \t\t\tm_hSocket(hSocket), m_pSSL(NULL), m_pSSLContext(NULL) {} \t\t~CClient() \t\t{ \t\t\tif(m_hSocket != INVALID_SOCKET)  \t\t\t\tclosesocket(m_hSocket); \t\t\tif (m_pSSL) \t\t\t\tSSL_free (m_pSSL); \t\t\tif (m_pSSLContext) \t\t\t\tSSL_CTX_free (m_pSSLContext); \t\t}\t  \t};  \tclass CServer \t{ \t\t\/\/\u0417\u0434\u0435\u0441\u044c \u0441\u0435\u0440\u0432\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432\u0441\u0435\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \t\tmap&lt;SOCKET, shared_ptr&lt;CClient&gt; &gt; m_mapClients; \t\t \t\t\/\/\u041d\u0430\u043c \u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \t\texplicit CServer(const CServer &server) {} \tpublic: \t\tCServer() {} \t}; }  #endif <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u044d\u0442\u043e \u043b\u0438\u0448\u044c \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u041d\u0430\u0447\u043d\u0435\u043c \u043f\u043e\u0442\u0438\u0445\u043e\u043d\u044c\u043a\u0443 \u043d\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u044d\u0442\u0443 \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043a\u0443 \u043a\u043e\u0434\u043e\u043c, \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0432 <a href=\"http:\/\/habrahabr.ru\/post\/211661\/\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>.<br \/>  \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441\u0432\u043e\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 SSL, \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 CClient  <\/p>\n<pre><code class=\"cpp\">\t\tCClient(const SOCKET hSocket) : m_hSocket(hSocket), m_pSSL(NULL), m_pSSLContext(NULL) \t\t{ #ifdef WIN32 \t\t\tconst SSL_METHOD *meth = SSLv23_server_method(); #else \t\t\tSSL_METHOD *meth = SSLv23_server_method(); #endif \t\t\tm_pSSLContext = SSL_CTX_new (meth); \t\t\tif (!m_pSSLContext) \t\t\t\tERR_print_errors_fp(stderr); \t\t \t\t\tif (SSL_CTX_use_certificate_file(m_pSSLContext, CERTF, SSL_FILETYPE_PEM) &lt;= 0) \t\t\t\tERR_print_errors_fp(stderr); \t\t\tif (SSL_CTX_use_PrivateKey_file(m_pSSLContext, KEYF, SSL_FILETYPE_PEM) &lt;= 0) \t\t\t\tERR_print_errors_fp(stderr);  \t\t\tif (!SSL_CTX_check_private_key(m_pSSLContext)) \t\t\t\tfprintf(stderr,&quot;Private key does not match the certificate public key\\n&quot;); \t\t} <\/code><\/pre>\n<p>  \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0443 \u0441\u043b\u0443\u0448\u0430\u044e\u0449\u0435\u0433\u043e \u0441\u043e\u043a\u0435\u0442\u0430 \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0435\u043c \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c\u0438 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 CServer:  <\/p>\n<pre><code class=\"cpp\">\t\tCServer() \t\t{ #ifdef WIN32 \t\t\tWSADATA wsaData; \t\t\tif ( WSAStartup( MAKEWORD( 2, 2 ), &wsaData ) != 0 ) \t\t\t{ \t\t\t\tprintf(&quot;Could not to find usable WinSock in WSAStartup\\n&quot;); \t\t\t\treturn; \t\t\t} #endif \t\t\tSSL_load_error_strings(); \t\t\tSSLeay_add_ssl_algorithms(); \t\t\t \t\t\t\/* ----------------------------------------------- *\/ \t\t\t\/* Prepare TCP socket for receiving connections *\/  \t\t\tSOCKET listen_sd = socket (AF_INET, SOCK_STREAM, 0);\t  CHK_ERR(listen_sd, &quot;socket&quot;); \t\t\tSET_NONBLOCK(listen_sd);    \t\t\tstruct sockaddr_in sa_serv; \t\t\tmemset (&sa_serv, '\\0', sizeof(sa_serv)); \t\t\tsa_serv.sin_family      = AF_INET; \t\t\tsa_serv.sin_addr.s_addr = INADDR_ANY; \t\t\tsa_serv.sin_port        = htons (1111);          \/* Server Port number *\/    \t\t\tint err = ::bind(listen_sd, (struct sockaddr*) &sa_serv, sizeof (sa_serv));      CHK_ERR(err, &quot;bind&quot;); \t      \t\t\t\/* Receive a TCP connection. *\/ \t\t\t \t\t\terr = listen (listen_sd, 5);            CHK_ERR(err, &quot;listen&quot;); \t\t} <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u044c\u0448\u0435 \u0432 \u044d\u0442\u043e\u043c \u0436\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u044f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 TCP \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f.<br \/>  \u041c\u043d\u0435 \u043d\u0438\u043a\u0442\u043e \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u043d\u0435 \u043f\u0440\u0438\u0432\u0435\u043b \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u043f\u0440\u043e\u0442\u0438\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043b\u0443\u0448\u0430\u0442\u044c TCP \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0432 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0446\u0438\u043a\u043b\u0435, \u043a\u0430\u043a \u0438 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435. <br \/>  \u041f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 accept \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u0432\u043d\u043e\u0432\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0432\u0448\u0438\u043c\u0441\u044f \u0438 \u0441 \u0443\u0436\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438, \u0432\u044b\u0437\u0432\u0430\u0432 callback \u0444\u0443\u043d\u043a\u0446\u0438\u044e.<br \/>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 CServer \u043f\u043e\u0441\u043b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 listen \u043a\u043e\u0434:<\/p>\n<pre><code class=\"cpp\"> \t\t\twhile(true) \t\t\t{ \t\t\t\tSleep(1);  \t\t\t\tstruct sockaddr_in sa_cli;   \t\t\t\tsize_t client_len = sizeof(sa_cli); #ifdef WIN32 \t\t\t\tconst SOCKET sd = accept (listen_sd, (struct sockaddr*) &sa_cli, (int *)&client_len); #else \t\t\t\tconst SOCKET sd = accept (listen_sd, (struct sockaddr*) &sa_cli, &client_len); #endif   \t\t\t\tCallback(sd); \t\t\t} <\/code><\/pre>\n<p>  \u0410 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e callback \u0444\u0443\u043d\u043a\u0446\u0438\u044e:  <\/p>\n<pre><code class=\"cpp\">\tprivate: \t\tvoid Callback(const SOCKET hSocket) \t\t{ \t\t\tif (hSocket != INVALID_SOCKET) \t\t\t\tm_mapClients[hSocket] = shared_ptr&lt;CClient&gt;(new CClient(hSocket)); \/\/\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430  \t\t\tauto it = m_mapClients.begin(); \t\t\twhile (it != m_mapClients.end()) \/\/\u041f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0432\u0441\u0435\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \t\t\t{ \t\t\t   if (!it-&gt;second-&gt;Continue()) \/\/\u0414\u0435\u043b\u0430\u0435\u043c \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u0441 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c \t\t\t\t  m_mapClients.erase(it++); \/\/\u0415\u0441\u043b\u0438 \u043a\u043b\u0438\u0435\u043d\u0442 \u0432\u0435\u0440\u043d\u0443\u043b false, \u0442\u043e \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \t\t\t   else \t\t\t\t  it++; \t\t\t} \t\t} <\/code><\/pre>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u043a\u043e\u0434 \u043a\u043b\u0430\u0441\u0441\u0430 CServer \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d! \u0412\u0441\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 CClient.<br \/>  <b>\u0412\u0430\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c<\/b>, \u0447\u0442\u043e \u0434\u043b\u044f \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u044b\u0445 \u043a \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0430 \u0432\u0441\u0435\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u0432 \u0446\u0438\u043a\u043b\u0435, \u043d\u0430\u0434\u043e \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432, \u0447\u044c\u0438 \u0441\u043e\u043a\u0435\u0442\u044b \u0433\u043e\u0442\u043e\u0432\u044b \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u0437\u0430\u043f\u0438\u0441\u0438. <br \/>  \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0435\u0440\u0435\u0431\u043e\u0440 \u043b\u0435\u0433\u043a\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0439 select \u0432 Windows \u0438\u043b\u0438 epoll \u0432 Linux. <b>\u042f \u043f\u043e\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435,<\/b> <br \/>  \u0410 \u043f\u043e\u043a\u0430 (\u0440\u0438\u0441\u043a\u0443\u044f \u043e\u043f\u044f\u0442\u044c \u043d\u0430\u0440\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043a\u0440\u0438\u0442\u0438\u043a\u0443) \u0432\u0441\u0435 \u0442\u0430\u043a\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0443\u0441\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0446\u0438\u043a\u043b\u043e\u043c.<\/p>\n<p>  \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u00ab\u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u043b\u043e\u0448\u0430\u0434\u043a\u0435\u00bb \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430: \u043a \u043a\u043b\u0430\u0441\u0441\u0443 CClient.<br \/>  \u041a\u043b\u0430\u0441\u0441 CClient \u0434\u043e\u043b\u0436\u0435\u043d \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0441\u0435\u0431\u0435 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0441\u0432\u043e\u0435\u043c \u0441\u043e\u043a\u0435\u0442\u0435, \u043d\u043e \u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0442\u043e\u043c, \u043d\u0430 \u043a\u0430\u043a\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0435\u0433\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c.<br \/>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 CClient \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:  <\/p>\n<pre><code class=\"cpp\">\tprivate: \t\t\/\/\u041f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0430. \u041f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u043e\u0432\u044b\u0435. \t\tenum STATES  \t\t{  \t\t\tS_ACCEPTED_TCP, \t\t\tS_ACCEPTED_SSL, \t\t\tS_READING, \t\t\tS_ALL_READED, \t\t\tS_WRITING, \t\t\tS_ALL_WRITED \t\t}; \t\tSTATES m_stateCurrent; \/\/\u0417\u0434\u0435\u0441\u044c \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435  \t\t\/\/\u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \t\tvoid SetState(const STATES state) {m_stateCurrent = state;} \t\tconst STATES GetState() const {return m_stateCurrent;} \tpublic: \t\t\/\/\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0442\u0435\u043a\u0443\u0436\u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \t\tconst bool Continue() \t\t{ \t\t\tif (m_hSocket == INVALID_SOCKET) \t\t\t\treturn false;  \t\t\tswitch (GetState()) \t\t\t{ \t\t\t\tcase S_ACCEPTED_TCP: \t\t\t\t\tbreak; \t\t\t\tcase S_ACCEPTED_SSL: \t\t\t\t\tbreak; \t\t\t\tcase S_READING: \t\t\t\t\tbreak; \t\t\t\tcase S_ALL_READED: \t\t\t\t\tbreak; \t\t\t\tcase S_WRITING: \t\t\t\t\tbreak; \t\t\t\tcase S_ALL_WRITED: \t\t\t\t\tbreak; \t\t\t\tdefault:  \t\t\t\t\treturn false; \t\t\t} \t\t\treturn true; \t\t} <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c Continue() \u044d\u0442\u043e \u043f\u043e\u043a\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f-\u0437\u0430\u0433\u043b\u0443\u0448\u043a\u0430, \u0447\u0443\u0442\u044c \u043d\u0438\u0436\u0435 \u043c\u044b \u0435\u0435 \u043d\u0430\u0443\u0447\u0438\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0432\u0441\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c.<\/p>\n<p>  \u0412 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043c:  <\/p>\n<pre><code class=\"cpp\">CClient(const SOCKET hSocket) : m_hSocket(hSocket), m_pSSL(NULL), m_pSSLContext(NULL) <\/code><\/pre>\n<p>  \u043d\u0430   <\/p>\n<pre><code class=\"cpp\">CClient(const SOCKET hSocket) : m_hSocket(hSocket), m_pSSL(NULL), m_pSSLContext(NULL), m_stateCurrent(S_ACCEPTED_TCP) <\/code><\/pre>\n<p>  \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u043a\u043b\u0438\u0435\u043d\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0440\u0430\u0437\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0414\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c\u0441\u044f, \u0447\u0442\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043c\u043e\u0436\u043d\u043e \u043c\u0435\u043d\u044f\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u0438 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 Continue(), \u044d\u0442\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u043a\u043e\u0434\u0430, \u043d\u043e \u0437\u0430\u0442\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u0442 \u0435\u0433\u043e \u043e\u0442\u043b\u0430\u0434\u043a\u0443.<\/p>\n<p>  \u0418\u0442\u0430\u043a \u043f\u0435\u0440\u0432\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043a\u043b\u0438\u0435\u043d\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435: S_ACCEPTED_TCP.<br \/>  \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u0443 \u043d\u0435\u0433\u043e \u044d\u0442\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435:<br \/>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u0442\u0440\u043e\u043a\u0438:  <\/p>\n<pre><code class=\"cpp\">\t\t\t\tcase S_ACCEPTED_TCP: \t\t\t\t\tbreak; <\/code><\/pre>\n<p>  \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435:  <\/p>\n<pre><code class=\"cpp\">\t\t\t\tcase S_ACCEPTED_TCP: \t\t\t\t{ \t\t\t\t\tswitch (AcceptSSL()) \t\t\t\t\t{ \t\t\t\t\t\tcase RET_READY: \t\t\t\t\t\t\tprintf (&quot;SSL connection using %s\\n&quot;, SSL_get_cipher (m_pSSL)); \t\t\t\t\t\t\tSetState(S_ACCEPTED_SSL); \t\t\t\t\t\t\tbreak; \t\t\t\t\t\tcase RET_ERROR: \t\t\t\t\t\t\treturn false; \t\t\t\t\t}  \t\t\t\t\treturn true; \t\t\t\t} <\/code><\/pre>\n<p>  \u0410 \u0442\u0430\u043a \u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0432 \u043a\u043b\u0430\u0441\u0441 CClient:  <\/p>\n<pre><code class=\"cpp\">\tprivate: \t\tenum RETCODES \t\t{ \t\t\tRET_WAIT, \t\t\tRET_READY, \t\t\tRET_ERROR \t\t}; \t\tconst RETCODES AcceptSSL() \t\t{ \t\t\tif (!m_pSSLContext) \/\/\u041d\u0430\u0448 \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f SSL \t\t\t\treturn RET_ERROR;  \t\t\tif (!m_pSSL) \t\t\t{ \t\t\t\tm_pSSL = SSL_new (m_pSSLContext); \t\t\t\t \t\t\t\tif (!m_pSSL) \t\t\t\t\treturn RET_ERROR;  \t\t\t\tSSL_set_fd (m_pSSL, m_hSocket); \t\t\t}  \t\t\tconst int err = SSL_accept (m_pSSL);   \t\t\tconst int nCode = SSL_get_error(m_pSSL, err); \t\t\tif ((nCode != SSL_ERROR_WANT_READ) && (nCode != SSL_ERROR_WANT_WRITE)) \t\t\t\treturn RET_READY;  \t\t\treturn RET_WAIT; \t\t} <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044f AcceptSSL() \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u043f\u043e\u043a\u0430 \u043d\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430.<\/p>\n<p>  1. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f CClient::AcceptSSL() \u0432\u0435\u0440\u043d\u0435\u0442 \u043a\u043e\u0434 RET_ERROR \u0432 \u0432\u044b\u0437\u0432\u0430\u0430\u0448\u0443\u044e \u0435\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e CClient::Continue(), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u0435\u0440\u043d\u0435\u0442 false \u0432\u044b\u0437\u0432\u0430\u0432\u0448\u0435\u0439 \u0435\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 CServer::Callback, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0434\u0430\u043b\u0438\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0438\u0437 \u043f\u0430\u043c\u044f\u0442\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<br \/>  2. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0434\u0430\u0447\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f CClient::AcceptSSL() \u0432\u0435\u0440\u043d\u0435\u0442 \u043a\u043e\u0434 RET_READY \u0432 \u0432\u044b\u0437\u0432\u0430\u0432\u0448\u0443\u044e \u0435\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e CClient::Continue(), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043d\u0430 S_ACCEPTED_SSL. <\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f S_ACCEPTED_SSL. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u0442\u0440\u043e\u043a\u0438  <\/p>\n<pre><code class=\"cpp\"> \t\t\t\tcase S_ACCEPTED_SSL: \t\t\t\t\tbreak; <\/code><\/pre>\n<p>  \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043c \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435:  <\/p>\n<pre><code class=\"cpp\">\t\t\t\tcase S_ACCEPTED_SSL: \t\t\t\t{ \t\t\t\t\tswitch (GetSertificate()) \t\t\t\t\t{ \t\t\t\t\t\tcase RET_READY: \t\t\t\t\t\t\tSetState(S_READING); \t\t\t\t\t\t\tbreak; \t\t\t\t\t\tcase RET_ERROR: \t\t\t\t\t\t\treturn false; \t\t\t\t\t}  \t\t\t\t\treturn true; \t\t\t\t} <\/code><\/pre>\n<p>  \u0418 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 CClient \u0444\u0443\u043d\u043a\u0446\u0438\u044e:  <\/p>\n<pre><code class=\"cpp\">\t\tconst RETCODES GetSertificate() \t\t{ \t\t\tif (!m_pSSLContext || !m_pSSL) \/\/\u041d\u0430\u0448 \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f SSL \t\t\t\treturn RET_ERROR; \t\t\t \t\t\t\/* Get client's certificate (note: beware of dynamic allocation) - opt *\/  \t\t\tX509* client_cert = SSL_get_peer_certificate (m_pSSL); \t\t\tif (client_cert != NULL)  \t\t\t{ \t\t\t\tprintf (&quot;Client certificate:\\n&quot;);      \t\t\t\tchar* str = X509_NAME_oneline (X509_get_subject_name (client_cert), 0, 0); \t\t\t\tif (!str) \t\t\t\t\treturn RET_ERROR;  \t\t\t\tprintf (&quot;\\t subject: %s\\n&quot;, str); \t\t\t\tOPENSSL_free (str);      \t\t\t\tstr = X509_NAME_oneline (X509_get_issuer_name  (client_cert), 0, 0); \t\t\t\tif (!str) \t\t\t\t\treturn RET_ERROR;  \t\t\t\tprintf (&quot;\\t issuer: %s\\n&quot;, str); \t\t\t\tOPENSSL_free (str);      \t\t\t\t\/* We could do all sorts of certificate verification stuff here before \t\t\t\t\tdeallocating the certificate. *\/      \t\t\t\tX509_free (client_cert); \t\t\t}  \t\t\telse \t\t\t\tprintf (&quot;Client does not have certificate.\\n&quot;);  \t\t\treturn RET_READY; \t\t} <\/code><\/pre>\n<p>  \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439, \u0432\u044b\u0437\u043e\u0432\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0438 \u0432\u0435\u0440\u043d\u0435\u0442 \u0432 CClient::Continue \u043b\u0438\u0431\u043e RET_ERROR \u043b\u0438\u0431\u043e RET_READY. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e CClient::Continue \u0432\u0435\u0440\u043d\u0435\u0442 \u043b\u0438\u0431\u043e false, \u043b\u0438\u0431\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043d\u0430 S_READING.<\/p>\n<p>  \u0414\u0430\u043b\u044c\u0448\u0435 \u0432\u0441\u0435 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e: \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u043a\u043e\u0434  <\/p>\n<pre><code class=\"cpp\">\t\t\t\tcase S_READING: \t\t\t\t\tbreak; \t\t\t\tcase S_ALL_READED: \t\t\t\t\tbreak; \t\t\t\tcase S_WRITING: \t\t\t\t\tbreak; <\/code><\/pre>\n<p>  \u043d\u0430 \u0442\u0430\u043a\u043e\u0439:  <\/p>\n<pre><code class=\"cpp\">\t\t\t\tcase S_READING: \t\t\t\t{ \t\t\t\t\tswitch (ContinueRead()) \t\t\t\t\t{ \t\t\t\t\t\tcase RET_READY: \t\t\t\t\t\t\tSetState(S_ALL_READED); \t\t\t\t\t\t\tbreak; \t\t\t\t\t\tcase RET_ERROR: \t\t\t\t\t\t\treturn false; \t\t\t\t\t}  \t\t\t\t\treturn true; \t\t\t\t} \t\t\t\tcase S_ALL_READED: \t\t\t\t{ \t\t\t\t\tswitch (InitRead()) \t\t\t\t\t{ \t\t\t\t\t\tcase RET_READY: \t\t\t\t\t\t\tSetState(S_WRITING); \t\t\t\t\t\t\tbreak; \t\t\t\t\t\tcase RET_ERROR: \t\t\t\t\t\t\treturn false; \t\t\t\t\t}  \t\t\t\t\treturn true; \t\t\t\t} \t\t\t\tcase S_WRITING: \t\t\t\t{ \t\t\t\t\tswitch (ContinueWrite()) \t\t\t\t\t{ \t\t\t\t\t\tcase RET_READY: \t\t\t\t\t\t\tSetState(S_ALL_WRITED); \t\t\t\t\t\t\tbreak; \t\t\t\t\t\tcase RET_ERROR: \t\t\t\t\t\t\treturn false; \t\t\t\t\t}  \t\t\t\t\treturn true; \t\t\t\t} <\/code><\/pre>\n<p>  \u0418 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439:  <\/p>\n<pre><code class=\"cpp\">\t\tconst RETCODES ContinueRead() \t\t{ \t\t\tif (!m_pSSLContext || !m_pSSL) \/\/\u041d\u0430\u0448 \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f SSL \t\t\t\treturn RET_ERROR;  \t\t\tunsigned char szBuffer[4096]; \t\t\t \t\t\tconst int err = SSL_read (m_pSSL, szBuffer, 4096); \/\/\u0447\u0438\u0442\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0432 \u0431\u0443\u0444\u0435\u0440 \t\t\tif (err &gt; 0) \t\t\t{ \t\t\t\t\/\/\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 m_vRecvBuffer \t\t\t\tm_vRecvBuffer.resize(m_vRecvBuffer.size()+err); \t\t\t\tmemcpy(&m_vRecvBuffer[m_vRecvBuffer.size()-err], szBuffer, err); \t\t  \t\t\t\t\/\/\u0418\u0449\u0435\u043c \u043a\u043e\u043d\u0435\u0446 http \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 \u0432 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \t\t\t\tconst std::string strInputString((const char *)&m_vRecvBuffer[0]); \t\t\t\tif (strInputString.find(&quot;\\r\\n\\r\\n&quot;) != -1) \t\t\t\t\treturn RET_READY;  \t\t\t\treturn RET_WAIT; \t\t\t}  \t\t\tconst int nCode = SSL_get_error(m_pSSL, err); \t\t\tif ((nCode != SSL_ERROR_WANT_READ) && (nCode != SSL_ERROR_WANT_WRITE)) \t\t\t\treturn RET_ERROR; \t\t\t \t\t\treturn RET_WAIT; \t\t}  \t\tconst RETCODES InitRead() \t\t{ \t\t\tif (!m_pSSLContext || !m_pSSL) \/\/\u041d\u0430\u0448 \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f SSL \t\t\t\treturn RET_ERROR;  \t\t\t\/\/\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u0431\u0443\u0444\u0435\u0440 \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \t\t\tconst std::string strInputString((const char *)&m_vRecvBuffer[0]);  \t\t\t\/\/\u0424\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c html \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0441 \u043e\u0442\u0432\u0435\u0442\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \t\t\tconst std::string strHTML =  \t\t\t\t  &quot;&lt;html&gt;&lt;body&gt;&lt;h2&gt;Hello! Your HTTP headers is:&lt;\/h2&gt;&lt;br&gt;&lt;pre&gt;&quot; +  \t\t\t\t  strInputString.substr(0, strInputString.find(&quot;\\r\\n\\r\\n&quot;)) +  \t\t\t\t  &quot;&lt;\/pre&gt;&lt;\/body&gt;&lt;\/html&gt;&quot;;  \t\t\t\/\/\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043d\u0430\u0447\u0430\u043b\u043e \u043e\u0442\u0432\u0435\u0442\u0430 http \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a  \t\t\tstd::ostringstream strStream; \t\t\tstrStream &lt;&lt;  \t\t\t\t\t&quot;HTTP\/1.1 200 OK\\r\\n&quot; \t\t\t\t\t&lt;&lt; &quot;Content-Type: text\/html; charset=utf-8\\r\\n&quot; \t\t\t\t\t&lt;&lt; &quot;Content-Length: &quot; &lt;&lt; strHTML.length() &lt;&lt; &quot;\\r\\n&quot; &lt;&lt; \t\t\t\t\t&quot;\\r\\n&quot; &lt;&lt; \t\t\t\t\tstrHTML.c_str();  \t\t\t\/\/\u0417\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u043e\u0442\u0432\u0435\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u0441\u043b\u0430\u0442\u044c \t\t\tm_vSendBuffer.resize(strStream.str().length()); \t\t\tmemcpy(&m_vSendBuffer[0], strStream.str().c_str(), strStream.str().length());  \t\t\treturn RET_READY; \t\t} \t\tconst RETCODES ContinueWrite() \t\t{ \t\t\tif (!m_pSSLContext || !m_pSSL) \/\/\u041d\u0430\u0448 \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f SSL \t\t\t\treturn RET_ERROR;  \t\t\tint err = SSL_write (m_pSSL, &m_vSendBuffer[0], m_vSendBuffer.size()); \t\t\tif (err &gt; 0) \t\t\t{ \t\t\t\t\/\/\u0415\u0441\u043b\u0438 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u0441\u043b\u0430\u0442\u044c \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0442\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044e \t\t\t\tif (err == m_vSendBuffer.size()) \t\t\t\t\treturn RET_READY;  \t\t\t\t\/\/\u0415\u0441\u043b\u0438 \u043e\u0442\u043e\u0441\u043b\u0430\u043b\u0438 \u043d\u0435 \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0442\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0432 \u0431\u0443\u0444\u0435\u0440\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e, \u0447\u0442\u043e \u0435\u0449\u0435 \u043d\u0435 \u043f\u043e\u0441\u043b\u0430\u043d\u043e \t\t\t\tvector&lt;unsigned char&gt; vTemp(m_vSendBuffer.size()-err); \t\t\t\tmemcpy(&vTemp[0], &m_vSendBuffer[err], m_vSendBuffer.size()-err); \t\t\t\tm_vSendBuffer = vTemp;  \t\t\t\treturn RET_WAIT; \t\t\t} \t  \t\t\tconst int nCode = SSL_get_error(m_pSSL, err); \t\t\tif ((nCode != SSL_ERROR_WANT_READ) && (nCode != SSL_ERROR_WANT_WRITE)) \t\t\t\treturn RET_ERROR;  \t\t\treturn RET_WAIT; \t\t} <\/code><\/pre>\n<p>  \u041d\u0430\u0448 \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u043e\u043a\u0430 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u043b\u0438\u0448\u044c \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u0435\u0433\u043e http \u0437\u0430\u043f\u0440\u043e\u0441\u0430.<br \/>  \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0441\u0435\u0440\u0432\u0435\u0440 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b \u0441\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043a\u0440\u044b\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u0431\u044b\u0442\u044c \u043f\u0440\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430.<br \/>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u043d\u0430\u0448 \u043a\u043e\u0434 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0432\u043d\u0435\u0441\u0442\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435:  <\/p>\n<pre><code class=\"cpp\"> \t\t\t\tcase S_ALL_WRITED: \t\t\t\t\tbreak; <\/code><\/pre>\n<p>  \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0430  <\/p>\n<pre><code class=\"cpp\">\t\t\t\tcase S_ALL_WRITED: \t\t\t\t\treturn false; <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0438 \u0432\u0441\u0435! \u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u044b\u0439 \u043e\u0434\u043d\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u044b\u0439 https \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430 \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u0441\u043e\u043a\u0435\u0442\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0435 (\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0435 \u043b\u0438\u0448\u044c \u043f\u0430\u043c\u044f\u0442\u044c\u044e \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b) \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439.<\/p>\n<p>  \u0410\u0440\u0445\u0438\u0432 \u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c \u0434\u043b\u044f Visual Studio 2012 \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0437\u0434\u0435\u0441\u044c: <a href=\"http:\/\/00.3s3s.org\">00.3s3s.org<\/a><br \/>  \u0427\u0442\u043e\u0431\u044b \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 Linux \u043d\u0430\u0434\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u043e\u0434\u043d\u0443 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0444\u0430\u0439\u043b\u044b: serv.cpp, server.h, ca-cert.pem \u0438 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u043d\u0430\u0431\u0440\u0430\u0442\u044c: \u00abg++ -std=c++0x -L\/usr\/lib -lssl -lcrypto serv.cpp\u00bb    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/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=\"http:\/\/habrahabr.ru\/post\/211853\/\"> http:\/\/habrahabr.ru\/post\/211853\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435\u043c \u0441\u0442\u0430\u0442\u0435\u0439:<br \/>  <a href=\"http:\/\/habrahabr.ru\/post\/211474\/\">\u041f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u043a\u0440\u043e\u0441c\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 ssl<\/a><br \/>  <a href=\"http:\/\/habrahabr.ru\/post\/211661\/\">\u041a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u044b\u0439 https \u0441\u0435\u0440\u0432\u0435\u0440 \u0441 \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u043c\u0438 \u0441\u043e\u043a\u0435\u0442\u0430\u043c\u0438 <\/a><br \/>  \u0412 \u044d\u0442\u0438\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445 \u044f \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0438\u0437 \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0432 \u0441\u043e\u0441\u0442\u0430\u0432 OpenSSL \u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 \u043e\u0434\u043d\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u044b\u0439 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440.<br \/>  \u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u00ab\u043d\u0430\u0443\u0447\u0438\u043b\u00bb \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043e\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0438 \u043e\u0442\u0441\u044b\u043b\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0442\u043d\u043e html \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0441 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430\u043c\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430.<br \/>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044e \u043a\u043e\u0434 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u043c\u043e\u0433 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043e\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435.   <\/p>\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-211853","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/211853","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=211853"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/211853\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=211853"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=211853"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=211853"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}