浏览代码

Not importing the "Disable Nagle's algorithm (TCP_NODELAY option)" from PuTTY as it has a different default due to its interactive nature

Source commit: 583d7f1ea9b80454790c2587e9541325112f7cdc
Martin Prikryl 9 年之前
父节点
当前提交
404a335cfd
共有 3 个文件被更改,包括 15 次插入11 次删除
  1. 11 7
      source/core/SessionData.cpp
  2. 3 3
      source/core/SessionData.h
  3. 1 1
      source/windows/GUIConfiguration.cpp

+ 11 - 7
source/core/SessionData.cpp

@@ -483,7 +483,7 @@ bool __fastcall TSessionData::IsInFolderOrWorkspace(UnicodeString AFolder)
   return StartsText(UnixIncludeTrailingBackslash(AFolder), Name);
   return StartsText(UnixIncludeTrailingBackslash(AFolder), Name);
 }
 }
 //---------------------------------------------------------------------
 //---------------------------------------------------------------------
-void __fastcall TSessionData::DoLoad(THierarchicalStorage * Storage, bool & RewritePassword)
+void __fastcall TSessionData::DoLoad(THierarchicalStorage * Storage, bool PuttyImport, bool & RewritePassword)
 {
 {
   // Make sure we only ever use methods supported by TOptionsStorage
   // Make sure we only ever use methods supported by TOptionsStorage
   // (implemented by TOptionsIniFile)
   // (implemented by TOptionsIniFile)
@@ -591,7 +591,11 @@ void __fastcall TSessionData::DoLoad(THierarchicalStorage * Storage, bool & Rewr
   TrimVMSVersions = Storage->ReadBool(L"TrimVMSVersions", TrimVMSVersions);
   TrimVMSVersions = Storage->ReadBool(L"TrimVMSVersions", TrimVMSVersions);
   NotUtf = TAutoSwitch(Storage->ReadInteger(L"Utf", Storage->ReadInteger(L"SFTPUtfBug", NotUtf)));
   NotUtf = TAutoSwitch(Storage->ReadInteger(L"Utf", Storage->ReadInteger(L"SFTPUtfBug", NotUtf)));
 
 
-  TcpNoDelay = Storage->ReadBool(L"TcpNoDelay", TcpNoDelay);
+  // PuTTY defaults to TcpNoDelay, but the psftp/pscp ignores this preference, and always set this to off (what is our default too)
+  if (!PuttyImport)
+  {
+    TcpNoDelay = Storage->ReadBool(L"TcpNoDelay", TcpNoDelay);
+  }
   SendBuf = Storage->ReadInteger(L"SendBuf", Storage->ReadInteger("SshSendBuf", SendBuf));
   SendBuf = Storage->ReadInteger(L"SendBuf", Storage->ReadInteger("SshSendBuf", SendBuf));
   SshSimple = Storage->ReadBool(L"SshSimple", SshSimple);
   SshSimple = Storage->ReadBool(L"SshSimple", SshSimple);
 
 
@@ -748,7 +752,7 @@ void __fastcall TSessionData::DoLoad(THierarchicalStorage * Storage, bool & Rewr
 #endif
 #endif
 }
 }
 //---------------------------------------------------------------------
 //---------------------------------------------------------------------
-void __fastcall TSessionData::Load(THierarchicalStorage * Storage)
+void __fastcall TSessionData::Load(THierarchicalStorage * Storage, bool PuttyImport)
 {
 {
   bool RewritePassword = false;
   bool RewritePassword = false;
   if (Storage->OpenSubKey(InternalStorageKey, False))
   if (Storage->OpenSubKey(InternalStorageKey, False))
@@ -761,7 +765,7 @@ void __fastcall TSessionData::Load(THierarchicalStorage * Storage)
     ClearSessionPasswords();
     ClearSessionPasswords();
     FProxyPassword = L"";
     FProxyPassword = L"";
 
 
-    DoLoad(Storage, RewritePassword);
+    DoLoad(Storage, PuttyImport, RewritePassword);
 
 
     Storage->CloseSubKey();
     Storage->CloseSubKey();
   }
   }
@@ -1790,7 +1794,7 @@ bool __fastcall TSessionData::ParseUrl(UnicodeString Url, TOptions * Options,
 void __fastcall TSessionData::ApplyRawSettings(THierarchicalStorage * Storage)
 void __fastcall TSessionData::ApplyRawSettings(THierarchicalStorage * Storage)
 {
 {
   bool Dummy;
   bool Dummy;
-  DoLoad(Storage, Dummy);
+  DoLoad(Storage, false, Dummy);
 }
 }
 //---------------------------------------------------------------------
 //---------------------------------------------------------------------
 void __fastcall TSessionData::ConfigureTunnel(int APortNumber)
 void __fastcall TSessionData::ConfigureTunnel(int APortNumber)
@@ -3447,7 +3451,7 @@ __fastcall TStoredSessionList::~TStoredSessionList()
 }
 }
 //---------------------------------------------------------------------
 //---------------------------------------------------------------------
 void __fastcall TStoredSessionList::Load(THierarchicalStorage * Storage,
 void __fastcall TStoredSessionList::Load(THierarchicalStorage * Storage,
-  bool AsModified, bool UseDefaults)
+  bool AsModified, bool UseDefaults, bool PuttyImport)
 {
 {
   TStringList *SubKeys = new TStringList();
   TStringList *SubKeys = new TStringList();
   TList * Loaded = new TList;
   TList * Loaded = new TList;
@@ -3508,7 +3512,7 @@ void __fastcall TStoredSessionList::Load(THierarchicalStorage * Storage,
             Add(SessionData);
             Add(SessionData);
           }
           }
           Loaded->Add(SessionData);
           Loaded->Add(SessionData);
-          SessionData->Load(Storage);
+          SessionData->Load(Storage, PuttyImport);
           if (AsModified)
           if (AsModified)
           {
           {
             SessionData->Modified = true;
             SessionData->Modified = true;

+ 3 - 3
source/core/SessionData.h

@@ -357,7 +357,7 @@ private:
   UnicodeString __fastcall GetFolderName();
   UnicodeString __fastcall GetFolderName();
   void __fastcall Modify();
   void __fastcall Modify();
   UnicodeString __fastcall GetSource();
   UnicodeString __fastcall GetSource();
-  void __fastcall DoLoad(THierarchicalStorage * Storage, bool & RewritePassword);
+  void __fastcall DoLoad(THierarchicalStorage * Storage, bool PuttyImport, bool & RewritePassword);
   void __fastcall DoSave(THierarchicalStorage * Storage,
   void __fastcall DoSave(THierarchicalStorage * Storage,
     bool PuttyExport, const TSessionData * Default, bool DoNotEncryptPasswords);
     bool PuttyExport, const TSessionData * Default, bool DoNotEncryptPasswords);
   UnicodeString __fastcall ReadXmlNode(_di_IXMLNode Node, const UnicodeString & Name, const UnicodeString & Default);
   UnicodeString __fastcall ReadXmlNode(_di_IXMLNode Node, const UnicodeString & Name, const UnicodeString & Default);
@@ -403,7 +403,7 @@ public:
   TSessionData * __fastcall Clone();
   TSessionData * __fastcall Clone();
   void __fastcall Default();
   void __fastcall Default();
   void __fastcall NonPersistant();
   void __fastcall NonPersistant();
-  void __fastcall Load(THierarchicalStorage * Storage);
+  void __fastcall Load(THierarchicalStorage * Storage, bool PuttyImport);
   void __fastcall ApplyRawSettings(THierarchicalStorage * Storage);
   void __fastcall ApplyRawSettings(THierarchicalStorage * Storage);
   void __fastcall ImportFromFilezilla(_di_IXMLNode Node, const UnicodeString & Path);
   void __fastcall ImportFromFilezilla(_di_IXMLNode Node, const UnicodeString & Path);
   void __fastcall Save(THierarchicalStorage * Storage, bool PuttyExport,
   void __fastcall Save(THierarchicalStorage * Storage, bool PuttyExport,
@@ -596,7 +596,7 @@ public:
   void __fastcall ImportFromFilezilla(const UnicodeString FileName);
   void __fastcall ImportFromFilezilla(const UnicodeString FileName);
   void __fastcall Export(const UnicodeString FileName);
   void __fastcall Export(const UnicodeString FileName);
   void __fastcall Load(THierarchicalStorage * Storage, bool AsModified = false,
   void __fastcall Load(THierarchicalStorage * Storage, bool AsModified = false,
-    bool UseDefaults = false);
+    bool UseDefaults = false, bool PuttyImport = false);
   void __fastcall Save(THierarchicalStorage * Storage, bool All = false);
   void __fastcall Save(THierarchicalStorage * Storage, bool All = false);
   void __fastcall SelectAll(bool Select);
   void __fastcall SelectAll(bool Select);
   void __fastcall Import(TStoredSessionList * From, bool OnlySelected, TList * Imported);
   void __fastcall Import(TStoredSessionList * From, bool OnlySelected, TList * Imported);

+ 1 - 1
source/windows/GUIConfiguration.cpp

@@ -1238,7 +1238,7 @@ TStoredSessionList * __fastcall TGUIConfiguration::SelectPuttySessionsForImport(
   Storage->ForceAnsi = true;
   Storage->ForceAnsi = true;
   if (Storage->OpenRootKey(false))
   if (Storage->OpenRootKey(false))
   {
   {
-    ImportSessionList->Load(Storage.get(), false, true);
+    ImportSessionList->Load(Storage.get(), false, true, true);
   }
   }
 
 
   TSessionData * PuttySessionData =
   TSessionData * PuttySessionData =