Make app middlewares not require specific instances of app
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6f841ba..9c0ff40 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -58,8 +58,8 @@
 #add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY)
 add_definitions(-DBOOST_ALL_NO_LIB)
 set(Boost_USE_STATIC_LIBS ON)
-hunter_add_package(Boost COMPONENTS system thread iostreams)
-find_package(Boost REQUIRED system thread iostreams REQUIRED)
+hunter_add_package(Boost COMPONENTS system thread)
+find_package(Boost REQUIRED system thread REQUIRED)
 
 #Openssl
 hunter_add_package(OpenSSL)
@@ -69,7 +69,6 @@
 
 #g3 logging
 # G3logger does some unfortunate compile options, so cheat a little bit and copy/paste
-
 set(LOG_SRC ${CMAKE_CURRENT_SOURCE_DIR}/g3log/src)
 
 file(GLOB_RECURSE SRC_FILES ${LOG_SRC}/*.cpp ${LOG_SRC}/*.ipp)
@@ -85,6 +84,12 @@
 include_directories(${LOG_SRC})
 
 add_library(g3logger ${SRC_FILES})
+if(("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"))
+    set_source_files_properties(g3log/src/logcapture.cpp PROPERTIES COMPILE_FLAGS -Wno-braced-scalar-init)
+    set_source_files_properties(g3log/src/filesink.cpp PROPERTIES COMPILE_FLAGS -Wno-braced-scalar-init)
+    set_source_files_properties(g3log/src/logworker.cpp PROPERTIES COMPILE_FLAGS -Wno-braced-scalar-init)
+endif()
+
 set_target_properties(g3logger PROPERTIES
     LINKER_LANGUAGE CXX
     OUTPUT_NAME g3logger
@@ -97,8 +102,8 @@
 include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/crow/include)
 
 #Zlib
-#hunter_add_package(ZLIB)
-#find_package(ZLIB REQUIRED)
+hunter_add_package(ZLIB)
+find_package(ZLIB REQUIRED)
 
 # C++ GSL (Guideline support libraries)
 include_directories(gsl-lite/include)
@@ -135,6 +140,20 @@
 )
 
 set(UT_FILES
+    g3log/test_unit/test_cpp_future_concepts.cpp   
+    g3log/test_unit/tester_sharedlib.cpp  
+    # TODO(ed) figure out why this unit test has a main function in it
+    #g3log/test_unit/test_filechange.cpp  
+    g3log/test_unit/testing_helpers.h  
+    #TODO(ed)
+    #g3log/test_unit/test_linux_dynamic_loaded_sharedlib.cpp  
+    #g3log/test_unit/test_sink.cpp
+    g3log/test_unit/test_concept_sink.cpp  
+    g3log/test_unit/test_crashhandler_windows.cpp  
+    g3log/test_unit/tester_sharedlib.h    
+    g3log/test_unit/testing_helpers.cpp  
+    g3log/test_unit/test_io.cpp        
+    g3log/test_unit/test_message.cpp
     src/crowtest/crow_unittest.cpp
     src/gtest_main.cpp
     src/base64_test.cpp
@@ -142,6 +161,7 @@
     src/security_headers_middleware_test.cpp
     src/webassets_test.cpp
     src/crow_getroutes_test.cpp
+
     ${CMAKE_BINARY_DIR}/generated/blns.hpp
 )
 
@@ -160,11 +180,11 @@
 
     add_executable(unittest ${HDR_FILES} ${SRC_FILES} ${UT_FILES})
     target_link_libraries(unittest ${GMOCK_BOTH_LIBRARIES})
-    target_link_libraries(unittest Boost::system Boost::thread Boost::iostreams) 
+    target_link_libraries(unittest Boost::system Boost::thread) 
     target_link_libraries(unittest ${CMAKE_THREAD_LIBS_INIT})
     target_link_libraries(unittest OpenSSL::SSL OpenSSL::Crypto)
     target_link_libraries(unittest g3logger)
-    #target_link_libraries(unittest zlib)
+    target_link_libraries(unittest ${ZLIB_LIBRARIES})
     add_dependencies(unittest packagestaticcpp)
 endif(${BUILD_UT})
 
diff --git a/crow/include/crow/websocket.h b/crow/include/crow/websocket.h
index ac22d67..c148c37 100644
--- a/crow/include/crow/websocket.h
+++ b/crow/include/crow/websocket.h
@@ -113,7 +113,7 @@
   }
 
  protected:
-  std::string build_header(int opcode, size_t size) {
+  std::string build_header(int opcode, uint64_t size) {
     char buf[2 + 8] = "\x80\x00";
     buf[0] += opcode;
     if (size < 126) {
@@ -138,7 +138,7 @@
         "HTTP/1.1 101 Switching Protocols\r\n"
         "Upgrade: websocket\r\n"
         "Connection: Upgrade\r\n"
-        "Sec-WebSocket-Protocol: binary\n"  // TODO(ed): this hardcodes binary.
+        "Sec-WebSocket-Protocol: binary\n"  // TODO(ed): this hardcodes binary mode
                                             // find a better way
         "Sec-WebSocket-Accept: ";
     static std::string crlf = "\r\n";
diff --git a/docs/profile.md b/docs/profile.md
index b6a0019..848b275 100644
--- a/docs/profile.md
+++ b/docs/profile.md
@@ -5,4 +5,8 @@
 scp ed@hades.jf.intel.com:/home/ed/gperftools/.libs/libprofiler.so /tmp
 
 echo 1 >> /sys/module/video_drv/parameters/debug
-echo 8 > /proc/sys/kernel/printk
\ No newline at end of file
+echo 8 > /proc/sys/kernel/printk
+
+
+
+scp ed@hades.jf.intel.com:/home/ed/webserver/buildarm/getvideo /tmp -i /nv/.ssh/id_rsa && ./getvideo && scp screen.jpg ed@hades.jf.intel.com:~/screen.foo -i /nv/.ssh/id_rsa
\ No newline at end of file
diff --git a/g3log b/g3log
index a48a486..9f9062f 160000
--- a/g3log
+++ b/g3log
@@ -1 +1 @@
-Subproject commit a48a4860fd6acd94ef1bf66f398b7a8c6e096290
+Subproject commit 9f9062f45fa4cef05909b675ca5a9b82935c6869
diff --git a/include/crow/bmc_app_type.hpp b/include/crow/bmc_app_type.hpp
deleted file mode 100644
index 061143b..0000000
--- a/include/crow/bmc_app_type.hpp
+++ /dev/null
@@ -1,7 +0,0 @@
-#pragma once
-
-#include <crow/app.h>
-#include <token_authorization_middleware.hpp>
-#include <security_headers_middleware.hpp>
-
-using BmcAppType = crow::App<crow::TokenAuthorizationMiddleware, crow::SecurityHeadersMiddleware>;
\ No newline at end of file
diff --git a/include/g3log/generated_definitions.hpp b/include/g3log/generated_definitions.hpp
new file mode 100644
index 0000000..18433bb
--- /dev/null
+++ b/include/g3log/generated_definitions.hpp
@@ -0,0 +1,13 @@
+// AUTO GENERATED MACRO DEFINITIONS FOR G3LOG
+
+/** ==========================================================================
+* 2015 by KjellKod.cc. This is PUBLIC DOMAIN to use at your own risk and comes
+* with no warranties. This code is yours to share, use and modify with no
+* strings attached and no restrictions or obligations.
+* 
+* For more information see g3log/LICENSE or refer refer to http://unlicense.org
+* ============================================================================*/
+#pragma once
+
+// CMake induced definitions below. See g3log/Options.cmake for details.
+
diff --git a/include/web_kvm.hpp b/include/web_kvm.hpp
index 65fe812..40c5128 100644
--- a/include/web_kvm.hpp
+++ b/include/web_kvm.hpp
@@ -1,8 +1,7 @@
+#include <crow/app.h>
 #include <boost/endian/arithmetic.hpp>
 #include <string>
 
-#include <crow/bmc_app_type.hpp>
-
 #include <video.h>
 
 namespace crow {
@@ -176,7 +175,8 @@
 
 connection_metadata meta;
 
-void request_routes(BmcAppType& app) {
+template <typename... Middlewares>
+void request_routes(Crow<Middlewares...>& app) {
   CROW_ROUTE(app, "/kvmws")
       .websocket()
       .onopen([&](crow::websocket::connection& conn) {
diff --git a/scripts/build_web_assets.py b/scripts/build_web_assets.py
index d820c5a..bb55694 100755
--- a/scripts/build_web_assets.py
+++ b/scripts/build_web_assets.py
@@ -215,7 +215,6 @@
                          "#include <crow/http_response.h>\n"
                          "\n"
                          "#include <crow/routing.h>\n"
-                         "#include <crow/bmc_app_type.hpp>\n"
                          "\n"
                          "namespace crow {\n"
                          "namespace webassets {\n"
diff --git a/scripts/run_clang_tidy.py b/scripts/run_clang_tidy.py
new file mode 100755
index 0000000..c42463b
--- /dev/null
+++ b/scripts/run_clang_tidy.py
@@ -0,0 +1,218 @@
+#!/usr/bin/env python3
+#
+# ===- run-clang-tidy.py - Parallel clang-tidy runner ---------*- python -*--===#
+#
+#                     The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+# ===------------------------------------------------------------------------===#
+# FIXME: Integrate with clang-tidy-diff.py
+
+"""
+Parallel clang-tidy runner
+==========================
+
+Runs clang-tidy over all files in a compilation database. Requires clang-tidy
+and clang-apply-replacements in $PATH.
+
+Example invocations.
+- Run clang-tidy on all files in the current working directory with a default
+  set of checks and show warnings in the cpp files and all project headers.
+    run-clang-tidy.py $PWD
+
+- Fix all header guards.
+    run-clang-tidy.py -fix -checks=-*,llvm-header-guard
+
+- Fix all header guards included from clang-tidy and header guards
+  for clang-tidy headers.
+    run-clang-tidy.py -fix -checks=-*,llvm-header-guard extra/clang-tidy \
+                      -header-filter=extra/clang-tidy
+
+Compilation database setup:
+http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html
+"""
+
+import argparse
+import json
+import multiprocessing
+import os
+import queue
+import re
+import shutil
+import subprocess
+import sys
+import tempfile
+import threading
+
+
+def find_compilation_database(path):
+    """Adjusts the directory until a compilation database is found."""
+    result = './'
+    while not os.path.isfile(os.path.join(result, path)):
+        if os.path.realpath(result) == '/':
+            print('Error: could not find compilation database.')
+            sys.exit(1)
+        result += '../'
+    return os.path.realpath(result)
+
+
+def get_tidy_invocation(f, clang_tidy_binary, checks, tmpdir, build_path,
+                        header_filter, extra_arg, extra_arg_before, quiet):
+    """Gets a command line for clang-tidy."""
+    start = [clang_tidy_binary]
+    if header_filter is not None:
+        start.append('-header-filter=' + header_filter)
+    else:
+        # Show warnings in all in-project headers by default.
+        start.append('-header-filter=^' + build_path + '/.*')
+    if checks:
+        start.append('-checks=' + checks)
+    if tmpdir is not None:
+        start.append('-export-fixes')
+        # Get a temporary file. We immediately close the handle so clang-tidy can
+        # overwrite it.
+        (handle, name) = tempfile.mkstemp(suffix='.yaml', dir=tmpdir)
+        os.close(handle)
+        start.append(name)
+    for arg in extra_arg:
+        start.append('-extra-arg=%s' % arg)
+    for arg in extra_arg_before:
+        start.append('-extra-arg-before=%s' % arg)
+    start.append('-p=' + build_path)
+    if quiet:
+        start.append('-quiet')
+    start.append(f)
+    return start
+
+
+def apply_fixes(args, tmpdir):
+    """Calls clang-apply-fixes on a given directory. Deletes the dir when done."""
+    invocation = [args.clang_apply_replacements_binary]
+    if args.format:
+        invocation.append('-format')
+    invocation.append(tmpdir)
+    subprocess.call(invocation)
+    shutil.rmtree(tmpdir)
+
+
+def run_tidy(args, tmpdir, build_path, this_queue):
+    """Takes filenames out of queue and runs clang-tidy on them."""
+    while True:
+        name = this_queue.get()
+        invocation = get_tidy_invocation(
+            name, args.clang_tidy_binary, args.checks,
+                                         tmpdir, build_path, args.header_filter,
+                                         args.extra_arg, args.extra_arg_before,
+                                         args.quiet)
+        sys.stdout.write(' '.join(invocation) + '\n')
+        subprocess.call(invocation)
+        this_queue.task_done()
+
+
+def main():
+    parser = argparse.ArgumentParser(description='Runs clang-tidy over all files '
+                                     'in a compilation database. Requires '
+                                     'clang-tidy and clang-apply-replacements in '
+                                     '$PATH.')
+    parser.add_argument('-clang-tidy-binary', metavar='PATH',
+                        default='clang-tidy',
+                        help='path to clang-tidy binary')
+    parser.add_argument('-clang-apply-replacements-binary', metavar='PATH',
+                        default='clang-apply-replacements',
+                        help='path to clang-apply-replacements binary')
+    parser.add_argument('-checks', default=None,
+                        help='checks filter, when not specified, use clang-tidy '
+                        'default')
+    parser.add_argument('-header-filter', default=None,
+                        help='regular expression matching the names of the '
+                        'headers to output diagnostics from. Diagnostics from '
+                        'the main file of each translation unit are always '
+                        'displayed.')
+    parser.add_argument('-j', type=int, default=0,
+                        help='number of tidy instances to be run in parallel.')
+    parser.add_argument('files', nargs='*', default=['.*'],
+                        help='files to be processed (regex on path)')
+    parser.add_argument('-fix', action='store_true', help='apply fix-its')
+    parser.add_argument('-format', action='store_true', help='Reformat code '
+                        'after applying fixes')
+    parser.add_argument('-p', dest='build_path',
+                        help='Path used to read a compile command database.')
+    parser.add_argument('-extra-arg', dest='extra_arg',
+                        action='append', default=[],
+                        help='Additional argument to append to the compiler '
+                        'command line.')
+    parser.add_argument('-extra-arg-before', dest='extra_arg_before',
+                        action='append', default=[],
+                        help='Additional argument to prepend to the compiler '
+                        'command line.')
+    parser.add_argument('-quiet', action='store_true',
+                        help='Run clang-tidy in quiet mode')
+    args = parser.parse_args()
+
+    db_path = 'compile_commands.json'
+
+    if args.build_path is not None:
+        build_path = args.build_path
+    else:
+        # Find our database
+        build_path = find_compilation_database(db_path)
+
+    try:
+        invocation = [args.clang_tidy_binary, '-list-checks']
+        invocation.append('-p=' + build_path)
+        if args.checks:
+            invocation.append('-checks=' + args.checks)
+        invocation.append('-')
+        print(subprocess.check_output(invocation))
+    except:
+        print("Unable to run clang-tidy.", file=sys.stderr)
+        sys.exit(1)
+
+    # Load the database and extract all files.
+    database = json.load(open(os.path.join(build_path, db_path)))
+    files = [entry['file'] for entry in database]
+
+    max_task = args.j
+    if max_task == 0:
+        max_task = multiprocessing.cpu_count()
+
+    tmpdir = None
+    if args.fix:
+        tmpdir = tempfile.mkdtemp()
+
+    # Build up a big regexy filter from all command line arguments.
+    file_name_re = re.compile('|'.join(args.files))
+
+    try:
+        # Spin up a bunch of tidy-launching threads.
+        this_queue = queue.Queue(max_task)
+        for _ in range(max_task):
+            t = threading.Thread(target=run_tidy,
+                                 args=(args, tmpdir, build_path, this_queue))
+            t.daemon = True
+            t.start()
+
+        # Fill the queue with files.
+        for name in files:
+            if file_name_re.search(name):
+                this_queue.put(name)
+
+        # Wait for all threads to be done.
+        this_queue.join()
+
+    except KeyboardInterrupt:
+        # This is a sad hack. Unfortunately subprocess goes
+        # bonkers with ctrl-c and we start forking merrily.
+        print('\nCtrl-C detected, goodbye.')
+        if args.fix:
+            shutil.rmtree(tmpdir)
+        os.kill(0, 9)
+
+    if args.fix:
+        print('Applying fixes ...')
+        apply_fixes(args, tmpdir)
+
+if __name__ == '__main__':
+    main()
diff --git a/scripts/run_clang_tidy.py.bak b/scripts/run_clang_tidy.py.bak
new file mode 100644
index 0000000..b45d714
--- /dev/null
+++ b/scripts/run_clang_tidy.py.bak
@@ -0,0 +1,217 @@
+#!/usr/bin/env python
+#
+#===- run-clang-tidy.py - Parallel clang-tidy runner ---------*- python -*--===#
+#
+#                     The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+#===------------------------------------------------------------------------===#
+# FIXME: Integrate with clang-tidy-diff.py
+
+"""
+Parallel clang-tidy runner
+==========================
+
+Runs clang-tidy over all files in a compilation database. Requires clang-tidy
+and clang-apply-replacements in $PATH.
+
+Example invocations.
+- Run clang-tidy on all files in the current working directory with a default
+  set of checks and show warnings in the cpp files and all project headers.
+    run-clang-tidy.py $PWD
+
+- Fix all header guards.
+    run-clang-tidy.py -fix -checks=-*,llvm-header-guard
+
+- Fix all header guards included from clang-tidy and header guards
+  for clang-tidy headers.
+    run-clang-tidy.py -fix -checks=-*,llvm-header-guard extra/clang-tidy \
+                      -header-filter=extra/clang-tidy
+
+Compilation database setup:
+http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html
+"""
+
+import argparse
+import json
+import multiprocessing
+import os
+import Queue
+import re
+import shutil
+import subprocess
+import sys
+import tempfile
+import threading
+
+
+def find_compilation_database(path):
+  """Adjusts the directory until a compilation database is found."""
+  result = './'
+  while not os.path.isfile(os.path.join(result, path)):
+    if os.path.realpath(result) == '/':
+      print 'Error: could not find compilation database.'
+      sys.exit(1)
+    result += '../'
+  return os.path.realpath(result)
+
+
+def get_tidy_invocation(f, clang_tidy_binary, checks, tmpdir, build_path,
+                        header_filter, extra_arg, extra_arg_before, quiet):
+  """Gets a command line for clang-tidy."""
+  start = [clang_tidy_binary]
+  if header_filter is not None:
+    start.append('-header-filter=' + header_filter)
+  else:
+    # Show warnings in all in-project headers by default.
+    start.append('-header-filter=^' + build_path + '/.*')
+  if checks:
+    start.append('-checks=' + checks)
+  if tmpdir is not None:
+    start.append('-export-fixes')
+    # Get a temporary file. We immediately close the handle so clang-tidy can
+    # overwrite it.
+    (handle, name) = tempfile.mkstemp(suffix='.yaml', dir=tmpdir)
+    os.close(handle)
+    start.append(name)
+  for arg in extra_arg:
+      start.append('-extra-arg=%s' % arg)
+  for arg in extra_arg_before:
+      start.append('-extra-arg-before=%s' % arg)
+  start.append('-p=' + build_path)
+  if quiet:
+      start.append('-quiet')
+  start.append(f)
+  return start
+
+
+def apply_fixes(args, tmpdir):
+  """Calls clang-apply-fixes on a given directory. Deletes the dir when done."""
+  invocation = [args.clang_apply_replacements_binary]
+  if args.format:
+    invocation.append('-format')
+  invocation.append(tmpdir)
+  subprocess.call(invocation)
+  shutil.rmtree(tmpdir)
+
+
+def run_tidy(args, tmpdir, build_path, queue):
+  """Takes filenames out of queue and runs clang-tidy on them."""
+  while True:
+    name = queue.get()
+    invocation = get_tidy_invocation(name, args.clang_tidy_binary, args.checks,
+                                     tmpdir, build_path, args.header_filter,
+                                     args.extra_arg, args.extra_arg_before,
+                                     args.quiet)
+    sys.stdout.write(' '.join(invocation) + '\n')
+    subprocess.call(invocation)
+    queue.task_done()
+
+
+def main():
+  parser = argparse.ArgumentParser(description='Runs clang-tidy over all files '
+                                   'in a compilation database. Requires '
+                                   'clang-tidy and clang-apply-replacements in '
+                                   '$PATH.')
+  parser.add_argument('-clang-tidy-binary', metavar='PATH',
+                      default='clang-tidy',
+                      help='path to clang-tidy binary')
+  parser.add_argument('-clang-apply-replacements-binary', metavar='PATH',
+                      default='clang-apply-replacements',
+                      help='path to clang-apply-replacements binary')
+  parser.add_argument('-checks', default=None,
+                      help='checks filter, when not specified, use clang-tidy '
+                      'default')
+  parser.add_argument('-header-filter', default=None,
+                      help='regular expression matching the names of the '
+                      'headers to output diagnostics from. Diagnostics from '
+                      'the main file of each translation unit are always '
+                      'displayed.')
+  parser.add_argument('-j', type=int, default=0,
+                      help='number of tidy instances to be run in parallel.')
+  parser.add_argument('files', nargs='*', default=['.*'],
+                      help='files to be processed (regex on path)')
+  parser.add_argument('-fix', action='store_true', help='apply fix-its')
+  parser.add_argument('-format', action='store_true', help='Reformat code '
+                      'after applying fixes')
+  parser.add_argument('-p', dest='build_path',
+                      help='Path used to read a compile command database.')
+  parser.add_argument('-extra-arg', dest='extra_arg',
+                      action='append', default=[],
+                      help='Additional argument to append to the compiler '
+                      'command line.')
+  parser.add_argument('-extra-arg-before', dest='extra_arg_before',
+                      action='append', default=[],
+                      help='Additional argument to prepend to the compiler '
+                      'command line.')
+  parser.add_argument('-quiet', action='store_true',
+                      help='Run clang-tidy in quiet mode')
+  args = parser.parse_args()
+
+  db_path = 'compile_commands.json'
+
+  if args.build_path is not None:
+    build_path = args.build_path
+  else:
+    # Find our database
+    build_path = find_compilation_database(db_path)
+
+  try:
+    invocation = [args.clang_tidy_binary, '-list-checks']
+    invocation.append('-p=' + build_path)
+    if args.checks:
+      invocation.append('-checks=' + args.checks)
+    invocation.append('-')
+    print subprocess.check_output(invocation)
+  except:
+    print >>sys.stderr, "Unable to run clang-tidy."
+    sys.exit(1)
+
+  # Load the database and extract all files.
+  database = json.load(open(os.path.join(build_path, db_path)))
+  files = [entry['file'] for entry in database]
+
+  max_task = args.j
+  if max_task == 0:
+    max_task = multiprocessing.cpu_count()
+
+  tmpdir = None
+  if args.fix:
+    tmpdir = tempfile.mkdtemp()
+
+  # Build up a big regexy filter from all command line arguments.
+  file_name_re = re.compile('|'.join(args.files))
+
+  try:
+    # Spin up a bunch of tidy-launching threads.
+    queue = Queue.Queue(max_task)
+    for _ in range(max_task):
+      t = threading.Thread(target=run_tidy,
+                           args=(args, tmpdir, build_path, queue))
+      t.daemon = True
+      t.start()
+
+    # Fill the queue with files.
+    for name in files:
+      if file_name_re.search(name):
+        queue.put(name)
+
+    # Wait for all threads to be done.
+    queue.join()
+
+  except KeyboardInterrupt:
+    # This is a sad hack. Unfortunately subprocess goes
+    # bonkers with ctrl-c and we start forking merrily.
+    print '\nCtrl-C detected, goodbye.'
+    if args.fix:
+      shutil.rmtree(tmpdir)
+    os.kill(0, 9)
+
+  if args.fix:
+    print 'Applying fixes ...'
+    apply_fixes(args, tmpdir)
+
+if __name__ == '__main__':
+  main()
\ No newline at end of file
diff --git a/src/g3log/generated_definitions.hpp b/src/g3log/generated_definitions.hpp
new file mode 100644
index 0000000..18433bb
--- /dev/null
+++ b/src/g3log/generated_definitions.hpp
@@ -0,0 +1,13 @@
+// AUTO GENERATED MACRO DEFINITIONS FOR G3LOG
+
+/** ==========================================================================
+* 2015 by KjellKod.cc. This is PUBLIC DOMAIN to use at your own risk and comes
+* with no warranties. This code is yours to share, use and modify with no
+* strings attached and no restrictions or obligations.
+* 
+* For more information see g3log/LICENSE or refer refer to http://unlicense.org
+* ============================================================================*/
+#pragma once
+
+// CMake induced definitions below. See g3log/Options.cmake for details.
+
diff --git a/src/getvideo_main.cpp b/src/getvideo_main.cpp
index 2259b8c..182e8ad 100644
--- a/src/getvideo_main.cpp
+++ b/src/getvideo_main.cpp
@@ -39,14 +39,14 @@
     std::cout << "Writing\n";
     
     int status;
-    /*
+    
     status = write(video_fd, reinterpret_cast<char*>(&image_info),
                         sizeof(image_info));
     if (status != 0) {
       std::cout << "Write failed.  Return: " << status <<"\n";
       perror("perror output:");
     }
-    */
+    
     std::cout << "Write done\n";
     //std::this_thread::sleep_for(std::chrono::milliseconds(2000));
     
@@ -64,8 +64,9 @@
       std::cout << std::hex << std::setfill('0') << std::setw(2)
                 << int(*(pt + i)) << " ";
     }
-    std::cout << "\n";
-    /*
+    
+    std::cout << "\nprinting buffer\n";
+    
     for(int i = 0; i < 1024; i++){
         if (i % 16 == 0){
           std::cout << "\n";
@@ -73,7 +74,7 @@
         std::cout << std::hex << std::setfill('0') << std::setw(2)
             << int(buffer[i]) << " ";
     }
-    */
+    
     buffer.resize(image_info.len);
     
     std::ofstream f("/tmp/screen.jpg",std::ios::out | std::ios::binary); 
diff --git a/src/security_headers_middleware_test.cpp b/src/security_headers_middleware_test.cpp
index 2364ab5..fc183e9 100644
--- a/src/security_headers_middleware_test.cpp
+++ b/src/security_headers_middleware_test.cpp
@@ -40,13 +40,13 @@
   c.connect(asio::ip::tcp::endpoint(asio::ip::address::from_string("127.0.0.1"),
                                     45451));
   c.send(asio::buffer(sendmsg));
-  auto received_count = c.receive(asio::buffer(buf));
+  c.receive(asio::buffer(buf));
   c.close();
   auto return_code = std::string(&buf[9], &buf[12]);
   EXPECT_EQ("200", return_code);
   std::string response(std::begin(buf), std::end(buf));
 
-  // This is a routine to split strings until a newline is hit
+  // This is a routine to split strings until a blank is hit
   // TODO(ed) this should really use the HTTP parser
   std::vector<std::string> headers;
   std::string::size_type pos = 0;
diff --git a/src/token_authorization_middleware_test.cpp b/src/token_authorization_middleware_test.cpp
index 68efe8f..00eed2f 100644
--- a/src/token_authorization_middleware_test.cpp
+++ b/src/token_authorization_middleware_test.cpp
@@ -24,7 +24,7 @@
     c.connect(asio::ip::tcp::endpoint(
         asio::ip::address::from_string("127.0.0.1"), 45451));
     c.send(asio::buffer(sendmsg));
-    auto received_count = c.receive(asio::buffer(buf, 2048));
+    c.receive(asio::buffer(buf, 2048));
     c.close();
     EXPECT_EQ("200", std::string(buf + 9, buf + 12));
   }
@@ -66,7 +66,7 @@
     }
   }
   c.send(asio::buffer(sendmsg));
-  auto received_count = c.receive(asio::buffer(buf, 2048));
+  c.receive(asio::buffer(buf, 2048));
   c.close();
   EXPECT_EQ("401", std::string(buf + 9, buf + 12));
 
@@ -95,7 +95,7 @@
     }
   }
   c.send(asio::buffer(sendmsg));
