|
|
@@ -81,84 +81,6 @@ static const int HttpUnauthorized = 401;
|
|
|
#define PROP_EXECUTABLE "executable"
|
|
|
#define PROP_OWNER "owner"
|
|
|
#define PROP_DISPLAY_NAME "displayname"
|
|
|
-//---------------------------------------------------------------------------
|
|
|
-static std::unique_ptr<TCriticalSection> DebugSection(TraceInitPtr(new TCriticalSection));
|
|
|
-static std::set<TWebDAVFileSystem *> FileSystems;
|
|
|
-//---------------------------------------------------------------------------
|
|
|
-extern "C"
|
|
|
-{
|
|
|
-
|
|
|
-void ne_debug(void * Context, int Channel, const char * Format, ...)
|
|
|
-{
|
|
|
- bool DoLog;
|
|
|
-
|
|
|
- if (FLAGSET(Channel, NE_DBG_SOCKET) ||
|
|
|
- FLAGSET(Channel, NE_DBG_HTTP) ||
|
|
|
- FLAGSET(Channel, NE_DBG_HTTPAUTH) ||
|
|
|
- FLAGSET(Channel, NE_DBG_SSL))
|
|
|
- {
|
|
|
- DoLog = true;
|
|
|
- }
|
|
|
- else if (FLAGSET(Channel, NE_DBG_XML) ||
|
|
|
- FLAGSET(Channel, NE_DBG_WINSCP_HTTP_DETAIL))
|
|
|
- {
|
|
|
- DoLog = (Configuration->ActualLogProtocol >= 1);
|
|
|
- }
|
|
|
- else if (FLAGSET(Channel, NE_DBG_LOCKS) ||
|
|
|
- FLAGSET(Channel, NE_DBG_XMLPARSE) ||
|
|
|
- FLAGSET(Channel, NE_DBG_HTTPBODY))
|
|
|
- {
|
|
|
- DoLog = (Configuration->ActualLogProtocol >= 2);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- DoLog = false;
|
|
|
- DebugFail();
|
|
|
- }
|
|
|
-
|
|
|
- #ifndef _DEBUG
|
|
|
- if (DoLog)
|
|
|
- #endif
|
|
|
- {
|
|
|
- va_list Args;
|
|
|
- va_start(Args, Format);
|
|
|
- UTF8String UTFMessage;
|
|
|
- UTFMessage.vprintf(Format, Args);
|
|
|
- va_end(Args);
|
|
|
-
|
|
|
- UnicodeString Message = TrimRight(UTFMessage);
|
|
|
-
|
|
|
- if (DoLog)
|
|
|
- {
|
|
|
- // Note that this gets called for THttp sessions too.
|
|
|
- // It does no harm atm.
|
|
|
- TWebDAVFileSystem * FileSystem = NULL;
|
|
|
- if (Context != NULL)
|
|
|
- {
|
|
|
- ne_session * Session = static_cast<ne_session *>(Context);
|
|
|
-
|
|
|
- FileSystem =
|
|
|
- static_cast<TWebDAVFileSystem *>(ne_get_session_private(Session, SESSION_FS_KEY));
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- TGuard Guard(DebugSection.get());
|
|
|
-
|
|
|
- if (FileSystems.size() == 1)
|
|
|
- {
|
|
|
- FileSystem = *FileSystems.begin();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (FileSystem != NULL)
|
|
|
- {
|
|
|
- FileSystem->NeonDebug(Message);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-} // extern "C"
|
|
|
//------------------------------------------------------------------------------
|
|
|
//---------------------------------------------------------------------------
|
|
|
// ne_path_escape returns 7-bit string, so it does not really matter if we use
|
|
|
@@ -253,7 +175,7 @@ TWebDAVFileSystem::TWebDAVFileSystem(TTerminal * ATerminal) :
|
|
|
//---------------------------------------------------------------------------
|
|
|
__fastcall TWebDAVFileSystem::~TWebDAVFileSystem()
|
|
|
{
|
|
|
- UnregisterFromDebug();
|
|
|
+ UnregisterFromNeonDebug(FTerminal);
|
|
|
|
|
|
{
|
|
|
TGuard Guard(FNeonLockStoreSection);
|
|
|
@@ -280,7 +202,7 @@ void __fastcall TWebDAVFileSystem::Open()
|
|
|
FTerminal->LogEvent(L"Warning: SSPI initialization failed.");
|
|
|
}
|
|
|
|
|
|
- RegisterForDebug();
|
|
|
+ RegisterForNeonDebug(FTerminal);
|
|
|
|
|
|
FCurrentDirectory = L"";
|
|
|
FHasTrailingSlash = true;
|
|
|
@@ -386,7 +308,7 @@ void __fastcall TWebDAVFileSystem::InitSession(ne_session_s * Session)
|
|
|
|
|
|
InitNeonSession(
|
|
|
Session, Data->ProxyMethod, Data->ProxyHost, Data->ProxyPort,
|
|
|
- Data->ProxyUsername, Data->ProxyPassword);
|
|
|
+ Data->ProxyUsername, Data->ProxyPassword, FTerminal);
|
|
|
|
|
|
ne_set_read_timeout(FNeonSession, Data->Timeout);
|
|
|
|
|
|
@@ -549,19 +471,7 @@ void __fastcall TWebDAVFileSystem::Close()
|
|
|
CloseNeonSession();
|
|
|
FTerminal->Closed();
|
|
|
FActive = false;
|
|
|
- UnregisterFromDebug();
|
|
|
-}
|
|
|
-//---------------------------------------------------------------------------
|
|
|
-void __fastcall TWebDAVFileSystem::RegisterForDebug()
|
|
|
-{
|
|
|
- TGuard Guard(DebugSection.get());
|
|
|
- FileSystems.insert(this);
|
|
|
-}
|
|
|
-//---------------------------------------------------------------------------
|
|
|
-void __fastcall TWebDAVFileSystem::UnregisterFromDebug()
|
|
|
-{
|
|
|
- TGuard Guard(DebugSection.get());
|
|
|
- FileSystems.erase(this);
|
|
|
+ UnregisterFromNeonDebug(FTerminal);
|
|
|
}
|
|
|
//---------------------------------------------------------------------------
|
|
|
bool __fastcall TWebDAVFileSystem::GetActive()
|
|
|
@@ -2671,11 +2581,6 @@ void TWebDAVFileSystem::NeonNotifier(void * UserData, ne_session_status Status,
|
|
|
}
|
|
|
}
|
|
|
//------------------------------------------------------------------------------
|
|
|
-void __fastcall TWebDAVFileSystem::NeonDebug(const UnicodeString & Message)
|
|
|
-{
|
|
|
- FTerminal->LogEvent(Message);
|
|
|
-}
|
|
|
-//------------------------------------------------------------------------------
|
|
|
void TWebDAVFileSystem::InitSslSession(ssl_st * Ssl, ne_session * Session)
|
|
|
{
|
|
|
TWebDAVFileSystem * FileSystem =
|