@@ -810,19 +810,8 @@ CMyHttpModule::OnBeginRequest(
810810 }
811811EnterCriticalSection (&m_csLock);
812812
813- // Get the config again, in case it changed during the time we released the lock
814- hr =MODSECURITY_STORED_CONTEXT::GetConfig (pHttpContext, &pConfig);
815- if (FAILED (hr))
816- {
817- hr = S_OK;
818- goto Finished;
819- }
820813
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 )
814+ if (pConfig->m_Config ==NULL )
826815{
827816char *path;
828817USHORT pathlen;
@@ -835,55 +824,42 @@ CMyHttpModule::OnBeginRequest(
835824goto Finished;
836825}
837826
838- WIN32_FILE_ATTRIBUTE_DATA fdata;
839- BOOL ret;
827+ pConfig->m_Config =modsecGetDefaultConfig ();
840828
841- ret =GetFileAttributesEx (path, GetFileExInfoStandard, &fdata);
829+ PCWSTR servpath = pHttpContext->GetApplication ()->GetApplicationPhysicalPath ();
830+ char *apppath;
831+ USHORT apppathlen;
842832
843- pConfig->m_dwLastCheck = ctime ;
833+ hr = pConfig->GlobalWideCharToMultiByte ((WCHAR *)servpath, wcslen (servpath), &apppath, &apppathlen) ;
844834
845- if (pConfig->m_Config ==NULL || (ret !=0 && (pConfig->m_LastChange .dwLowDateTime != fdata.ftLastWriteTime .dwLowDateTime ||
846- pConfig->m_LastChange .dwHighDateTime != fdata.ftLastWriteTime .dwHighDateTime )))
835+ if (FAILED ( hr ) )
847836{
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;
837+ delete path;
838+ hr = E_UNEXPECTED;
839+ goto Finished;
840+ }
856841
857- hr = pConfig->GlobalWideCharToMultiByte ((WCHAR *)servpath,wcslen (servpath), &apppath, &apppathlen);
842+ if (path[0 ] !=0 )
843+ {
844+ const char * err =modsecProcessConfig ((directory_config *)pConfig->m_Config , path, apppath);
858845
859- if ( FAILED ( hr ) )
846+ if (err != NULL )
860847{
848+ WriteEventViewerLog (err, EVENTLOG_ERROR_TYPE);
849+ delete apppath;
861850delete path;
862- hr = E_UNEXPECTED;
863851goto Finished;
864852}
865853
866- if (path[0 ] !=0 )
854+ modsecReportRemoteLoadedRules ();
855+ if (this ->status_call_already_sent ==false )
867856{
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- }
857+ this ->status_call_already_sent =true ;
858+ modsecStatusEngineCall ();
884859}
885- delete apppath;
886860}
861+
862+ delete apppath;
887863delete path;
888864}
889865
@@ -1140,7 +1116,9 @@ CMyHttpModule::OnBeginRequest(
11401116#endif
11411117c->remote_host =NULL ;
11421118
1119+ LeaveCriticalSection (&m_csLock);
11431120int status =modsecProcessRequest (r);
1121+ EnterCriticalSection (&m_csLock);
11441122
11451123if (status != DECLINED)
11461124{