@@ -818,11 +818,7 @@ CMyHttpModule::OnBeginRequest(
818818 goto Finished;
819819 }
820820
821- // every 3 seconds we check for changes in config file
822- //
823- DWORD ctime = GetTickCount ();
824-
825- if (pConfig->m_Config == NULL || (ctime - pConfig->m_dwLastCheck ) > 3000 )
821+ if (pConfig->m_Config == NULL )
826822 {
827823 char *path;
828824 USHORT pathlen;
@@ -835,55 +831,42 @@ CMyHttpModule::OnBeginRequest(
835831 goto Finished;
836832 }
837833
838- WIN32_FILE_ATTRIBUTE_DATA fdata;
839- BOOL ret;
834+ pConfig->m_Config = modsecGetDefaultConfig ();
840835
841- ret = GetFileAttributesEx (path, GetFileExInfoStandard, &fdata);
836+ PCWSTR servpath = pHttpContext->GetApplication ()->GetApplicationPhysicalPath ();
837+ char *apppath;
838+ USHORT apppathlen;
842839
843- pConfig->m_dwLastCheck = ctime ;
840+ hr = pConfig->GlobalWideCharToMultiByte ((WCHAR *)servpath, wcslen (servpath), &apppath, &apppathlen) ;
844841
845- if (pConfig->m_Config == NULL || (ret != 0 && (pConfig->m_LastChange .dwLowDateTime != fdata.ftLastWriteTime .dwLowDateTime ||
846- pConfig->m_LastChange .dwHighDateTime != fdata.ftLastWriteTime .dwHighDateTime )))
842+ if ( FAILED ( hr ) )
847843 {
848- pConfig->m_LastChange .dwLowDateTime = fdata.ftLastWriteTime .dwLowDateTime ;
849- pConfig->m_LastChange .dwHighDateTime = fdata.ftLastWriteTime .dwHighDateTime ;
850-
851- pConfig->m_Config = modsecGetDefaultConfig ();
852-
853- PCWSTR servpath = pHttpContext->GetApplication ()->GetApplicationPhysicalPath ();
854- char *apppath;
855- USHORT apppathlen;
844+ delete path;
845+ hr = E_UNEXPECTED;
846+ goto Finished;
847+ }
856848
857- hr = pConfig->GlobalWideCharToMultiByte ((WCHAR *)servpath, wcslen (servpath), &apppath, &apppathlen);
849+ if (path[0 ] != 0 )
850+ {
851+ const char * err = modsecProcessConfig ((directory_config *)pConfig->m_Config , path, apppath);
858852
859- if ( FAILED ( hr ) )
853+ if (err != NULL )
860854 {
855+ WriteEventViewerLog (err, EVENTLOG_ERROR_TYPE);
856+ delete apppath;
861857 delete path;
862- hr = E_UNEXPECTED;
863858 goto Finished;
864859 }
865860
866- if (path[0 ] != 0 )
861+ modsecReportRemoteLoadedRules ();
862+ if (this ->status_call_already_sent == false )
867863 {
868- const char * err = modsecProcessConfig ((directory_config *)pConfig->m_Config , path, apppath);
869-
870- if (err != NULL )
871- {
872- WriteEventViewerLog (err, EVENTLOG_ERROR_TYPE);
873- delete apppath;
874- delete path;
875- goto Finished;
876- }
877-
878- modsecReportRemoteLoadedRules ();
879- if (this ->status_call_already_sent == false )
880- {
881- this ->status_call_already_sent = true ;
882- modsecStatusEngineCall ();
883- }
864+ this ->status_call_already_sent = true ;
865+ modsecStatusEngineCall ();
884866 }
885- delete apppath;
886867 }
868+
869+ delete apppath;
887870 delete path;
888871 }
889872
@@ -1140,7 +1123,9 @@ CMyHttpModule::OnBeginRequest(
11401123#endif
11411124 c->remote_host = NULL ;
11421125
1126+ LeaveCriticalSection (&m_csLock);
11431127 int status = modsecProcessRequest (r);
1128+ EnterCriticalSection (&m_csLock);
11441129
11451130 if (status != DECLINED)
11461131 {
0 commit comments