Archive

Author Archive

AA+ v2.20

November 23, 2020 Leave a comment

Just to let everyone know that v2.20 of AA+ has been released. Updates for this version include:

  • Reworked CAADynamicalTime::TT2UTC & CAADynamicalTime::UTC2TT methods to use std::array::size instead of sizeof.
  • Reworked CAAELPMPP02::EclipticLatitude & CAAELPMPP02::RadiusVector methods to use std::array::size instead of sizeof.
Categories: Web Site Updates

AA+ v2.19

November 22, 2020 Leave a comment

Just to let everyone know that v2.19 of AA+ has been released. Updates for this version include:

  • Updated the observed DeltaT values from https://datacenter.iers.org/eop.php to 1st November 2020. The IERS web site is the definitive source for these values as the USNO websites which I have previously used are offline at the moment for modernization efforts (See https://www.usno.navy.mil/ for the details). To obtain values for DeltaT to add to the g_DeltaTValues table in AADynamicalTime.cpp, the value "UT1-UTC" was taken from Bulletin A and the formula: DeltaT = AccumulatedLeapsSeconds + 32.184 – (UT1-UTC) was used. The "AccumulatedLeapsSeconds" for 2020 is currently 37 seconds. If you plot the values for DeltaT for 2020 you will see that around June 2020 the value for DeltaT has started to decrease instead of the long term increasing trend for DeltaT. If this trend continues we may see the first negative leap second occur in the next few years.
Categories: Web Site Updates

AA+ v2.18

November 21, 2020 Leave a comment

Just to let everyone know that v2.18 of AA+ has been released. Updates for this version include:

  • Update the CMake project file for AA+ to require C++ 17 compilation. This fixes a compile issue when using CMake to build AA++ as the code requires C++ 17 compilation as of v2.13. Thanks to Kirill Dunko for reporting this issue.
Categories: Web Site Updates

WinHTTPWrappers v1.27

November 13, 2020 Comments off

Just to let everyone know that v1.27 of WinHTTPWrappers has been released. Updates for this version include:

  • Added support for new WinHttpReadDataEx & WinHttpQueryHeadersEx APIs available in latest Windows 10 SDK.
Categories: Web Site Updates

DtWinVer v2.46

November 11, 2020 Comments off

Just to let everyone know that v2.46 of DtWinVer has been released. Updates for this version include:

  • Renamed IsWindows10Codename20H2 method to IsWindows10Version20H2.
Categories: Web Site Updates

HTTPServerWrappers and CPPCThreadPool v1.0

November 8, 2020 Comments off

Just to let everyone know that v1.0 of HTTPServerWrappers and CPPCThreadPool has been released. One of the class frameworks I developed and published on my web site many years ago was W3MFC and CThreadPoolServer. These helped me learn how HTTP and HTTPS worked as well as learn multi-threaded coding on Windows. A lot has changed in the years since this code was initially developed and I wanted to develop a new framework which encapsulates the HTTP Server API’s available on Windows. These APIs let you embed an enterprise ready web server in your C++ Windows application. HTTPServerWrappers is a set of classes to encapsulate this functionality. To provide good performance you also need to tie this code to some sort of thread pool architecture. The CPPCThreadPool classes provide this thread pool functionality.

The classes provided are:

HTTPServer::CAutoInit This class provides a RAII wrapper for the SDK functions HttpInitialize and HttpTerminate.
HTTPServer::CSession This class provides a RAII wrapper for the SDK HTTP_SERVER_SESSION_ID typedef.
HTTPServer::CURLGroup This class provides a RAII wrapper for the SDK HTTP_URL_GROUP_ID typedef.
HTTPServer::CRequestQueue This class provides a RAII wrapper for the SDK request queue handle.
HTTPServer::CServer This class provides a actual class you can use in your client code to implement the HTTP server in your application.
CppConcurrency::CFunctionWrapper This class is used by the CThreadPool framework to implement its internal queue using std::packaged_task<>.
CppConcurrency::CThreadPool This class provides a thread pool framework written using just pure C++ 17 code.

 

Features

  • Encapsulates all the HTTP Server v2.0 functionality in a "HTTPServer" C++ namespace and is implemented in the HTTPServerWrappers.h header file.
  • Allows all the complicated HTTP server functionality to be customized using simple virtual methods in the HTTPServer::CServer class.
  • Provides a complete thread pool implementation using standard C++. This CppConcurrency::CThreadPool class is based on the thread pool implementation in the Advanced Thread Management Chapter in the book Concurrency in Action by Anthony Williams. The code also draws inspiration from https://github.com/dabbertorres/ThreadPool, https://github.com/f-squirrel/thread_pool & http://roar11.com/2016/01/a-platform-independent-thread-pool-using-c14/.
  • The thread pool is implemented in the CPPCThreadPool.h header file in just over 600 lines of code. It demonstrates a lot of C++ features such as: std::thread, std::thread::hardware_concurrency, std::unique_ptr, std::make_unique, std::shared_ptr, std::make_shared, std::move, r-value references, std::atomic, std::mutex, std::condition_variable, std::vector, std::queue, std::dequeue, thread local storage, std::unique_lock, std::lock_guard, std::this_thread::yield, std::for_each, std::generate_n, std::back_inserter, std::future, std::bind, std::invoke_result_t & std::packaged_task.
  • The thread pool implements optional per thread queues and task stealing, both unbounded and bounded synchronized queues and submitting tasks to a specific thread in the thread pool.
  • The thread pool implements waitable tasks using std::future and std::packaged_task.
  • The thread pool also supports optionally pumping the Windows message queue in the worker threads when compiled for Windows, custom worker thread initialization and cleanup and changing the number of threads in the thread pool dynamically.
  • A complete suite of unit tests are included in the demo application to test the thread pool classes.
  • Unicode enabled and all code compiles cleanly at warning level 4.
  • The code is /analyze clean and has been compiled using Clang-Tidy.
  • Please note that unlike W3MFC, the HTTPServerWrappers classes does not provide prebuilt ISAPI or CGI functionality. For this you will need to build your own functionality on top of the HTTPServerWrappers classes.