-  auto received_count = c.receive(asio::buffer(buf, 2048));
+  c.receive(asio::buffer(buf, 2048));
   c.close();
   EXPECT_EQ("401", std::string(buf + 9, buf + 12));
 
@@ -118,7 +118,7 @@
     c.connect(asio::ip::tcp::endpoint(
         asio::ip::address::from_string("127.0.0.1"), 45451));
     c.send(asio::buffer(sendmsg));
-    auto received_count = c.receive(asio::buffer(buf));
+    c.receive(asio::buffer(buf));
     c.close();
   };
 
@@ -193,7 +193,7 @@
     c.connect(asio::ip::tcp::endpoint(
         asio::ip::address::from_string("127.0.0.1"), 45451));
     c.send(asio::buffer(sendmsg));
-    auto received_count = c.receive(asio::buffer(buf));
+    c.receive(asio::buffer(buf));
     c.close();
   };
 
diff --git a/src/udpclient.cpp b/src/udpclient.cpp
index 772739b..cf9f3d1 100644
--- a/src/udpclient.cpp
+++ b/src/udpclient.cpp
@@ -85,7 +85,7 @@
     udp::endpoint sender_endpoint;
     size_t len =
         socket.receive_from(boost::asio::buffer(recv_buf), sender_endpoint);
