A PHP Error was encountered

Severity: 8192

Message: Function create_function() is deprecated

Filename: geshi/geshi.php

Line Number: 4698

Backtrace:

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4698
Function: _error_handler

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4621
Function: _optimize_regexp_list_tokens_to_string

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 1655
Function: optimize_regexp_list

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2029
Function: optimize_keyword_group

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2168
Function: build_parse_cache

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/Process.php
Line: 45
Function: parse_code

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/models/Pastes.php
Line: 517
Function: syntax

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/controllers/Main.php
Line: 693
Function: getPaste

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/index.php
Line: 315
Function: require_once

MyCodes - Stikked
From Jonneth, 5 Years ago, written in C++.
Embed
  1. #ifndef SERVER_HTTPS_HPP
  2. #define SERVER_HTTPS_HPP
  3.  
  4. #include "server_http.hpp"
  5.  
  6. #ifdef USE_STANDALONE_ASIO
  7. #include <asio/ssl.hpp>
  8. #else
  9. #include <boost/asio/ssl.hpp>
  10. #endif
  11.  
  12. #include <algorithm>
  13. #include <openssl/ssl.h>
  14.  
  15. namespace SimpleWeb {
  16.   using HTTPS = asio::ssl::stream<asio::ip::tcp::socket>;
  17.  
  18.   template <>
  19.   class Server<HTTPS> : public ServerBase<HTTPS> {
  20.     bool set_session_id_context = false;
  21.  
  22.   public:
  23.     Server(const std::string &cert_file, const std::string &private_key_file, const std::string &verify_file = std::string())
  24.         : ServerBase<HTTPS>::ServerBase(443), context(asio::ssl::context::tlsv12) {
  25.       context.use_certificate_chain_file(cert_file);
  26.       context.use_private_key_file(private_key_file, asio::ssl::context::pem);
  27.  
  28.       if(verify_file.size() > 0) {
  29.         context.load_verify_file(verify_file);
  30.         context.set_verify_mode(asio::ssl::verify_peer | asio::ssl::verify_fail_if_no_peer_cert | asio::ssl::verify_client_once);
  31.         set_session_id_context = true;
  32.       }
  33.     }
  34.  
  35.   protected:
  36.     asio::ssl::context context;
  37.  
  38.     void after_bind() override {
  39.       if(set_session_id_context) {
  40.         // Creating session_id_context from address:port but reversed due to small SSL_MAX_SSL_SESSION_ID_LENGTH
  41.         auto session_id_context = std::to_string(acceptor->local_endpoint().port()) + ':';
  42.         session_id_context.append(config.address.rbegin(), config.address.rend());
  43.         SSL_CTX_set_session_id_context(context.native_handle(), reinterpret_cast<const unsigned char *>(session_id_context.data()),
  44.                                        std::min<std::size_t>(session_id_context.size(), SSL_MAX_SSL_SESSION_ID_LENGTH));
  45.       }
  46.     }
  47.  
  48.     void accept() override {
  49.       auto connection = create_connection(*io_service, context);
  50.  
  51.       acceptor->async_accept(connection->socket->lowest_layer(), [this, connection](const error_code &ec) {
  52.         auto lock = connection->handler_runner->continue_lock();
  53.         if(!lock)
  54.           return;
  55.  
  56.         if(ec != asio::error::operation_aborted)
  57.           this->accept();
  58.  
  59.         auto session = std::make_shared<Session>(config.max_request_streambuf_size, connection);
  60.  
  61.         if(!ec) {
  62.           asio::ip::tcp::no_delay option(true);
  63.           error_code ec;
  64.           session->connection->socket->lowest_layer().set_option(option, ec);
  65.  
  66.           session->connection->set_timeout(config.timeout_request);
  67.           session->connection->socket->async_handshake(asio::ssl::stream_base::server, [this, session](const error_code &ec) {
  68.             session->connection->cancel_timeout();
  69.             auto lock = session->connection->handler_runner->continue_lock();
  70.             if(!lock)
  71.               return;
  72.             if(!ec)
  73.               this->read(session);
  74.             else if(this->on_error)
  75.               this->on_error(session->request, ec);
  76.           });
  77.         }
  78.         else if(this->on_error)
  79.           this->on_error(session->request, ec);
  80.       });
  81.     }
  82.   };
  83. } // namespace SimpleWeb
  84.  
  85. #endif /* SERVER_HTTPS_HPP */