Skip to content

Development

Architecture

TODO

How to configure and upgrade boost

  • The repo contains boost_1.75 ( Dec 11th 2020 )
  • In upgrading to later versions, the following steps are to be done in Windows after extracting the desired version.
  • Clear any cached prior builds If needed.
    • run rmdir stage /s /q
    • run rmdir bin.v2 /s /q
  • run bootstrap.bat
  • run b2 asmflags=\safeseh variant=release link=static runtime-link=static -a --with-filesystem --with-coroutine --with-context --with-date_time --with-regex -j 8
    • asmflags explanation
    • -a is to always rebuild
    • -runtime-link=static corresponds to VS' Runtime Library Setting (/MT), x86 builds link to boost -mt-lib while x64 link to mt-s-x64-lib
  • The stage/lib and the entire boost library is only needed after building. The following headers were removed to minimize file clutter (https://www.boost.org/doc/libs/1_75_0/):
    • rm -rf polygon beast beast.hpp compute compute.hpp fiber flyweight flyweight.hpp geometry geometry.hpp gil gil.hpp graph hana hana.hpp mp11 mp11.hpp python python.hpp proto phoenix phoenix.hpp qvm spirit spirit.hpp test leaf leaf.hpp locale locale.hpp

Update submodules

git submodule update --init

Updating the version number on a new release

Update VERSION Update the values in .\SigsciIISModule\Version.h Update $env:SIGSCI_PREVIOUS_VERSION in .\packaging\package.ps1

Testing

This module uses the standard module-testing framework, but with the caveat of having to do the testing on Windows with docker.

See: module_testing/README.md

Development Notes and Documentation

Overview of how the module executes:

  • When the Application Pool is started by IIS, it will call RegisterModule (in Main.cpp) once.
  • RegisterModule will create a single instance of Factory which will be held by IIS for the remainder of the process.
  • Every time an HTTP request comes in, IIS will call Factory::GetHttpModule. This method will create an instance of Module, which will live for the duration of that one HTTP request.
  • Module::OnBeginRequest is called.
    • On the first request to be serviced by the Module class, some initialization is performed:
      • The IIS configuration is read (specifically SignalSciences element described above).
      • This configuration is used to initialize the AgentRpc code.
    • The RPC.PreRequest message is sent to the Agent.
  • Processing continues through the other methods on the Module instance as appropriate (OnAsyncCompletion, OnPostEndRequest, OnSendResponse, not necessarily in that order).
  • Once the request has completed, IIS will call Dispose(), where we make the RPC.PostRequest or RPC.UpdateRequest call as appropriate.
  • When the Application Pool is being shut down, IIS will call Factory::Terminate on the Factory instance we created on startup. This shuts down the AgentRpc code.

IIS 7 Documentation

IIS 7 documentation is sparse. These links were helpful in understanding the details of IIS native module development:

  • http://jennylawblog.azurewebsites.net/2015/07/17/iis-native-module-2/
  • https://www.iis.net/learn/develop/runtime-extensibility/develop-a-native-cc-module-for-iis
  • https://forums.iis.net/t/1155643.aspx#1895087
  • https://www.iis.net/learn/get-started/planning-your-iis-architecture/introduction-to-applicationhostconfig
  • https://forums.iis.net/t/1148510.aspx?Calculating+bytes+sent+in+C+Native+Module+