-
+    std::cout << len;
     for (auto character : recv_buf) {
       std::cout << std::hex << static_cast<unsigned>(character) << " ";
     }
diff --git a/src/webassets_test.cpp b/src/webassets_test.cpp
index 2157f03..8d0cfef 100644
--- a/src/webassets_test.cpp
+++ b/src/webassets_test.cpp
@@ -186,7 +186,6 @@
   while ((pos = response.find("\r\n", prev)) != std::string::npos) {
     auto this_string = response.substr(prev, pos - prev);
     if (this_string == "") {
-      prev = pos + 2;
       break;
     }
 
diff --git a/src/webserver_main.cpp b/src/webserver_main.cpp
index cf8500f..949bdc1 100644
--- a/src/webserver_main.cpp
+++ b/src/webserver_main.cpp
@@ -1,9 +1,7 @@
-#include <webassets.hpp>
 #include <web_kvm.hpp>
+#include <webassets.hpp>
 #include "ssl_key_handler.hpp"
 
-#include <crow/bmc_app_type.hpp>
-
 #include "crow/app.h"
 #include "crow/ci_map.h"
 #include "crow/common.h"
@@ -26,15 +24,15 @@
 #include "crow/utility.h"
 #include "crow/websocket.h"
 
-
 #include "color_cout_g3_sink.hpp"
 #include "webassets.hpp"
 
+#include "security_headers_middleware.hpp"
+#include "token_authorization_middleware.hpp"
 
 #include <boost/asio.hpp>
 #include <boost/endian/arithmetic.hpp>
 
-
 #include <iostream>
 #include <memory>
 #include <string>
@@ -52,13 +50,13 @@
   std::string ssl_pem_file("server.pem");
   ensuressl::ensure_openssl_key_present_and_valid(ssl_pem_file);
 
-  BmcAppType app;
+  crow::App<crow::TokenAuthorizationMiddleware, crow::SecurityHeadersMiddleware>
+      app;
 
   crow::webassets::request_routes(app);
   crow::kvm::request_routes(app);
 
   crow::logger::setLogLevel(crow::LogLevel::INFO);
-  app.debug_print();
   CROW_ROUTE(app, "/systeminfo")
   ([]() {
 
@@ -112,7 +110,7 @@
         size_t len =
             socket.receive_from(boost::asio::buffer(recv_buf), sender_endpoint);
         // TODO(ed) THis is ugly.  Find a way to not make a copy (ie, use
-        // std::string::data() to 
+        // std::string::data() to
         std::string str(std::begin(recv_buf), std::end(recv_buf));
         LOG(DEBUG) << "Got " << str << "back \n";
         conn.send_binary(str);
diff --git a/static/js/angular-ui-router.js b/static/js/angular-ui-router.js
index d977aa9..e8f5787 100644
--- a/static/js/angular-ui-router.js
+++ b/static/js/angular-ui-router.js
@@ -1003,7 +1003,7 @@
     if (isDefined(paramVal)) paramVal = param.type.decode(paramVal);
     values[paramName] = param.value(paramVal);
   }
-  for (/**/; i < nTotal; i++) {
+  for (; i < nTotal; i++) {
     paramName = paramNames[i];
     values[paramName] = this.params[paramName].value(searchParams[paramName]);
     param = this.params[paramName];