Usage

  • To use the thread pool classes, simply #include "CPPCThreadPool.h" in the module you want and instantiate a CThreadPool instance and uses its various methods.
  • The HTTPServer class framework uses the Windows HTTP Server APIs built into Windows. Because this web server is implemented in HTTP.sys, a kernel component of Windows, it is a shared resource amongst all running applications. To allow multiple applications to share this resource, you first need to reserve the URL which you want your web server application to use. This allows multiple applications to operate as web servers at the same time on your computer. This reservation process can be done programmatically using the HttpSetServiceConfiguration API or using the Windows command line utility netsh. An example netsh command line would be:
    netsh http add urlacl url=http://+:80/MyUri user=DOMAIN\user
    This would setup a reservation for a web server listening on port 80 over HTTP and responding to any requests which include /MyUri in its HTTP request. The "user" part of the command line is used to limit what specific Windows accounts can actually open the HTTP request queue associated with this URL reservation. The application which houses your web server must be running under this account to allow it to open the request queue successfully. To list all the current URL reservations setup on your computer you would use:
    netsh http show urlacl
    Normally this reservation process would be done at installation time of your Windows application. Please see https://docs.microsoft.com/en-us/windows/win32/http/routing-incoming-requests and the netsh documentation for further details on the reservation process.
  • To use the web server framework classes simply #include "HTTPServerWrappers.h" in the module you want and implement a class derived from HTTPServer::CServer and override its HandleRequest method to customize the HTTP responses your web server should return.
  • Once you have your reservation made, you should then be able to start your web server by passing the string "http://+:80/MyUri&quot; as one of the values to the HTTPServer::CServer::Start method. You can provide multiple URLs to the Start method if you want to handle multiple URLs from your application. The sample application included in the download passes the command line parameters it receives to this method and waits for a keypress to shutdown the application.
  • The sample application included in the download includes examples on handling a simple GET request example from in-memory, a GET directory system listing example, a GET example which returns a response from a file on the file system and a POST request which simply echoes back the received form request parameters.
  • Note that the code has been developed using Visual Studio 2019 and requires C++ 17 compilation mode and probably will not compile on earlier versions of Visual Studio.
  • The thread pool code has been developed in standard C++ 17 and should be compilable on non-Windows platforms although this has not been explicitly tested.
Categories: Web Site Updates

SSLWrappers v1.19

November 6, 2020 Comments off

Just to let everyone know that v1.19 of SSLWrappers has been released. Updates for this version include:

  • Fixed an issue where the m_lExtraReadData member variable is not reset in the SSLConnect and SSLAccept methods. This can lead to problems where a CSSL instance is reused to connect to another server or a TLS server connects to a new client. This issue was occurring in the SMTP code of the author when connecting to some SMTP servers which were using a pure SSL/TLS connection as opposed to STARTTLS. Thanks to Koen De Wolf for reporting this issue and helping fix it.
Categories: Web Site Updates

ODBCWrappers v1.18

October 13, 2020 Comments off

Just to let everyone know that v1.18 of ODBCWrappers has been released. Updates for this version include:

  • Fixed an issue in CHandle::GetDiagRecords and CHandle::ValidateReturnValue where the code would not terminate a loop if SQLGetDiagRec returns a value other than SQL_NO_DATA. Thanks to Serhiy Pavlov for reporting this issue.
Categories: Web Site Updates

ODBCWrappers v1.17

October 9, 2020 Comments off

Just to let everyone know that v1.17 of ODBCWrappers has been released. Updates for this version include:

  • Fixed a copy and paste error around the ODBC_COLUMN_ENTRY_LENGTH_STATUS macro. Thanks to Serhiy Pavlov for reporting this issue.
Categories: Web Site Updates

CScintillaCtrl, CScintillaView & CScintillaDoc v1.64

September 26, 2020 Comments off

Just to let everyone know that v1.64 of CScintillaCtrl, CScintillaView & CScintillaDoc has been released. Updates for this version include:

  • Updated class to work with Scintilla v4.4.5. New messages wrapped include: SCI_GETMULTIEDGECOLUMN.
Categories: Web Site Updates