<commit_before>/*
 * Copyright (c) 2010 Digital Bazaar, Inc. All rights reserved.
 */
#define __STDC_FORMAT_MACROS
#define __STDC_LIMIT_MACROS
#define __STDC_CONSTANT_MACROS

#include "monarch/ws/WebServer.h"

#include "monarch/crypto/AsymmetricKeyFactory.h"
#include "monarch/data/json/JsonWriter.h"
#include "monarch/logging/Logging.h"
#include "monarch/net/NullSocketDataPresenter.h"
#include "monarch/net/SslSocketDataPresenter.h"

using namespace std;
using namespace monarch::config;
using namespace monarch::crypto;
using namespace monarch::data::json;
using namespace monarch::http;
using namespace monarch::io;
using namespace monarch::net;
using namespace monarch::rt;
using namespace monarch::util;
using namespace monarch::ws;

WebServer::WebServer() :
   mServer(NULL),
   mHostAddress(NULL),
   mSslContext(NULL),
   mSocketDataPresenterList(NULL),
   mServiceId(Server::sInvalidServiceId)
{
}

WebServer::~WebServer()
{
}

bool WebServer::initialize(Config& cfg)
{
   bool rval = true;

   MO_CAT_DEBUG(MO_WS_CAT, "WebServer initializing...");

   // get basic config
   // security: on/off/both
   bool secure;
   bool nonSecure;
   const char* security = cfg["security"]->getString();
   if(strcasecmp(security, "on"))
   {
      secure = true;
      nonSecure = false;
   }
   else if(strcasecmp(security, "off"))
   {
      secure = false;
      nonSecure = true;
   }
   else
   {
      secure = nonSecure = true;<commit_msg>Fixed strcasecmp.<commit_after>/*
 * Copyright (c) 2010 Digital Bazaar, Inc. All rights reserved.
 */
#define __STDC_FORMAT_MACROS
#define __STDC_LIMIT_MACROS
#define __STDC_CONSTANT_MACROS

#include "monarch/ws/WebServer.h"

#include "monarch/crypto/AsymmetricKeyFactory.h"
#include "monarch/data/json/JsonWriter.h"
#include "monarch/logging/Logging.h"
#include "monarch/net/NullSocketDataPresenter.h"
#include "monarch/net/SslSocketDataPresenter.h"

using namespace std;
using namespace monarch::config;
using namespace monarch::crypto;
using namespace monarch::data::json;
using namespace monarch::http;
using namespace monarch::io;
using namespace monarch::net;
using namespace monarch::rt;
using namespace monarch::util;
using namespace monarch::ws;

WebServer::WebServer() :
   mServer(NULL),
   mHostAddress(NULL),
   mSslContext(NULL),
   mSocketDataPresenterList(NULL),
   mServiceId(Server::sInvalidServiceId)
{
}

WebServer::~WebServer()
{
}

bool WebServer::initialize(Config& cfg)
{
   bool rval = true;

   MO_CAT_DEBUG(MO_WS_CAT, "WebServer initializing...");

   // get basic config
   // security: on/off/both
   bool secure;
   bool nonSecure;
   const char* security = cfg["security"]->getString();
   if(strcasecmp(security, "on") == 0)
   {
      secure = true;
      nonSecure = false;
   }
   else if(strcasecmp(security, "off") == 0)
   {
      secure = false;
      nonSecure = true;
   }
   else
   {
      secure = nonSecure = true;
{'fraction_non_alphanumeric': 0.1256887052341598, 'fraction_numerical': 0.003443526170798898, 'mean_word_length': 4.533333333333333, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3352292', 'n_tokens_mistral': 998, 'n_tokens_neox': 962, 'n_words': 210}