RemObjects Software RemObjects Software

RemObjects Internet Pack for .NET

RemObjects Internet Pack for .NET Commit Details

Date:2009-10-01 09:00:09 (3 years 7 months ago)
Author:Carlo Kok
Commit:8
Parents: 7
Message:0: Remove debugserver references 0: Port 0 support 0: Fix for SkipBytes that could make it fail 0: Call events before sending FTP packages 0: SSL Support

File differences

Source/RemObjects.InternetPack.2003.sln
1Microsoft Visual Studio Solution File, Format Version 8.00
2Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RemObjects.InternetPack.2003", "RemObjects.InternetPack\RemObjects.InternetPack.2003.csproj", "{7C02E26A-2522-4C8F-8CAC-4E65854A09DE}"
3    ProjectSection(ProjectDependencies) = postProject
4    EndProjectSection
5EndProject
6Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RemObjects.InternetPack.VirtualFTP.2003", "RemObjects.InternetPack.VirtualFTP\RemObjects.InternetPack.VirtualFTP.2003.csproj", "{E8E89EC1-4445-4853-9E0B-A18B044069B5}"
7    ProjectSection(ProjectDependencies) = postProject
8    EndProjectSection
9EndProject
10Global
11    GlobalSection(SolutionConfiguration) = preSolution
12        Debug = Debug
13        Release = Release
14    EndGlobalSection
15    GlobalSection(ProjectConfiguration) = postSolution
16        {7C02E26A-2522-4C8F-8CAC-4E65854A09DE}.Debug.ActiveCfg = Debug|.NET
17        {7C02E26A-2522-4C8F-8CAC-4E65854A09DE}.Debug.Build.0 = Debug|.NET
18        {7C02E26A-2522-4C8F-8CAC-4E65854A09DE}.Release.ActiveCfg = Release|.NET
19        {7C02E26A-2522-4C8F-8CAC-4E65854A09DE}.Release.Build.0 = Release|.NET
20        {E8E89EC1-4445-4853-9E0B-A18B044069B5}.Debug.ActiveCfg = Debug|.NET
21        {E8E89EC1-4445-4853-9E0B-A18B044069B5}.Debug.Build.0 = Debug|.NET
22        {E8E89EC1-4445-4853-9E0B-A18B044069B5}.Release.ActiveCfg = Release|.NET
23        {E8E89EC1-4445-4853-9E0B-A18B044069B5}.Release.Build.0 = Release|.NET
24    EndGlobalSection
25    GlobalSection(ExtensibilityGlobals) = postSolution
26    EndGlobalSection
27    GlobalSection(ExtensibilityAddIns) = postSolution
28    EndGlobalSection
29EndGlobal
Source/RemObjects.InternetPack.VirtualFTP/VirtualFtpServer.cs
55using RemObjects.InternetPack;
66using RemObjects.InternetPack.CommandBased;
77using RemObjects.InternetPack.Ftp;
8using RemObjects.DebugServer;
98
109namespace RemObjects.InternetPack.Ftp.VirtualFtp
1110{
1211#if FULLFRAMEWORK
1312  [ System.Drawing.ToolboxBitmap(typeof(RemObjects.InternetPack.Server), "Glyphs.VirtualFtpServer.bmp") ]
1413#endif
15  public class VirtualFtpServer : FtpServer
16  {
17    public VirtualFtpServer()
18    {
19    }
20                                             
21    #region Properties
22    private IFtpFolder fRootFolder;
23    public IFtpFolder RootFolder
24    {
25      get { return fRootFolder; }
26      set { fRootFolder = value; }
27    }
14    public class VirtualFtpServer : FtpServer
15    {
16        public VirtualFtpServer()
17        {
18        }
2819
29    private IFtpUserManager fUserManager;
30    public IFtpUserManager UserManager
31    {
32      get { return fUserManager; }
33      set { fUserManager = value; }
34    }
35    #endregion
20        #region Properties
21        private IFtpFolder fRootFolder;
22        public IFtpFolder RootFolder
23        {
24            get { return fRootFolder; }
25            set { fRootFolder = value; }
26        }
3627
37    protected override Type GetDefaultSessionClass()
38    {
39      return typeof(VirtualFtpSession);
40    }
28        private IFtpUserManager fUserManager;
29        public IFtpUserManager UserManager
30        {
31            get { return fUserManager; }
32            set { fUserManager = value; }
33        }
34        #endregion
4135
42    #region Login & IP Check
43    protected override void InvokeOnUserLogin(FtpUserLoginEventArgs ea)
44    {
45      Debug.EnterMethod("Login({0})",ea.UserName);
46      try
47      {
48        if (fUserManager == null) return;
49        VirtualFtpSession lSession = (VirtualFtpSession)ea.Session;
50        ea.LoginOk = fUserManager.CheckLogin(ea.UserName, ea.Password, lSession);
51        
52        Debug.Write("Login result "+ea.LoginOk);
53        base.InvokeOnUserLogin(ea);
54      }
55      finally
56      {
57        Debug.ExitMethod("Login({0}):{1}",ea.UserName,ea.LoginOk);
58      }
59    }
36        protected override Type GetDefaultSessionClass()
37        {
38            return typeof(VirtualFtpSession);
39        }
6040
61    protected override void InvokeOnClientConnected(SessionEventArgs ea)
62    {
63      ((VirtualFtpSession)ea.Session).CurrentFolder = fRootFolder;
64      if (fUserManager == null) return;
65      if (!fUserManager.CheckIP(ea.Connection.RemoteEndPoint, ea.Connection.LocalEndPoint))
66      {
67        ea.Connection.Disconnect();
68        throw new Exception("Access not allowed from this IP.");
69      }
70      base.InvokeOnClientConnected(ea);
71    }
72    #endregion
41        #region Login & IP Check
42        protected override void InvokeOnUserLogin(FtpUserLoginEventArgs ea)
43        {
44#if DEBUGSERVER
45            Debug.EnterMethod("Login({0})", ea.UserName);
46            try
47            {
48#endif
49                if (fUserManager == null) return;
50                VirtualFtpSession lSession = (VirtualFtpSession)ea.Session;
51                ea.LoginOk = fUserManager.CheckLogin(ea.UserName, ea.Password, lSession);
52#if DEBUGSERVER
53                Debug.Write("Login result " + ea.LoginOk);
54#endif
55                base.InvokeOnUserLogin(ea);
56#if DEBUGSERVER
57            }
58            finally
59            {
60                Debug.ExitMethod("Login({0}):{1}", ea.UserName, ea.LoginOk);
61            }
62#endif
63        }
7364
74    #region Folder handling
75    protected override void InvokeOnGetListing(FtpGetListingArgs ea)
76    {
77      VirtualFtpSession lSession = (VirtualFtpSession)ea.Session;
78      Debug.Write("Getting Listing for {0}",lSession.CurrentFolder.FullPath);
79      
80      lSession.CurrentFolder.ListFolderItems(ea.Listing);
65        protected override void InvokeOnClientConnected(SessionEventArgs ea)
66        {
67            ((VirtualFtpSession)ea.Session).CurrentFolder = fRootFolder;
68            if (fUserManager == null) return;
69            if (!fUserManager.CheckIP(ea.Connection.RemoteEndPoint, ea.Connection.LocalEndPoint))
70            {
71                ea.Connection.Disconnect();
72                throw new Exception("Access not allowed from this IP.");
73            }
74            base.InvokeOnClientConnected(ea);
75        }
76        #endregion
8177
82      base.InvokeOnGetListing(ea);
83    }
78        #region Folder handling
79        protected override void InvokeOnGetListing(FtpGetListingArgs ea)
80        {
81            VirtualFtpSession lSession = (VirtualFtpSession)ea.Session;
82#if DEBUGSERVER
83            Debug.Write("Getting Listing for {0}", lSession.CurrentFolder.FullPath);
84#endif
85            lSession.CurrentFolder.ListFolderItems(ea.Listing);
8486
85    protected override void InvokeOnChangeDirectory(FtpChangeDirectoryArgs ea)
86    {
87      string lPath = ea.NewDirectory;
87            base.InvokeOnGetListing(ea);
88        }
8889
89      if (lPath.IndexOf('/') != 0)
90        throw new Exception(String.Format("Not an absolute path: \"{0}\"",lPath));
91      
92      VirtualFtpSession lSession = (VirtualFtpSession)ea.Session;
93      IFtpFolder lFolder = fRootFolder.DigForSubFolder(lPath.Substring(1), lSession);
90        protected override void InvokeOnChangeDirectory(FtpChangeDirectoryArgs ea)
91        {
92            string lPath = ea.NewDirectory;
9493
95      if (lFolder != null)
96      {
97        ((VirtualFtpSession)ea.Session).CurrentFolder = lFolder;
98      }
99      ea.ChangeDirOk = (lFolder != null);
100      base.InvokeOnChangeDirectory(ea);
101    }
94            if (lPath.IndexOf('/') != 0)
95                throw new Exception(String.Format("Not an absolute path: \"{0}\"", lPath));
10296
103    protected override void InvokeOnMakeDirectory(FtpFileEventArgs ea)
104    {
105      VirtualFtpSession lSession = (VirtualFtpSession)ea.Session;
97            VirtualFtpSession lSession = (VirtualFtpSession)ea.Session;
98            IFtpFolder lFolder = fRootFolder.DigForSubFolder(lPath.Substring(1), lSession);
10699
107      IFtpFolder lFolder;
108      string lFilename;
100            if (lFolder != null)
101            {
102                ((VirtualFtpSession)ea.Session).CurrentFolder = lFolder;
103            }
104            ea.ChangeDirOk = (lFolder != null);
105            base.InvokeOnChangeDirectory(ea);
106        }
109107
110      lSession.CurrentFolder.FindBaseFolderForFilename(ea.FileName, out lFolder, out lFilename, lSession);
111      lFolder.CreateFolder(lFilename,lSession);
112      ea.Ok = true;
108        protected override void InvokeOnMakeDirectory(FtpFileEventArgs ea)
109        {
110            VirtualFtpSession lSession = (VirtualFtpSession)ea.Session;
113111
114    }
112            IFtpFolder lFolder;
113            string lFilename;
115114
116    protected override void InvokeOnDeleteDirectory(FtpFileEventArgs ea)
117    {
118      VirtualFtpSession lSession = (VirtualFtpSession)ea.Session;
119      IFtpFolder lFolder;
120      string lFilename;
115            lSession.CurrentFolder.FindBaseFolderForFilename(ea.FileName, out lFolder, out lFilename, lSession);
116            lFolder.CreateFolder(lFilename, lSession);
117            ea.Ok = true;
121118
122      lSession.CurrentFolder.FindBaseFolderForFilename(ea.FileName, out lFolder, out lFilename, lSession);
123      lFolder.DeleteFolder(lFilename,false,lSession);
124      ea.Ok = true;
125    }
126    #endregion
119        }
127120
128    #region File Handling
129    protected override void InvokeOnCanStoreFile(FtpTransferEventArgs ea)
130    {
131      VirtualFtpSession lSession = (VirtualFtpSession)ea.Session;
132      IFtpFolder lFolder;
133      string lFilename;
121        protected override void InvokeOnDeleteDirectory(FtpFileEventArgs ea)
122        {
123            VirtualFtpSession lSession = (VirtualFtpSession)ea.Session;
124            IFtpFolder lFolder;
125            string lFilename;
134126
135      lSession.CurrentFolder.FindBaseFolderForFilename(ea.FileName, out lFolder, out lFilename, lSession);
136      ea.Ok = lFolder.AllowPut(lSession);
137    }
127            lSession.CurrentFolder.FindBaseFolderForFilename(ea.FileName, out lFolder, out lFilename, lSession);
128            lFolder.DeleteFolder(lFilename, false, lSession);
129            ea.Ok = true;
130        }
131        #endregion
138132
139    protected override void InvokeOnCanRetrieveFile(FtpTransferEventArgs ea)
140    {
141      VirtualFtpSession lSession = (VirtualFtpSession)ea.Session;
142      IFtpFolder lFolder;
143      string lFilename;
133        #region File Handling
134        protected override void InvokeOnCanStoreFile(FtpTransferEventArgs ea)
135        {
136            VirtualFtpSession lSession = (VirtualFtpSession)ea.Session;
137            IFtpFolder lFolder;
138            string lFilename;
144139
145      lSession.CurrentFolder.FindBaseFolderForFilename(ea.FileName, out lFolder, out lFilename, lSession);
146      IFtpFile lFile = lFolder.GetFile(lFilename,lSession);
147      ea.Ok = (lFile != null && lFile.AllowRead(lSession));
148    }
140            lSession.CurrentFolder.FindBaseFolderForFilename(ea.FileName, out lFolder, out lFilename, lSession);
141            ea.Ok = lFolder.AllowPut(lSession);
142        }
149143
150    protected override void InvokeOnStoreFile(FtpTransferEventArgs ea)
151    {
152      VirtualFtpSession lSession = (VirtualFtpSession)ea.Session;
153      IFtpFolder lFolder;
154      string lFilename;
144        protected override void InvokeOnCanRetrieveFile(FtpTransferEventArgs ea)
145        {
146            VirtualFtpSession lSession = (VirtualFtpSession)ea.Session;
147            IFtpFolder lFolder;
148            string lFilename;
155149
156      lSession.CurrentFolder.FindBaseFolderForFilename(ea.FileName, out lFolder, out lFilename, lSession);
157      IFtpFile lFile = lFolder.CreateFile(lFilename,lSession);
158      lFile.CreateFile(ea.DataChannel);
159      ea.Ok = true;
160    }
150            lSession.CurrentFolder.FindBaseFolderForFilename(ea.FileName, out lFolder, out lFilename, lSession);
151            IFtpFile lFile = lFolder.GetFile(lFilename, lSession);
152            ea.Ok = (lFile != null && lFile.AllowRead(lSession));
153        }
161154
162    protected override void InvokeOnRetrieveFile(FtpTransferEventArgs ea)
163    {
164      VirtualFtpSession lSession = (VirtualFtpSession)ea.Session;
165      IFtpFolder lFolder;
166      string lFilename;
155        protected override void InvokeOnStoreFile(FtpTransferEventArgs ea)
156        {
157            VirtualFtpSession lSession = (VirtualFtpSession)ea.Session;
158            IFtpFolder lFolder;
159            string lFilename;
167160
168      lSession.CurrentFolder.FindBaseFolderForFilename(ea.FileName, out lFolder, out lFilename, lSession);
169      IFtpFile lFile = lFolder.GetFile(lFilename,lSession);
170      lFile.GetFile(ea.DataChannel);
171      ea.Ok = true;
172    }
161            lSession.CurrentFolder.FindBaseFolderForFilename(ea.FileName, out lFolder, out lFilename, lSession);
162            IFtpFile lFile = lFolder.CreateFile(lFilename, lSession);
163            lFile.CreateFile(ea.DataChannel);
164            ea.Ok = true;
165        }
173166
174    protected override void InvokeOnRename(FtpRenameEventArgs ea)
175    {
176      VirtualFtpSession lSession = (VirtualFtpSession)ea.Session;
177      IFtpFolder lFolder;
178      string lFilename;
167        protected override void InvokeOnRetrieveFile(FtpTransferEventArgs ea)
168        {
169            VirtualFtpSession lSession = (VirtualFtpSession)ea.Session;
170            IFtpFolder lFolder;
171            string lFilename;
179172
180      lSession.CurrentFolder.FindBaseFolderForFilename(ea.FileName, out lFolder, out lFilename, lSession);
181      lFolder.RenameFileOrFolder(lFilename, ea.NewFileName, lSession);
182      ea.Ok = true;
183    }
173            lSession.CurrentFolder.FindBaseFolderForFilename(ea.FileName, out lFolder, out lFilename, lSession);
174            IFtpFile lFile = lFolder.GetFile(lFilename, lSession);
175            lFile.GetFile(ea.DataChannel);
176            ea.Ok = true;
177        }
184178
185    protected override void InvokeOnDelete(FtpFileEventArgs ea)
186    {
187      VirtualFtpSession lSession = (VirtualFtpSession)ea.Session;
188      IFtpFolder lFolder;
189      string lFilename;
179        protected override void InvokeOnRename(FtpRenameEventArgs ea)
180        {
181            VirtualFtpSession lSession = (VirtualFtpSession)ea.Session;
182            IFtpFolder lFolder;
183            string lFilename;
190184
191      lSession.CurrentFolder.FindBaseFolderForFilename(ea.FileName, out lFolder, out lFilename, lSession);
192      lFolder.DeleteFile(lFilename, lSession);
193      ea.Ok = true;
194    }
195    #endregion
185            lSession.CurrentFolder.FindBaseFolderForFilename(ea.FileName, out lFolder, out lFilename, lSession);
186            lFolder.RenameFileOrFolder(lFilename, ea.NewFileName, lSession);
187            ea.Ok = true;
188        }
196189
197  }
190        protected override void InvokeOnDelete(FtpFileEventArgs ea)
191        {
192            VirtualFtpSession lSession = (VirtualFtpSession)ea.Session;
193            IFtpFolder lFolder;
194            string lFilename;
198195
196            lSession.CurrentFolder.FindBaseFolderForFilename(ea.FileName, out lFolder, out lFilename, lSession);
197            lFolder.DeleteFile(lFilename, lSession);
198            ea.Ok = true;
199        }
200        #endregion
201
202    }
203
199204}
Source/RemObjects.InternetPack.VirtualFTP/RemObjects.InternetPack.VirtualFTP.2003.csproj
1<VisualStudioProject>
2    <CSHARP
3        ProjectType = "Local"
4        ProductVersion = "7.10.3077"
5        SchemaVersion = "2.0"
6        ProjectGuid = "{E8E89EC1-4445-4853-9E0B-A18B044069B5}"
7    >
8        <Build>
9            <Settings
10                ApplicationIcon = ""
11                AssemblyKeyContainerName = ""
12                AssemblyName = "RemObjects.InternetPack.VirtualFTP"
13                AssemblyOriginatorKeyFile = ""
14                DefaultClientScript = "JScript"
15                DefaultHTMLPageLayout = "Grid"
16                DefaultTargetSchema = "IE50"
17                DelaySign = "false"
18                OutputType = "Library"
19                PreBuildEvent = ""
20                PostBuildEvent = ""
21                RootNamespace = "RemObjects.InternetPack.VirtualFTP"
22                RunPostBuildEvent = "OnBuildSuccess"
23                StartupObject = ""
24            >
25                <Config
26                    Name = "Debug"
27                    AllowUnsafeBlocks = "false"
28                    BaseAddress = "285212672"
29                    CheckForOverflowUnderflow = "false"
30                    ConfigurationOverrideFile = ""
31                    DefineConstants = "DEBUG;TRACE;REMOBJECTS_SIGN_ASSEMBLY;DEBUGSERVER"
32                    DocumentationFile = ""
33                    DebugSymbols = "true"
34                    FileAlignment = "4096"
35                    IncrementalBuild = "false"
36                    NoStdLib = "false"
37                    NoWarn = ""
38                    Optimize = "false"
39                    OutputPath = "bin\Debug\"
40                    RegisterForComInterop = "false"
41                    RemoveIntegerChecks = "false"
42                    TreatWarningsAsErrors = "false"
43                    WarningLevel = "4"
44                />
45                <Config
46                    Name = "Release"
47                    AllowUnsafeBlocks = "false"
48                    BaseAddress = "285212672"
49                    CheckForOverflowUnderflow = "false"
50                    ConfigurationOverrideFile = ""
51                    DefineConstants = "TRACE;REMOBJECTS_SIGN_ASSEMBLY"
52                    DocumentationFile = ""
53                    DebugSymbols = "false"
54                    FileAlignment = "4096"
55                    IncrementalBuild = "false"
56                    NoStdLib = "false"
57                    NoWarn = ""
58                    Optimize = "true"
59                    OutputPath = "..\..\Bin\"
60                    RegisterForComInterop = "false"
61                    RemoveIntegerChecks = "false"
62                    TreatWarningsAsErrors = "false"
63                    WarningLevel = "4"
64                />
65            </Settings>
66            <References>
67                <Reference
68                    Name = "System"
69                    AssemblyName = "System"
70                    HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
71                />
72                <Reference
73                    Name = "System.Data"
74                    AssemblyName = "System.Data"
75                    HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
76                />
77                <Reference
78                    Name = "System.XML"
79                    AssemblyName = "System.Xml"
80                    HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
81                />
82                <Reference
83                    Name = "RemObjects.DebugServer"
84                    AssemblyName = "RemObjects.DebugServer"
85                    HintPath = "..\..\Bin\RemObjects.DebugServer.dll"
86                />
87                <Reference
88                    Name = "RemObjects.InternetPack.2003"
89                    Project = "{7C02E26A-2522-4C8F-8CAC-4E65854A09DE}"
90                    Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
91                />
92            </References>
93        </Build>
94        <Files>
95            <Include>
96                <File
97                    RelPath = "AssemblyInfo.cs"
98                    SubType = "Code"
99                    BuildAction = "Compile"
100                />
101                <File
102                    RelPath = "DiscFile.cs"
103                    SubType = "Code"
104                    BuildAction = "Compile"
105                />
106                <File
107                    RelPath = "DiscFolder.cs"
108                    SubType = "Code"
109                    BuildAction = "Compile"
110                />
111                <File
112                    RelPath = "EmptyFile.cs"
113                    SubType = "Code"
114                    BuildAction = "Compile"
115                />
116                <File
117                    RelPath = "FtpFile.cs"
118                    SubType = "Code"
119                    BuildAction = "Compile"
120                />
121                <File
122                    RelPath = "FtpFolder.cs"
123                    SubType = "Code"
124                    BuildAction = "Compile"
125                />
126                <File
127                    RelPath = "FtpInterfaces.cs"
128                    SubType = "Code"
129                    BuildAction = "Compile"
130                />
131                <File
132                    RelPath = "FtpItem.cs"
133                    SubType = "Code"
134                    BuildAction = "Compile"
135                />
136                <File
137                    RelPath = "Session.cs"
138                    SubType = "Code"
139                    BuildAction = "Compile"
140                />
141                <File
142                    RelPath = "UserManager.cs"
143                    SubType = "Code"
144                    BuildAction = "Compile"
145                />
146                <File
147                    RelPath = "VirtualFolder.cs"
148                    SubType = "Code"
149                    BuildAction = "Compile"
150                />
151                <File
152                    RelPath = "VirtualFtpServer.cs"
153                    SubType = "Component"
154                    BuildAction = "Compile"
155                />
156                <File
157                    RelPath = "Glyphs\VirtualFtpServer.bmp"
158                    BuildAction = "EmbeddedResource"
159                />
160            </Include>
161        </Files>
162    </CSHARP>
163</VisualStudioProject>
164
Source/RemObjects.InternetPack.VirtualFTP/RemObjects.InternetPack.VirtualFTP.2005.csproj
3232    <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
3333    <ConfigurationOverrideFile>
3434    </ConfigurationOverrideFile>
35    <DefineConstants>DEBUG;TRACE;REMOBJECTS_SIGN_ASSEMBLY;DEBUGSERVER</DefineConstants>
35    <DefineConstants>REMOBJECTS_SIGN_ASSEMBLY;DEBUG;TRACE</DefineConstants>
3636    <DocumentationFile>
3737    </DocumentationFile>
3838    <DebugSymbols>true</DebugSymbols>
...... 
6868    <WarningLevel>4</WarningLevel>
6969  </PropertyGroup>
7070  <ItemGroup>
71    <Reference Include="RemObjects.DebugServer">
72      <Name>RemObjects.DebugServer</Name>
73      <HintPath>..\..\Bin\RemObjects.DebugServer.dll</HintPath>
74    </Reference>
7571    <Reference Include="System">
7672      <Name>System</Name>
7773    </Reference>
Source/RemObjects.InternetPack.VirtualFTP/RemObjects.InternetPack.VirtualFTP.2008.csproj
11<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
22  <PropertyGroup>
33    <ProjectType>Local</ProjectType>
4    <ProductVersion>9.0.21022</ProductVersion>
4    <ProductVersion>9.0.30729</ProductVersion>
55    <SchemaVersion>2.0</SchemaVersion>
66    <ProjectGuid>{E8E89EC1-4445-4853-9E0B-A18B044069B5}</ProjectGuid>
77    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
...... 
2424    </StartupObject>
2525    <FileUpgradeFlags>
2626    </FileUpgradeFlags>
27    <UpgradeBackupLocation>
28    </UpgradeBackupLocation>
29    <OldToolsVersion>2.0</OldToolsVersion>
30    <PublishUrl>publish\</PublishUrl>
31    <Install>true</Install>
32    <InstallFrom>Disk</InstallFrom>
33    <UpdateEnabled>false</UpdateEnabled>
34    <UpdateMode>Foreground</UpdateMode>
35    <UpdateInterval>7</UpdateInterval>
36    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
37    <UpdatePeriodically>false</UpdatePeriodically>
38    <UpdateRequired>false</UpdateRequired>
39    <MapFileExtensions>true</MapFileExtensions>
40    <ApplicationRevision>0</ApplicationRevision>
41    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
42    <IsWebBootstrapper>false</IsWebBootstrapper>
43    <UseApplicationTrust>false</UseApplicationTrust>
44    <BootstrapperEnabled>true</BootstrapperEnabled>
4527  </PropertyGroup>
4628  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
4729    <OutputPath>bin\Debug\</OutputPath>
...... 
5032    <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
5133    <ConfigurationOverrideFile>
5234    </ConfigurationOverrideFile>
53    <DefineConstants>DEBUG;TRACE;REMOBJECTS_SIGN_ASSEMBLY;DEBUGSERVER</DefineConstants>
35    <DefineConstants>REMOBJECTS_SIGN_ASSEMBLY;DEBUG;TRACE</DefineConstants>
5436    <DocumentationFile>
5537    </DocumentationFile>
5638    <DebugSymbols>true</DebugSymbols>
...... 
8668    <WarningLevel>4</WarningLevel>
8769  </PropertyGroup>
8870  <ItemGroup>
89    <Reference Include="RemObjects.DebugServer">
90      <Name>RemObjects.DebugServer</Name>
91      <HintPath>..\..\Bin\RemObjects.DebugServer.dll</HintPath>
92    </Reference>
9371    <Reference Include="System">
9472      <Name>System</Name>
9573    </Reference>
...... 
140118      <SubType>Code</SubType>
141119    </Compile>
142120    <Compile Include="VirtualFtpServer.cs">
121      <SubType>Component</SubType>
143122    </Compile>
144123    <EmbeddedResource Include="Glyphs\VirtualFtpServer.bmp" />
145124    <AppDesigner Include="Properties\" />
...... 
147126  <ItemGroup>
148127    <Folder Include="Properties\" />
149128  </ItemGroup>
150  <ItemGroup>
151    <BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
152      <Visible>False</Visible>
153      <ProductName>.NET Framework 2.0 %28x86%29</ProductName>
154      <Install>true</Install>
155    </BootstrapperPackage>
156    <BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
157      <Visible>False</Visible>
158      <ProductName>.NET Framework 3.0 %28x86%29</ProductName>
159      <Install>false</Install>
160    </BootstrapperPackage>
161    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
162      <Visible>False</Visible>
163      <ProductName>.NET Framework 3.5</ProductName>
164      <Install>false</Install>
165    </BootstrapperPackage>
166  </ItemGroup>
167129  <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
168130  <PropertyGroup>
169131    <PreBuildEvent>
Source/RemObjects.InternetPack/HttpClient.cs
1111using System.IO;
1212using System.ComponentModel;
1313using System.Net;
14using RemObjects.DebugServer;
1514using RemObjects.InternetPack;
1615
1716namespace RemObjects.InternetPack.Http
...... 
289288            }
290289            catch (ConnectionClosedException)
291290            {
291#if DEBUGSERVER
292292                Debug.Write("Remote connection was closed, reconnecting...");
293                lConnection = GetNewHttpConnection(aRequest.Url.Hostname, aRequest.Url.Port);
293#endif
294                lConnection = GetNewHttpConnection(aRequest.Url.Hostname, aRequest.Url.Port);
294295                aRequest.WriteHeaderToConnection(lConnection);
295296            }
296297            catch (System.Net.Sockets.SocketException)// e)
297298            {
298299                //if (e.ErrorCode != 0x2745 && e.ErrorCode != 0x2746) throw;
300#if DEBUGSERVER
299301                Debug.Write("Remote connection was closed, reconnecting...");
302#endif
300303                lConnection = GetNewHttpConnection(aRequest.Url.Hostname, aRequest.Url.Port);
301304                aRequest.WriteHeaderToConnection(lConnection);
302305            }
Source/RemObjects.InternetPack/Pop3Client.cs
55using RemObjects.InternetPack.CommandBased;
66
77using RemObjects.InternetPack.Messages;
8using RemObjects.DebugServer;
98
109namespace RemObjects.InternetPack.Email
1110{
Source/RemObjects.InternetPack/FtpClient.cs
551551
552552            if (SendAndWaitForResponse("RETR " + aFileName, 150, 125))
553553            {
554                InternalOnTransferStart(this, new TransferStartEventArgs(TransferDirection.Receive, aSize));
555
554556                RetrieveDataConnection();
555557                _DataConnection.ReceiveToStream(aStream, aSize);
556558                _DataConnection.Close();
...... 
572574
573575            if (SendAndWaitForResponse("STOR " + aFileName, 150, 125))
574576            {
577
578                InternalOnTransferStart(this, new TransferStartEventArgs(TransferDirection.Receive, aStream.Length));
579
575580                RetrieveDataConnection();
576581                _DataConnection.SendFromStream(aStream);
577582                _DataConnection.Close();
...... 
624629                OnTransferProgress(Sender, ea);
625630        }
626631
627        internal void InternalOnTransferStart(object Sender, TransferStartEventArgs ea)
628        {
629            if (OnTransferStart != null)
630            {
631                OnTransferStart(Sender, ea);
632            }
633        } */
632          */
634633
634        internal void InternalOnTransferStart(object Sender, TransferStartEventArgs ea)
635        {
636            if (OnTransferStart != null)
637            {
638                OnTransferStart(Sender, ea);
639            }
640        }
641
635642        public event TransferProgressEventHandler OnTransferProgress;
636643        public event TransferStartEventHandler OnTransferStart;
637644
Source/RemObjects.InternetPack/ConnectionPool.cs
1111using System.Net;
1212using System.Net.Sockets;
1313using System.Collections;
14using RemObjects.DebugServer;
1514
1615namespace RemObjects.InternetPack
1716{
...... 
6867        {
6968        }
7069
71        public void Cleanup(object state)
72        {
70        public void Cleanup(object state)
71        {
72#if DEBUGSERVER
7373            Debug.EnterMethod("Cleanup");
74            DateTime ExpireTime = DateTime.Now.AddSeconds(-fTimeout);
75            lock (fCache)
76            {
77                foreach (DictionaryEntry el in fCache)
78                {
79                    ConnectionQueue q = (ConnectionQueue)el.Value;
80                    bool Modified = false;
74#endif
75            DateTime ExpireTime = DateTime.Now.AddSeconds(-fTimeout);
76            lock (fCache)
77            {
78                foreach (DictionaryEntry el in fCache)
79                {
80                    ConnectionQueue q = (ConnectionQueue)el.Value;
81                    bool Modified = false;
82#if DEBUGSERVER
8183                    Debug.Write("Cleaning up: " + el.Key.ToString());
82                    for (int i = q.UnderlyingArray.Length - 1; i >= 0; i--)
83                    {
84                        if (q.UnderlyingArray[i] != null && q.UnderlyingArray[i].LastUsed < ExpireTime)
85                        {
84#endif
85                    for (int i = q.UnderlyingArray.Length - 1; i >= 0; i--)
86                    {
87                        if (q.UnderlyingArray[i] != null && q.UnderlyingArray[i].LastUsed < ExpireTime)
88                        {
89#if DEBUGSERVER
8690                            Debug.Write("Removing entry");
87                            Modified = true;
88                            q.UnderlyingArray[i].Dispose();
89                            q.UnderlyingArray[i] = null;
90                        }
91                    }
92                    if (Modified)
93                    {
91#endif
92                            Modified = true;
93                            q.UnderlyingArray[i].Dispose();
94                            q.UnderlyingArray[i] = null;
95                        }
96                    }
97                    if (Modified)
98                    {
99#if DEBUGSERVER
94100                        Debug.Write("Removing zeros original count: " + q.Count.ToString());
95                        q.RemoveNulls();
101#endif
102                        q.RemoveNulls();
103#if DEBUGSERVER
96104                        Debug.Write("Removing zeros new count: " + q.Count.ToString());
97                    }
98                }
99            }
105#endif
106                    }
107                }
108            }
109#if DEBUGSERVER
100110            Debug.ExitMethod("Cleanup");
101        }
111#endif
112        }
102113
103114        public virtual Connection GetConnection(EndPoint aEndPoint)
104115        {
105116            string aHost = aEndPoint.ToString();
117#if DEBUGSERVER
106118            Debug.Write("Requested connection for {0}", aHost);
119#endif
107120            lock (fCache)
108121            {
109122                ConnectionQueue q = fCache.ContainsKey(aHost) ? (ConnectionQueue)fCache[aHost] : null;
110123                if (q != null && q.Count > 0)
111124                {
125#if DEBUGSERVER
112126                    Debug.Write("Returned queued connection");
127#endif
113128                    return q.Dequeue();
114129                }
115130            }
131#if DEBUGSERVER
116132            Debug.Write("Returned new queued connection");
133#endif
117134            return GetNewConnection(aEndPoint);
118135        }
119136
...... 
155172        public virtual void ReleaseConnection(Connection aConnection)
156173        {
157174            string aHost = aConnection.OriginalEndpoint.ToString();
158            Debug.Write("Released connection for {0}", aHost);
159            if (!aConnection.Connected)
175#if DEBUGSERVER
176            Debug.Write("Released connection for {0}", aHost);
177#endif
178            if (!aConnection.Connected)
160179            {
161180                aConnection.Dispose();
162181                return;
...... 
170189                {
171190                    q = new ConnectionQueue(fMaxQueuePerHost == 0 ? 8 : fMaxQueuePerHost);
172191                    fCache.Add(aHost, q);
192#if DEBUGSERVER
173193                    Debug.Write("Created queue for {0}", aHost);
194#endif
174195                }
175196                if (q.Count < fMaxQueuePerHost || fMaxQueuePerHost < 1)
176197                {
177198                    ((Connection)aConnection).LastUsed = DateTime.Now;
199#if DEBUGSERVER
178200                    Debug.Write("Added to queue");
201#endif
179202                    q.Enqueue((Connection)aConnection);
180203                }
181204                else
182205                {
206#if DEBUGSERVER
183207                    Debug.Write("Not added to queue");
208#endif
184209                    aConnection.Dispose();
185210                }
186211            }
Source/RemObjects.InternetPack/RemObjects.InternetPack.CF.2003.csdproj
1<VisualStudioProject>
2    <ECSHARP
3        ProjectType = "Local"
4        ProductVersion = "7.10.3077"
5        SchemaVersion = "1.0"
6        ProjectGuid = "{67DA6880-E6C5-4C3A-B84F-80FBCC2FD5DB}"
7    >
8        <Build>
9            <Settings
10                ApplicationIcon = ""
11                AssemblyKeyContainerName = ""
12                AssemblyName = "RemObjects.InternetPack"
13                AssemblyOriginatorKeyFile = ""
14                DelaySign = "false"
15                OutputType = "Library"
16                OutputFileFolder = "\Program Files\RemObjects.InternetPack.CF"
17                RootNamespace = "RemObjects.InternetPack.Core"
18                StartupObject = ""
19            >
20                <Platform Name = "Pocket PC" />
21                <Config
22                    Name = "Debug|Pocket PC"
23                    AllowUnsafeBlocks = "false"
24                    BaseAddress = "0"
25                    CheckForOverflowUnderflow = "false"
26                    ConfigurationOverrideFile = ""
27                    DefineConstants = "DEBUG;TRACE;COMPACTFRAMEWORK;REMOBJECTS_SIGN_ASSEMBLY"
28                    DocumentationFile = ""
29                    DebugSymbols = "true"
30                    FileAlignment = "4096"
31                    IncrementalBuild = "false"
32                    Optimize = "false"
33                    OutputPath = "bin\Debug\"
34                    RegisterForComInterop = "false"
35                    RemoveIntegerChecks = "false"
36                    TreatWarningsAsErrors = "false"
37                    WarningLevel = "4"
38                />
39                <Config
40                    Name = "Release|Pocket PC"
41                    AllowUnsafeBlocks = "false"
42                    BaseAddress = "0"
43                    CheckForOverflowUnderflow = "false"
44                    ConfigurationOverrideFile = ""
45                    DefineConstants = "TRACE;COMPACTFRAMEWORK;REMOBJECTS_SIGN_ASSEMBLY"
46                    DocumentationFile = ""
47                    DebugSymbols = "true"
48                    FileAlignment = "4096"
49                    IncrementalBuild = "false"
50                    Optimize = "true"
51                    OutputPath = "..\..\Bin\CF\"
52                    RegisterForComInterop = "false"
53                    RemoveIntegerChecks = "false"
54                    TreatWarningsAsErrors = "false"
55                    WarningLevel = "4"
56                />
57            </Settings>
58            <References>
59                <Reference
60                    Platform = "Pocket PC"
61                    Name = "MSCorLib"
62                    AssemblyName = "mscorlib"
63                    Private = "False"
64                />
65                <Reference
66                    Platform = "Pocket PC"
67                    Name = "System"
68                    AssemblyName = "System"
69                    Private = "False"
70                />
71                <Reference
72                    Platform = "Pocket PC"
73                    Name = "System.XML"
74                    AssemblyName = "System.Xml"
75                    Private = "False"
76                />
77                <Reference
78                    Platform = "Pocket PC"
79                    Name = "System.Data"
80                    AssemblyName = "System.Data"
81                    Private = "False"
82                />
83                <Reference
84                    Platform = "Pocket PC"
85                    Name = "RemObjects.DebugServer"
86                    AssemblyName = "RemObjects.DebugServer"
87                />
88                <Reference
89                    Platform = "Pocket PC-Designer"
90                    Name = "System.CF.Design"
91                    AssemblyName = "System.CF.Design"
92                    Private = "False"
93                />
94                <Reference
95                    Platform = "Pocket PC-Designer"
96                    Name = "System.CF.Design.UI"
97                    AssemblyName = "System.CF.Design.UI"
98                    Private = "False"
99                />
100                <Reference
101                    Platform = "Pocket PC-Designer"
102                    Name = "System.CF.Windows.Forms"
103                    AssemblyName = "System.CF.Windows.Forms"
104                    Private = "False"
105                />
106                <Reference
107                    Platform = "Pocket PC-Designer"
108                    Name = "System.CF.Drawing"
109                    AssemblyName = "System.CF.Drawing"
110                    Private = "False"
111                />
112                <Reference
113                    Platform = "Pocket PC-Designer"
114                    Name = "System"
115                    AssemblyName = "System"
116                    Private = "False"
117                />
118            </References>
119        </Build>
120        <Files>
121            <Include>
122                <File
123                    RelPath = "AssemblyInfo.cs"
124                    SubType = "Code"
125                    BuildAction = "Compile"
126                />
127                <File
128                    RelPath = "AsyncServer.cs"
129                    SubType = "Code"
130                    BuildAction = "Compile"
131                />
132                <File
133                    RelPath = "Bindings.cs"
134                    SubType = "Code"
135                    BuildAction = "Compile"
136                />
137                <File
138                    RelPath = "BoundIncomingStream.cs"
139                    SubType = "Code"
140                    BuildAction = "Compile"
141                />
142                <File
143                    RelPath = "CFCompatibility.cs"
144                    SubType = "Code"
145                    BuildAction = "Compile"
146                />
147                <File
148                    RelPath = "Client.cs"
149                    SubType = "Code"
150                    BuildAction = "Compile"
151                />
152                <File
153                    RelPath = "CommandBasedClient.cs"
154                    SubType = "Code"
155                    BuildAction = "Compile"
156                />
157                <File
158                    RelPath = "CommandBasedServer.cs"
159                    SubType = "Code"
160                    BuildAction = "Compile"
161                />
162                <File
163                    RelPath = "Connection.cs"
164                    SubType = "Code"
165                    BuildAction = "Compile"
166                />
167                <File
168                    RelPath = "ConnectionPool.cs"
169                    SubType = "Code"
170                    BuildAction = "Compile"
171                />
172                <File
173                    RelPath = "Debug.cs"
174                    SubType = "Code"
175                    BuildAction = "Compile"
176                />
177                <File
178                    RelPath = "Dns.cs"
179                    SubType = "Code"
180                    BuildAction = "Compile"
181                />
182                <File
183                    RelPath = "EchoServer.cs"
184                    SubType = "Code"
185                    BuildAction = "Compile"
186                />
187                <File
188                    RelPath = "Events.cs"
189                    SubType = "Code"
190                    BuildAction = "Compile"
191                />
192                <File
193                    RelPath = "FtpClient.cs"
194                    SubType = "Code"
195                    BuildAction = "Compile"
196                />
197                <File
198                    RelPath = "FtpListing.cs"
199                    SubType = "Code"
200                    BuildAction = "Compile"
201                />
202                <File
203                    RelPath = "FtpServer.cs"
204                    SubType = "Code"
205                    BuildAction = "Compile"
206                />
207                <File
208                    RelPath = "HttpClient.cs"
209                    SubType = "Code"
210                    BuildAction = "Compile"
211                />
212                <File
213                    RelPath = "HttpHeader.cs"
214                    SubType = "Code"
215                    BuildAction = "Compile"
216                />
217                <File
218                    RelPath = "HttpRequestResponse.cs"
219                    SubType = "Code"
220                    BuildAction = "Compile"
221                />
222                <File
223                    RelPath = "HttpServer.cs"
224                    SubType = "Code"
225                    BuildAction = "Compile"
226                />
227                <File
228                    RelPath = "Interfaces.cs"
229                    SubType = "Code"
230                    BuildAction = "Compile"
231                />
232                <File
233                    RelPath = "Message.cs"
234                    SubType = "Code"
235                    BuildAction = "Compile"
236                />
237                <File
238                    RelPath = "MessageAddress.cs"
239                    SubType = "Code"
240                    BuildAction = "Compile"
241                />
242                <File
243                    RelPath = "MessageAttachment.cs"
244                    SubType = "Code"
245                    BuildAction = "Compile"
246                />
247                <File
248                    RelPath = "MessageEncoder.cs"
249                    SubType = "Code"
250                    BuildAction = "Compile"
251                />
252                <File
253                    RelPath = "MessageHeaderField.cs"
254                    SubType = "Code"
255                    BuildAction = "Compile"
256                />
257                <File
258                    RelPath = "Pop3Client.cs"
259                    SubType = "Code"
260                    BuildAction = "Compile"
261                />
262                <File
263                    RelPath = "Server.cs"
264                    SubType = "Code"
265                    BuildAction = "Compile"
266                />
267                <File
268                    RelPath = "SimpleHttpServer.cs"
269                    SubType = "Code"
270                    BuildAction = "Compile"
271                />
272                <File
273                    RelPath = "SimpleServer.cs"
274                    SubType = "Code"
275                    BuildAction = "Compile"
276                />
277                <File
278                    RelPath = "SmtpClient.cs"
279                    SubType = "Code"
280                    BuildAction = "Compile"
281                />
282                <File
283                    RelPath = "TcpClient.cs"
284                    SubType = "Code"
285                    BuildAction = "Compile"
286                />
287                <File
288                    RelPath = "TcpServer.cs"
289                    SubType = "Code"
290                    BuildAction = "Compile"
291                />
292                <File
293                    RelPath = "UrlParser.cs"
294                    SubType = "Code"
295                    BuildAction = "Compile"
296                />
297                <File
298                    RelPath = "Worker.cs"
299                    SubType = "Code"
300                    BuildAction = "Compile"
301                />
302                <File
303                    RelPath = "WorkerCollection.cs"
304                    SubType = "Code"
305                    BuildAction = "Compile"
306                />
307            </Include>
308        </Files>
309    </ECSHARP>
310</VisualStudioProject>
311
Source/RemObjects.InternetPack/RemObjects.InternetPack.CF.2008.csproj
8585      <Name>MSCorLib</Name>
8686      <Private>False</Private>
8787    </Reference>
88    <Reference Include="RemObjects.DebugServer">
89      <Name>RemObjects.DebugServer</Name>
90    </Reference>
9188    <Reference Include="System">
9289      <Name>System</Name>
9390      <Private>False</Private>
Source/RemObjects.InternetPack/Connection.cs
1313using System.Net.Sockets;
1414using System.Xml;
1515using System.Text;
16using RemObjects.DebugServer;
1716using RemObjects.InternetPack.Helpers;
1817
1918namespace RemObjects.InternetPack
...... 
771770
772771        public virtual void SkipBytes(int aSize)
773772        {
774            if (aSize <= 0) return;
775            byte[] lBuffer = new byte[BUFFER_SIZE]; // ToDo: make this configurable
776            while (aSize > 0)
777            {
778                aSize -= Read(lBuffer, 0, aSize > BUFFER_SIZE ? BUFFER_SIZE : aSize);
779            }
773            if (aSize <= 0)
774                return;
775
776            byte[] lBuffer = new byte[BUFFER_SIZE]; // ToDo: make this configurable
777            while (aSize > 0)
778            {
779                // lBytesRead can be 0 if connection is closed
780                int lBytesRead = Read(lBuffer, 0, aSize > BUFFER_SIZE ? BUFFER_SIZE : aSize);
781
782                if (lBytesRead == 0)
783                    break;
784
785                aSize -= lBytesRead;
786            }
780787        }
781788        #endregion
782789
Source/RemObjects.InternetPack/MessageHeaderField.cs
33using System.Collections.Specialized;
44using System.Text;
55
6using RemObjects.DebugServer;
7
86namespace RemObjects.InternetPack.Messages
97{
108  public class HeaderField : Hashtable
Source/RemObjects.InternetPack/RemObjects.InternetPack.2003.csproj
1<VisualStudioProject>
2    <CSHARP
3        ProjectType = "Local"
4        ProductVersion = "7.10.3077"
5        SchemaVersion = "2.0"
6        ProjectGuid = "{7C02E26A-2522-4C8F-8CAC-4E65854A09DE}"
7        SccProjectName = "\\Internet Pack for .NET\Source\RemObjects.InternetPack"
8        SccLocalPath = "."
9        SccProvider = "MSSCCI:TeamCoherence"
10    >
11        <Build>
12            <Settings
13                ApplicationIcon = ""
14                AssemblyKeyContainerName = ""
15                AssemblyName = "RemObjects.InternetPack"
16                AssemblyOriginatorKeyFile = ""
17                DefaultClientScript = "JScript"
18                DefaultHTMLPageLayout = "Grid"
19                DefaultTargetSchema = "IE50"
20                DelaySign = "false"
21                OutputType = "Library"
22                PreBuildEvent = ""
23                PostBuildEvent = ""
24                RootNamespace = "RemObjects.InternetPack"
25                RunPostBuildEvent = "OnBuildSuccess"
26                StartupObject = ""
27            >
28                <Config
29                    Name = "Debug"
30                    AllowUnsafeBlocks = "false"
31                    BaseAddress = "285212672"
32                    CheckForOverflowUnderflow = "false"
33                    ConfigurationOverrideFile = ""
34                    DefineConstants = "DEBUG;TRACE;DEBUGSERVER;FULLFRAMEWORK;REMOBJECTS_SIGN_ASSEMBLY;DESIGN"
35                    DocumentationFile = ""
36                    DebugSymbols = "true"
37                    FileAlignment = "4096"
38                    IncrementalBuild = "false"
39                    NoStdLib = "false"
40                    NoWarn = ""
41                    Optimize = "false"
42                    OutputPath = "bin\debug\"
43                    RegisterForComInterop = "false"
44                    RemoveIntegerChecks = "false"
45                    TreatWarningsAsErrors = "false"
46                    WarningLevel = "4"
47                />
48                <Config
49                    Name = "Release"
50                    AllowUnsafeBlocks = "false"
51                    BaseAddress = "285212672"
52                    CheckForOverflowUnderflow = "false"
53                    ConfigurationOverrideFile = ""
54                    DefineConstants = "FULLFRAMEWORK;REMOBJECTS_SIGN_ASSEMBLY;DESIGN"
55                    DocumentationFile = ""
56                    DebugSymbols = "true"
57                    FileAlignment = "4096"
58                    IncrementalBuild = "false"
59                    NoStdLib = "false"
60                    NoWarn = ""
61                    Optimize = "true"
62                    OutputPath = "..\..\Bin\"
63                    RegisterForComInterop = "false"
64                    RemoveIntegerChecks = "false"
65                    TreatWarningsAsErrors = "false"
66                    WarningLevel = "4"
67                />
68                <Config
69                    Name = "TRIAL"
70                    AllowUnsafeBlocks = "false"
71                    BaseAddress = "285212672"
72                    CheckForOverflowUnderflow = "false"
73                    ConfigurationOverrideFile = ""
74                    DefineConstants = "FULLFRAMEWORK;REMOBJECTS_SIGN_ASSEMBLY;TRIAL"
75                    DocumentationFile = ""
76                    DebugSymbols = "false"
77                    FileAlignment = "4096"
78                    IncrementalBuild = "false"
79                    NoStdLib = "false"
80                    NoWarn = ""
81                    Optimize = "true"
82                    OutputPath = "..\..\Bin\Trial\"
83                    RegisterForComInterop = "false"
84                    RemoveIntegerChecks = "false"
85                    TreatWarningsAsErrors = "false"
86                    WarningLevel = "4"
87                />
88                <Config
89                    Name = "Mono"
90                    AllowUnsafeBlocks = "false"
91                    BaseAddress = "285212672"
92                    CheckForOverflowUnderflow = "false"
93                    ConfigurationOverrideFile = ""
94                    DefineConstants = "FULLFRAMEWORK;REMOBJECTS_SIGN_ASSEMBLY;MONO"
95                    DocumentationFile = ""
96                    DebugSymbols = "false"
97                    FileAlignment = "4096"
98                    IncrementalBuild = "false"
99                    NoStdLib = "false"
100                    NoWarn = ""
101                    Optimize = "true"
102                    OutputPath = "..\..\Bin\Mono\"
103                    RegisterForComInterop = "false"
104                    RemoveIntegerChecks = "false"
105                    TreatWarningsAsErrors = "false"
106                    WarningLevel = "4"
107                />
108                <Config
109                    Name = "Mono TRIAL"
110                    AllowUnsafeBlocks = "false"
111                    BaseAddress = "285212672"
112                    CheckForOverflowUnderflow = "false"
113                    ConfigurationOverrideFile = ""
114                    DefineConstants = "FULLFRAMEWORK;REMOBJECTS_SIGN_ASSEMBLY;TRIAL;MONO"
115                    DocumentationFile = ""
116                    DebugSymbols = "false"
117                    FileAlignment = "4096"
118                    IncrementalBuild = "false"
119                    NoStdLib = "false"
120                    NoWarn = ""
121                    Optimize = "true"
122                    OutputPath = "..\..\Bin\Trial\Mono\"
123                    RegisterForComInterop = "false"
124                    RemoveIntegerChecks = "false"
125                    TreatWarningsAsErrors = "false"
126                    WarningLevel = "4"
127                />
128            </Settings>
129            <References>
130                <Reference
131                    Name = "System"
132                    AssemblyName = "System"
133                    HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
134                />
135                <Reference
136                    Name = "System.Data"
137                    AssemblyName = "System.Data"
138                    HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
139                />
140                <Reference
141                    Name = "System.XML"
142                    AssemblyName = "System.Xml"
143                    HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
144                />
145                <Reference
146                    Name = "System.Drawing"
147                    AssemblyName = "System.Drawing"
148                    HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Drawing.dll"
149                />
150                <Reference
151                    Name = "RemObjects.DebugServer"
152                    AssemblyName = "RemObjects.DebugServer"
153                    HintPath = "..\..\Bin\RemObjects.DebugServer.dll"
154                />
155            </References>
156        </Build>
157        <Files>
158            <Include>
159                <File
160                    RelPath = "AssemblyInfo.cs"
161                    SubType = "Code"
162                    BuildAction = "Compile"
163                />
164                <File
165                    RelPath = "AsyncServer.cs"
166                    SubType = "Component"
167                    BuildAction = "Compile"
168                />
169                <File
170                    RelPath = "Bindings.cs"
171                    SubType = "Code"
172                    BuildAction = "Compile"
173                />
174                <File
175                    RelPath = "BoundIncomingStream.cs"
176                    SubType = "Code"
177                    BuildAction = "Compile"
178                />
179                <File
180                    RelPath = "Client.cs"
181                    SubType = "Component"
182                    BuildAction = "Compile"
183                />
184                <File
185                    RelPath = "CommandBasedClient.cs"
186                    SubType = "Component"
187                    BuildAction = "Compile"
188                />
189                <File
190                    RelPath = "CommandBasedServer.cs"
191                    SubType = "Component"
192                    BuildAction = "Compile"
193                />
194                <File
195                    RelPath = "Connection.cs"
196                    SubType = "Code"
197                    BuildAction = "Compile"
198                />
199                <File
200                    RelPath = "ConnectionPool.cs"
201                    SubType = "Code"
202                    BuildAction = "Compile"
203                />
204                <File
205                    RelPath = "Debug.cs"
206                    SubType = "Code"
207                    BuildAction = "Compile"
208                />
209                <File
210                    RelPath = "Dns.cs"
211                    SubType = "Code"
212                    BuildAction = "Compile"
213                />
214                <File
215                    RelPath = "EchoServer.cs"
216                    SubType = "Component"
217                    BuildAction = "Compile"
218                />
219                <File
220                    RelPath = "Events.cs"
221                    SubType = "Code"
222                    BuildAction = "Compile"
223                />
224                <File
225                    RelPath = "FtpClient.cs"
226                    SubType = "Component"
227                    BuildAction = "Compile"
228                />
229                <File
230                    RelPath = "FtpListing.cs"
231                    SubType = "Code"
232                    BuildAction = "Compile"
233                />
234                <File
235                    RelPath = "FtpServer.cs"
236                    SubType = "Component"
237                    BuildAction = "Compile"
238                />
239                <File
240                    RelPath = "HttpClient.cs"
241                    SubType = "Component"
242                    BuildAction = "Compile"
243                />
244                <File
245                    RelPath = "HttpHeader.cs"
246                    SubType = "Code"
247                    BuildAction = "Compile"
248                />
249                <File
250                    RelPath = "HttpRequestResponse.cs"
251                    SubType = "Code"
252                    BuildAction = "Compile"
253                />
254                <File
255                    RelPath = "HttpServer.cs"
256                    SubType = "Component"
257                    BuildAction = "Compile"
258                />
259                <File
260                    RelPath = "Interfaces.cs"
261                    SubType = "Code"
262                    BuildAction = "Compile"
263                />
264                <File
265                    RelPath = "Message.cs"
266                    SubType = "Code"
267                    BuildAction = "Compile"
268                />
269                <File
270                    RelPath = "MessageAddress.cs"
271                    SubType = "Code"
272                    BuildAction = "Compile"
273                />
274                <File
275                    RelPath = "MessageAttachment.cs"
276                    SubType = "Code"
277                    BuildAction = "Compile"
278                />
279                <File
280                    RelPath = "MessageEncoder.cs"
281                    SubType = "Code"
282                    BuildAction = "Compile"
283                />
284                <File
285                    RelPath = "MessageHeaderField.cs"
286                    SubType = "Code"
287                    BuildAction = "Compile"
288                />
289                <File
290                    RelPath = "Pop3Client.cs"
291                    SubType = "Component"
292                    BuildAction = "Compile"
293                />
294                <File
295                    RelPath = "Server.cs"
296                    SubType = "Component"
297                    BuildAction = "Compile"
298                />
299                <File
300                    RelPath = "SimpleHttpServer.cs"
301                    SubType = "Component"
302                    BuildAction = "Compile"
303                />
304                <File
305                    RelPath = "SimpleServer.cs"
306                    SubType = "Code"
307                    BuildAction = "Compile"
308                />
309                <File
310                    RelPath = "SmtpClient.cs"
311                    SubType = "Component"
312                    BuildAction = "Compile"
313                />
314                <File
315                    RelPath = "TcpClient.cs"
316                    SubType = "Component"
317                    BuildAction = "Compile"
318                />
319                <File
320                    RelPath = "TcpServer.cs"
321                    SubType = "Component"
322                    BuildAction = "Compile"
323                />
324                <File
325                    RelPath = "UrlParser.cs"
326                    SubType = "Code"
327                    BuildAction = "Compile"
328                />
329                <File
330                    RelPath = "Worker.cs"
331                    SubType = "Code"
332                    BuildAction = "Compile"
333                />
334                <File
335                    RelPath = "WorkerCollection.cs"
336                    SubType = "Code"
337                    BuildAction = "Compile"
338                />
339                <File
340                    RelPath = "Glyphs\EchoServer.bmp"
341                    BuildAction = "EmbeddedResource"
342                />
343                <File
344                    RelPath = "Glyphs\FtpClient.bmp"
345                    BuildAction = "EmbeddedResource"
346                />
347                <File
348                    RelPath = "Glyphs\FtpServer.bmp"
349                    BuildAction = "EmbeddedResource"
350                />
351                <File
352                    RelPath = "Glyphs\HttpClient.bmp"
353                    BuildAction = "EmbeddedResource"
354                />
355                <File
356                    RelPath = "Glyphs\HttpServer.bmp"
357                    BuildAction = "EmbeddedResource"
358                />
359                <File
360                    RelPath = "Glyphs\SimpleHttpServer.bmp"
361                    BuildAction = "EmbeddedResource"
362                />
363                <File
364                    RelPath = "Glyphs\SmtpClient.bmp"
365                    BuildAction = "EmbeddedResource"
366                />
367                <File
368                    RelPath = "Glyphs\TcpClient.bmp"
369                    BuildAction = "EmbeddedResource"
370                />
371                <File
372                    RelPath = "Glyphs\TcpServer.bmp"
373                    BuildAction = "EmbeddedResource"
374                />
375            </Include>
376        </Files>
377    </CSHARP>
378</VisualStudioProject>
379
Source/RemObjects.InternetPack/RemObjects.InternetPack.2005.csproj
3535    <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
3636    <ConfigurationOverrideFile>
3737    </ConfigurationOverrideFile>
38    <DefineConstants>DEBUG;TRACE;DEBUGSERVER;FULLFRAMEWORK;REMOBJECTS_SIGN_ASSEMBLY;DESIGN</DefineConstants>
38    <DefineConstants>TRACE;DEBUG;FULLFRAMEWORK;REMOBJECTS_SIGN_ASSEMBLY;DESIGN</DefineConstants>
3939    <DocumentationFile>
4040    </DocumentationFile>
4141    <DebugSymbols>true</DebugSymbols>
...... 
142142    <NoWarn>1699</NoWarn>
143143    <DebugType>pdbonly</DebugType>
144144    <PlatformTarget>AnyCPU</PlatformTarget>
145    <CodeAnalysisRuleAssemblies>C:\Program Files (x86)\Microsoft Visual Studio 8\Team Tools\Static Analysis Tools\FxCop\\rules</CodeAnalysisRuleAssemblies>
146145    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
147146    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
148147  </PropertyGroup>
149148  <ItemGroup>
150    <Reference Include="RemObjects.DebugServer">
151      <Name>RemObjects.DebugServer</Name>
152      <HintPath>..\..\Bin\RemObjects.DebugServer.dll</HintPath>
153    </Reference>
154149    <Reference Include="System">
155150      <Name>System</Name>
156151    </Reference>
Source/RemObjects.InternetPack/AsyncServer.cs
1212using System.ComponentModel;
1313using System.Net.Sockets;
1414using System.Net;
15using RemObjects.DebugServer;
1615using RemObjects.InternetPack.Helpers;
1716
1817namespace RemObjects.InternetPack
...... 
3130                else
3231                    fWorkers = null;
3332
33                Int32 lActualPort = this.Port;
34
3435                if (BindingV4 != null && BindV4)
3536                {
3637                    BindingV4.BindUnthreaded();
37
3838                    BindingV4.ListeningSocket.Listen(BindingV4.MaxWaitConnections);
39                    BindingV4.ListeningSocket.BeginAccept(new AsyncCallback(IntAccept), BindingV4.ListeningSocket);
40                    lActualPort = ((System.Net.IPEndPoint)this.BindingV4.ListeningSocket.LocalEndPoint).Port;
41                }
3942
40                    BindingV4.ListeningSocket.BeginAccept(new AsyncCallback(IntAccept), BindingV4.ListeningSocket);
41                } if (BindingV6 != null && BindV6)
43                if (BindingV6 != null && BindV6)
4244                {
4345                    BindingV6.BindUnthreaded();
44
4546                    BindingV6.ListeningSocket.Listen(BindingV6.MaxWaitConnections);
46
4747                    BindingV6.ListeningSocket.BeginAccept(new AsyncCallback(IntAccept), BindingV6.ListeningSocket);
48                    lActualPort = ((System.Net.IPEndPoint)this.BindingV6.ListeningSocket.LocalEndPoint).Port;
4849                }
50
51                if (lActualPort != this.Port)
52                    this.Port = lActualPort;
53                
4954                fActive = true;
5055            }
5156            catch
Source/RemObjects.InternetPack/TcpServer.cs
99using System;
1010using System.Net.Sockets;
1111using System.ComponentModel;
12using RemObjects.DebugServer;
1312
1413namespace RemObjects.InternetPack
1514{
...... 
3635
3736    #region Events
3837    public event OnTcpConnectionHandler OnTcpConnection;
39    private void TriggerOnTcpConnection(Connection aConnection)
40    {
41      if (OnTcpConnection != null)
42      {
43        OnTcpConnectionArgs lEventArgs = new OnTcpConnectionArgs(aConnection);
44        OnTcpConnection(this, lEventArgs);
45      }
38    private void TriggerOnTcpConnection(Connection aConnection)
39    {
40      if (OnTcpConnection != null)
41      {
42        OnTcpConnectionArgs lEventArgs = new OnTcpConnectionArgs(aConnection);
43        OnTcpConnection(this, lEventArgs);
44      }
4645    }
4746    #endregion
4847
4948    #region Methods for implementation in descendand classes
50    protected internal virtual void HandleTcpConnection(Connection aConnection)
51    {
52      TriggerOnTcpConnection(aConnection);
53    }
49    protected internal virtual void HandleTcpConnection(Connection aConnection)
50    {
51      TriggerOnTcpConnection(aConnection);
52    }
5453    #endregion
5554
5655
...... 
7776        /* ToDo: provide some sort of notification to the server object via event. */
7877        if (e.ErrorCode != 10054) throw e;
7978      }
79#if DEBUGSERVER
8080      catch (Exception e)
8181      {
8282        Debug.Write(e);
83      }
84      finally
83      }
84#else
85      catch
8586      {
87      }
88#endif
89      finally
90      {
8691        DataConnection.Close();
8792      }
8893    }
8994  }
9095  
9196  #region Events
92  public delegate void OnTcpConnectionHandler(object aSender, OnTcpConnectionArgs ea);
93  public class OnTcpConnectionArgs: ConnectionEventArgs
94  {
95    public OnTcpConnectionArgs(Connection aConnection) : base(aConnection)
96    {
97    }
97  public delegate void OnTcpConnectionHandler(object aSender, OnTcpConnectionArgs ea);
98  public class OnTcpConnectionArgs: ConnectionEventArgs
99  {
100    public OnTcpConnectionArgs(Connection aConnection) : base(aConnection)
101    {
102    }
98103  }
99104  #endregion
100105
Source/RemObjects.InternetPack/SslConnection.cs
1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Reflection;
5using System.Text;
6using System.Net.Sockets;
7using System.Security;
8using System.Net.Security;
9using System.ComponentModel;
10using System.Security.Cryptography;
11using System.Security.Cryptography.X509Certificates;
12
13namespace RemObjects.InternetPack
14{
15    public class SslValidateCertificateArgs : EventArgs
16    {
17        public SslValidateCertificateArgs(X509Certificate cert)
18        {
19            fCertificate = cert;
20        }
21
22        private X509Certificate fCertificate;
23        public X509Certificate Certificate { get { return fCertificate; } }
24
25        private bool fCancel;
26        public bool Cancel { get { return fCancel; } set { fCancel = value; } }
27    }
28
29    public class SslNeedPasswordArgs : EventArgs
30    {
31        public SslNeedPasswordArgs()
32        {
33        }
34
35        private SecureString fPassword;
36        public SecureString Password { get { return fPassword; } set { fPassword = value; } }
37
38        public string PasswordString
39        {
40            get { return null; }
41            set
42            {
43                if (value == null)
44                {
45                    fPassword = null;
46                }
47                else
48                {
49                    fPassword = new SecureString();
50                    for (int i = 0; i < value.Length; i++)
51                        fPassword.AppendChar(value[i]);
52                }
53            }
54        }
55    }
56
57    public class SslConnectionFactory: IConnectionFactory
58    {
59        private string fTargetHostName;
60        [DefaultValue(""), Category("Ssl Options")]
61        public string TargetHostName { get { return fTargetHostName; } set { fTargetHostName = value; } }
62
63        private bool fUseMono;
64        [DefaultValue(false), Category("Ssl Options")]
65        public bool UseMono { get { return fUseMono; } set { fUseMono = value; } }
66
67        private bool fEnabled;
68        [DefaultValue(false), Category("Ssl Options")]
69        public bool Enabled { get { return fEnabled; } set { fEnabled = value; } }
70
71        private string fCertificateFileName;
72        [DefaultValue(null), Category("Ssl Options")]
73        public string CertificateFileName { get { return fCertificateFileName; } set { fCertificateFileName = value; } }
74
75        [Category("Ssl Options")]
76        public event EventHandler<SslNeedPasswordArgs> NeedPassword;
77
78        private X509Certificate2 fCertificate;
79        [Browsable(false)]
80        public X509Certificate2 Certificate { get { return fCertificate; } set { fCertificate = value; } }
81
82        [Browsable(false)]
83        public bool HasCertificate
84        {
85            get
86            {
87                return fCertificate != null || !String.IsNullOrEmpty(fCertificateFileName);
88            }
89        }
90
91        private void LoadCertificate()
92        {
93            lock (this)
94            {
95                if (fCertificate != null) return;
96                if (String.IsNullOrEmpty(fCertificateFileName))
97                {
98                    throw new Exception("Certificate not set and CertificateFileName is empty");
99                }
100                SslNeedPasswordArgs lArgs = new SslNeedPasswordArgs();
101                if (NeedPassword != null) NeedPassword(this, lArgs);
102                fCertificate = new X509Certificate2(fCertificateFileName, lArgs.Password, X509KeyStorageFlags.Exportable);
103            }
104        }
105
106        internal Assembly fMonoAssembly;
107        internal Assembly GetMonoAssembly()
108        {
109            if (!fUseMono) return null;
110
111            if (fMonoAssembly != null) return fMonoAssembly;
112            try
113            {
114                fMonoAssembly = Assembly.Load("Mono.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756");
115            }
116            catch
117            {
118                fUseMono = false;
119            }
120            return fMonoAssembly;
121        }
122
123
124        [Category("Ssl Options")]
125        public event EventHandler<SslValidateCertificateArgs> ValidateRemoteCertificate;
126
127        protected internal bool OnValidateRemoteCertificate(X509Certificate cert)
128        {
129            if (ValidateRemoteCertificate != null)
130            {
131                SslValidateCertificateArgs lArgs = new SslValidateCertificateArgs(cert);
132                ValidateRemoteCertificate(this, lArgs);
133                return !lArgs.Cancel;
134            }
135            return true;
136        }
137
138        #region IConnectionFactory Members
139
140        public Connection CreateServerConnection(Socket aSocket)
141        {
142            if (!fEnabled)
143            {
144                return new Connection(aSocket);
145            }
146            if (fCertificate == null) LoadCertificate();
147            return new SslConnection(this, aSocket);
148        }
149
150        public Connection CreateClientConnection(Binding aBinding)
151        {
152            if (!fEnabled)
153            {
154                return new Connection(aBinding);
155            }
156            if (HasCertificate) LoadCertificate();
157            return new SslConnection(this, aBinding);
158        }
159
160        #endregion
161    }
162    public class SslConnection : Connection
163    {
164        protected internal class InnerConnection : Connection
165        {
166            public InnerConnection(Socket s) : base(s) { }
167            public InnerConnection(Binding b) : base(b) { }
168
169
170            public Socket IntDataSocket { get { return base.DataSocket; } }
171            public int IntDataSocketAvailable { get { return base.DataSocketAvailable; } }
172
173            public override int Read(byte[] aBuffer, int aOffset, int aCount)
174            {
175
176                return base.ReceiveWhatsAvailable(aBuffer, aOffset, aCount);
177            }
178        }
179
180        private SslConnectionFactory fFactory;
181        private InnerConnection fInnerConnection;
182        private Stream fSsl;
183
184        public SslConnection(SslConnectionFactory aFactory, Binding aBinding)
185            : base((Socket)null)
186        {
187            fFactory = aFactory;
188            fInnerConnection = new InnerConnection(aBinding);
189            fInnerConnection.BufferedAsync = false;
190            fInnerConnection.AsyncDisconnect += new EventHandler(InnerConnection_AsyncDisconnect);
191            fInnerConnection.AsyncHaveIncompleteData += new EventHandler(InnerConnection_AsyncHaveIncompleteData);
192        }
193
194        public SslConnection(SslConnectionFactory aFactory, Socket aSocket)
195            : base((Socket)null)
196        {
197            fFactory = aFactory;
198            fInnerConnection = new InnerConnection(aSocket);
199            fInnerConnection.BufferedAsync = false;
200            fInnerConnection.AsyncDisconnect += new EventHandler(InnerConnection_AsyncDisconnect);
201            fInnerConnection.AsyncHaveIncompleteData += new EventHandler(InnerConnection_AsyncHaveIncompleteData);
202        }
203
204        protected override int DataSocketAvailable
205        {
206            get
207            {
208                return fInnerConnection.IntDataSocketAvailable;
209            }
210        }
211
212        public override Socket DataSocket
213        {
214            get
215            {
216                return fInnerConnection.DataSocket;
217            }
218        }
219
220        public override bool DataSocketConnected
221        {
222            get
223            {
224                return fInnerConnection.Connected;
225            }
226        }
227
228        public override bool EnableNagle
229        {
230            get
231            {
232                return fInnerConnection.EnableNagle;
233            }
234            set
235            {
236                fInnerConnection.EnableNagle = value;
237            }
238        }
239
240        bool Ssl_RemoteCertificateValidation(object sender, X509Certificate aCertificate, X509Chain aChain, SslPolicyErrors aErrors)
241        {
242            return fFactory.OnValidateRemoteCertificate(aCertificate);
243        }
244
245        AsymmetricAlgorithm MonoSsl_GetPrivateKey(X509Certificate aCert, string aTargetHost)
246        {
247            return fFactory.Certificate.PrivateKey;
248        }
249
250        bool MonoSsl_RemoteCertificateValidation(X509Certificate aCert, int[] aErrors)
251        {
252            return fFactory.OnValidateRemoteCertificate(aCert);
253        }
254
255        private void CreateMonoServerStream()
256        {
257            Type lType = fFactory.GetMonoAssembly().GetType("Mono.Security.Protocol.Tls.SslServerStream", true);
258            fSsl = (Stream)Activator.CreateInstance(lType, fInnerConnection, fFactory.Certificate, false, false);
259
260            object o = Delegate.CreateDelegate(fFactory.GetMonoAssembly().GetType("Mono.Security.Protocol.Tls.PrivateKeySelectionCallback", true), this, "MonoSsl_GetPrivateKey", false, true);
261            lType.InvokeMember("set_PrivateKeyCertSelectionDelegate", BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.Public, null, fSsl, new object[] { o });
262
263            o = Delegate.CreateDelegate(fFactory.GetMonoAssembly().GetType("Mono.Security.Protocol.Tls.CertificateValidationCallback", true), this, "MonoSsl_RemoteCertificateValidation", false, true);
264            lType.InvokeMember("set_ClientCertValidationDelegate", BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.Public, null, fSsl, new object[] { o });
265        }
266
267        protected internal override void InitializeServerConnection()
268        {
269            if (fFactory.GetMonoAssembly() != null)
270            {
271                CreateMonoServerStream();
272            }
273            else
274            {
275                fSsl = new SslStream(fInnerConnection, true, new RemoteCertificateValidationCallback(Ssl_RemoteCertificateValidation));
276                ((SslStream)fSsl).AuthenticateAsServer(fFactory.Certificate);
277            }
278        }
279
280        protected internal override IAsyncResult BeginInitializeServerConnection(AsyncCallback cb, object o)
281        {
282            if (fFactory.UseMono)
283            {
284                CreateMonoServerStream();
285                return null;
286            }
287            else
288            {
289                fSsl = new SslStream(fInnerConnection, true, new RemoteCertificateValidationCallback(Ssl_RemoteCertificateValidation));
290                return ((SslStream)fSsl).BeginAuthenticateAsServer(fFactory.Certificate, cb, o);
291            }
292        }
293
294        protected internal override void EndInitializeServerConnection(IAsyncResult ar)
295        {
296            if (!fFactory.UseMono)
297            {
298                ((SslStream)fSsl).EndAuthenticateAsServer(ar);
299            }
300        }
301
302        private void CreateMonoClientStream()
303        {
304            Type lType = fFactory.GetMonoAssembly().GetType("Mono.Security.Protocol.Tls.SslClientStream", true);
305            fSsl = (Stream)Activator.CreateInstance(lType, fInnerConnection, fFactory.TargetHostName, false);
306
307            object o = Delegate.CreateDelegate(fFactory.GetMonoAssembly().GetType("Mono.Security.Protocol.Tls.PrivateKeySelectionCallback", true), this, "MonoSsl_GetPrivateKey", false, true);
308            lType.InvokeMember("set_PrivateKeyCertSelectionDelegate", BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.Public, null, fSsl, new object[] { o });
309
310            o = Delegate.CreateDelegate(fFactory.GetMonoAssembly().GetType("Mono.Security.Protocol.Tls.CertificateValidationCallback", true), this, "MonoSsl_RemoteCertificateValidation", false, true);
311            lType.InvokeMember("set_ServerCertValidationDelegate", BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.Public, null, fSsl, new object[] { o });
312        }
313
314        public override void Connect(System.Net.EndPoint aEndPoint)
315        {
316            fInnerConnection.Connect(aEndPoint);
317            if (fFactory.GetMonoAssembly() != null)
318            {
319                CreateMonoClientStream();
320            }
321            else
322            {
323                fSsl = new SslStream(fInnerConnection, true, new RemoteCertificateValidationCallback(Ssl_RemoteCertificateValidation));
324                ((SslStream)fSsl).AuthenticateAsClient(fFactory.TargetHostName);
325            }
326        }
327
328        public override void Connect(System.Net.IPAddress aIPAddress, int aPort)
329        {
330            Connect(new System.Net.IPEndPoint(aIPAddress, aPort));
331        }
332
333        private class ConnectWrapper : IAsyncResult
334        {
335            public ConnectWrapper(AsyncCallback aCallback, object aState)
336            {
337                fAsyncState = aState;
338                fCallback = aCallback;
339            }
340            private AsyncCallback fCallback;
341            private object fAsyncState;
342            private volatile System.Threading.ManualResetEvent fWaitHandle;
343            private volatile bool fComplete;
344            public object AsyncState
345            {
346                get { return fAsyncState; }
347            }
348
349            public System.Threading.WaitHandle AsyncWaitHandle
350            {
351                get
352                {
353                    if (fWaitHandle != null) return fWaitHandle;
354                    lock (this)
355                    {
356                        if (fWaitHandle == null)
357                        {
358                            fWaitHandle = new System.Threading.ManualResetEvent(fComplete);
359                        }
360                    }
361                    return fWaitHandle;
362                }
363            }
364
365            public bool CompletedSynchronously
366            {
367                get { return false; }
368            }
369
370            public bool IsCompleted
371            {
372                get { return fComplete; }
373            }
374
375            public void Dispose()
376            {
377                if (fWaitHandle != null) fWaitHandle.Close();
378                fWaitHandle = null;
379            }
380            public void ConnectionConnect(IAsyncResult ar)
381            {
382                SslConnection lOwner = (SslConnection)ar.AsyncState;
383                try
384                {
385                    lOwner.fInnerConnection.EndConnect(ar);
386                }
387                catch (Exception ex)
388                {
389                    fFailure = ex;
390                    fComplete = true;
391                    lock (this)
392                    {
393                        if (fWaitHandle != null)
394                            fWaitHandle.Set();
395                    }
396                    fCallback(ar);
397                    return;
398                }
399                if (lOwner.fFactory.GetMonoAssembly() != null)
400                {
401                    lOwner.CreateMonoClientStream();
402                    fComplete = true;
403                    lock (this)
404                    {
405                        if (fWaitHandle != null)
406                            fWaitHandle.Set();
407                    }
408                    fCallback(ar);
409                    return;
410                }
411                else
412                {
413                    lOwner.fSsl = new SslStream(lOwner.fInnerConnection, true, new RemoteCertificateValidationCallback(lOwner.Ssl_RemoteCertificateValidation));
414                    ((SslStream)lOwner.fSsl).BeginAuthenticateAsClient(lOwner.fFactory.TargetHostName, new AsyncCallback(SslAuthenticateAsClient), lOwner);
415                }
416            }
417
418            private void SslAuthenticateAsClient(IAsyncResult ar)
419            {
420                SslConnection lOwner = (SslConnection)ar.AsyncState;
421                try
422                {
423                    ((SslStream)lOwner.fSsl).EndAuthenticateAsClient(ar);
424                }
425                catch (Exception ex)
426                {
427                    fFailure = ex;
428                    fComplete = true;
429                    lock (this)
430                    {
431                        if (fWaitHandle != null)
432                            fWaitHandle.Set();
433                    }
434                    fCallback(ar);
435                    return;
436                }
437                lOwner.CreateMonoClientStream();
438                fComplete = true;
439                lock (this)
440                {
441                    if (fWaitHandle != null)
442                        fWaitHandle.Set();
443                }
444                fCallback(ar);
445                return;
446            }
447
448            private Exception fFailure;
449            public void EndConnect()
450            {
451                if (!fComplete)
452                {
453                    AsyncWaitHandle.WaitOne();
454                }
455                Dispose();
456                if (fFailure != null)
457                    throw fFailure;
458            }
459        }
460
461        public override IAsyncResult BeginConnect(System.Net.EndPoint aEndPoint, AsyncCallback callback, object state)
462        {
463            ConnectWrapper lWrapper = new ConnectWrapper(callback, state);
464            fInnerConnection.BeginConnect(aEndPoint, new AsyncCallback(lWrapper.ConnectionConnect), this);
465            return lWrapper;
466        }
467
468        public override IAsyncResult BeginConnect(System.Net.IPAddress anIPAddress, int aPort, AsyncCallback callback, object state)
469        {
470            return BeginConnect(new System.Net.IPEndPoint(anIPAddress, aPort), callback, state);
471        }
472
473        public override void EndConnect(IAsyncResult asyncResult)
474        {
475            ConnectWrapper wr = (ConnectWrapper)asyncResult;
476            wr.EndConnect();
477        }
478
479        protected override void DataSocketClose()
480        {
481            fInnerConnection.Close();
482        }
483
484        protected override void DataSocketClose(bool aDispose)
485        {
486            fInnerConnection.Close(aDispose);
487        }
488
489        void InnerConnection_AsyncHaveIncompleteData(object sender, EventArgs e)
490        {
491            TriggerAsyncHaveIncompleteData();
492        }
493
494        void InnerConnection_AsyncDisconnect(object sender, EventArgs e)
495        {
496            TriggerAsyncDisconnect();
497        }
498
499        protected override int DataSocketReceiveWhatsAvaiable(byte[] aBuffer, int aOffset, int aSize)
500        {
501            try
502            {
503                return fSsl.Read(aBuffer, aOffset, aSize);
504            }
505            catch (IOException) { throw new SocketException(); }
506        }
507
508        protected override int DataSocketSendAsMuchAsPossible(byte[] aBuffer, int aOffset, int aSize)
509        {
510            try
511            {
512                fSsl.Write(aBuffer, aOffset, aSize);
513                return aSize;
514            }
515            catch (IOException)
516            {
517                throw new SocketException();
518            }
519        }
520
521        protected override IAsyncResult IntBeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
522        {
523            return fSsl.BeginRead(buffer, offset, count, callback, state);
524        }
525        protected override int IntEndRead(IAsyncResult ar)
526        {
527            try
528            {
529                return fSsl.EndRead(ar);
530            }
531            catch (IOException)
532            {
533                throw new SocketException();
534            }
535        }
536
537        protected override IAsyncResult IntBeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
538        {
539            return fSsl.BeginWrite(buffer, offset, count, callback, state);
540        }
541        protected override void IntEndWrite(IAsyncResult asyncResult)
542        {
543            try
544            {
545                fSsl.EndWrite(asyncResult);
546            }
547            catch (IOException)
548            {
549                throw new SocketException(); // SocketException is expected in all code that deals with Connection, not IOException
550            }
551        }
552    }
553}
Source/RemObjects.InternetPack/Message.cs
1212using System.IO;
1313using System.Collections;
1414using System.Collections.Specialized;
15using RemObjects.DebugServer;
1615
1716namespace RemObjects.InternetPack.Messages
1817{
Source/RemObjects.InternetPack/Debug.cs
77---------------------------------------------------------------------------*/
88
99using System;
10using RemObjects.DebugServer;
1110
1211namespace RemObjects.InternetPack.Helpers
1312{
Source/RemObjects.InternetPack/HttpHeader.cs
1010using System.Text;
1111using System.Collections;
1212using System.Collections.Specialized;
13using RemObjects.DebugServer;
1413using RemObjects.InternetPack;
1514
1615namespace RemObjects.InternetPack.Http
...... 
335334            do
336335            {
337336                lHeaderLine = aConnection.ReadLine();
337#if DEBUGSERVER
338338                Debug.Write("HTTP HEADER IN: " + lHeaderLine);
339
339#endif
340340                if (lHeaderLine != null && lHeaderLine.Length != 0)
341341                {
342342                    if (fFirstHeader.Length == 0)
...... 
383383        public void WriteHeader(Connection aConnection)
384384        {
385385            aConnection.WriteLine(fFirstHeader);
386#if DEBUGSERVER
386387            Debug.Write("HTTP HEADER OUT: " + fFirstHeader);
388#endif
387389
388390            foreach (HttpHeader aHeader in this)
389391            {
390392                aConnection.WriteLine(aHeader.ToString());
393#if DEBUGSERVER
391394                Debug.Write("HTTP HEADER OUT: " + aHeader.ToString());
395#endif
392396            }
393397            aConnection.WriteLine("");
398#if DEBUGSERVER
394399            Debug.Write("HTTP HEADER OUT:");
400#endif
395401        }
396402
397403        public void SetResponseHeader(string aVersion, int aResult, string aResultText)
Source/RemObjects.InternetPack/RemObjects.InternetPack.CF.2005.csproj
8383      <Name>MSCorLib</Name>
8484      <Private>False</Private>
8585    </Reference>
86    <Reference Include="RemObjects.DebugServer">
87      <Name>RemObjects.DebugServer</Name>
88    </Reference>
8986    <Reference Include="System">
9087      <Name>System</Name>
9188      <Private>False</Private>
Source/RemObjects.InternetPack/CommandBasedServer.cs
1010using System.Collections;
1111using System.Net;
1212using System.Net.Sockets;
13using RemObjects.DebugServer;
1413using RemObjects.InternetPack;
1514
1615namespace RemObjects.InternetPack.CommandBased
1716{
1817
19  public class SessionEventArgs : EventArgs
20  {
18    public class SessionEventArgs : EventArgs
19    {
2120
22    private object fSession;
23    public object Session { get {return fSession;} }
21        private object fSession;
22        public object Session { get { return fSession; } }
2423
25    private Connection fConnection;
26    public Connection Connection { get { return fConnection; }}
24        private Connection fConnection;
25        public Connection Connection { get { return fConnection; } }
2726
28    private Server fServer;
29    public Server Server { get { return fServer; }}
27        private Server fServer;
28        public Server Server { get { return fServer; } }
3029
31    public SessionEventArgs(object session, Connection connection, Server server)
32    {
33      this.fConnection = connection;
34      this.fSession = session;
35      this.fServer = server;
36    }
37  }
30        public SessionEventArgs(object session, Connection connection, Server server)
31        {
32            this.fConnection = connection;
33            this.fSession = session;
34            this.fServer = server;
35        }
36    }
3837
39  public class CommandEventArgs : SessionEventArgs
40  {
38    public class CommandEventArgs : SessionEventArgs
39    {
4140
42    private String fCommand;
43    public String Command { get { return fCommand; } set { fCommand = value; }}
41        private String fCommand;
42        public String Command { get { return fCommand; } set { fCommand = value; } }
4443
45    private String fAllParameters;
46    public String AllParameters { get { return fAllParameters; } set { fAllParameters = value; }}
44        private String fAllParameters;
45        public String AllParameters { get { return fAllParameters; } set { fAllParameters = value; } }
4746
48    private String[] fParameters;
49    public String[] Parameters { get { return fParameters; } set { fParameters = value; } }
47        private String[] fParameters;
48        public String[] Parameters { get { return fParameters; } set { fParameters = value; } }
5049
51    public CommandEventArgs(object session, Connection connection, Server server) : base (session, connection, server)
52    {
53    }
54  }
50        public CommandEventArgs(object session, Connection connection, Server server)
51            : base(session, connection, server)
52        {
53        }
54    }
5555
56  public delegate void OnCommandHandler(Object o, CommandEventArgs ea);
57  public delegate void OnClientConnectedHandler(Object o, SessionEventArgs ea);
58  public delegate void OnClientDisconnectedHandler(Object o, SessionEventArgs ea);
56    public delegate void OnCommandHandler(Object o, CommandEventArgs ea);
57    public delegate void OnClientConnectedHandler(Object o, SessionEventArgs ea);
58    public delegate void OnClientDisconnectedHandler(Object o, SessionEventArgs ea);
5959
60  public abstract class CommandBasedServer : Server
61  {
60    public abstract class CommandBasedServer : Server
61    {
6262
63    internal protected Hashtable commands = new Hashtable();
63        internal protected Hashtable commands = new Hashtable();
6464
65    #region Properties
65        #region Properties
6666
67    private String unknowncommand = "500 {0}: Command not understood";
68    public String UnknownCommand { get { return unknowncommand; } set { unknowncommand = value; } }
67        private String unknowncommand = "500 {0}: Command not understood";
68        public String UnknownCommand { get { return unknowncommand; } set { unknowncommand = value; } }
6969
70    private String greeting = "GREETING";
71    protected internal String Greeting { get {return greeting; } set { greeting = value; } }
70        private String greeting = "GREETING";
71        protected internal String Greeting { get { return greeting; } set { greeting = value; } }
7272
73    private Type fSessionClass;
74    public Type SessionClass
75    {
76      get { return fSessionClass; }
77      set { fSessionClass = value; }
78    }
79    #endregion
73        private Type fSessionClass;
74        public Type SessionClass
75        {
76            get { return fSessionClass; }
77            set { fSessionClass = value; }
78        }
79        #endregion
8080
81    #region Events
81        #region Events
8282
83    public event OnClientConnectedHandler OnClientConnected;
84    public event OnClientDisconnectedHandler OnClientDisconnected;
83        public event OnClientConnectedHandler OnClientConnected;
84        public event OnClientDisconnectedHandler OnClientDisconnected;
8585
86    internal protected virtual void InvokeOnClientConnected(SessionEventArgs args)
87    {
86        internal protected virtual void InvokeOnClientConnected(SessionEventArgs args)
87        {
8888
89      if (OnClientConnected != null)
90      {
91        OnClientConnected(this, args);
92      }
93    }
89            if (OnClientConnected != null)
90            {
91                OnClientConnected(this, args);
92            }
93        }
9494
95    internal protected virtual void InvokeOnClientDisconnected(SessionEventArgs args)
96    {
95        internal protected virtual void InvokeOnClientDisconnected(SessionEventArgs args)
96        {
9797
98      if (OnClientDisconnected != null)
99      {
100        OnClientDisconnected(this, args);
101      }
102    }
103    #endregion
98            if (OnClientDisconnected != null)
99            {
100                OnClientDisconnected(this, args);
101            }
102        }
103        #endregion
104104
105    protected internal virtual CommandBasedSession CreateSession()
106    {
105        protected internal virtual CommandBasedSession CreateSession()
106        {
107107
108      if (SessionClass != null)
109      {
110        return (CommandBasedSession)Activator.CreateInstance(SessionClass);
111      }
112      else
113      {
114        return (CommandBasedSession)Activator.CreateInstance(GetDefaultSessionClass());
115      }
116    }
108            if (SessionClass != null)
109            {
110                return (CommandBasedSession)Activator.CreateInstance(SessionClass);
111            }
112            else
113            {
114                return (CommandBasedSession)Activator.CreateInstance(GetDefaultSessionClass());
115            }
116        }
117117
118    protected abstract void InitCommands();
118        protected abstract void InitCommands();
119119
120    protected CommandBasedServer()
121    {
122      InitCommands();
123    }
120        protected CommandBasedServer()
121        {
122            InitCommands();
123        }
124124
125    public void AddCustomCommand(String name, OnCommandHandler handler)
126    {
127      commands.Add(name, handler);
128    }
125        public void AddCustomCommand(String name, OnCommandHandler handler)
126        {
127            commands.Add(name, handler);
128        }
129129
130    public override Type GetWorkerClass()
131    {
132      return typeof(CommandBasedWorker);
133    }
130        public override Type GetWorkerClass()
131        {
132            return typeof(CommandBasedWorker);
133        }
134134
135    protected virtual Type GetDefaultSessionClass()
136    {
137      return typeof(CommandBasedSession);
138    }
135        protected virtual Type GetDefaultSessionClass()
136        {
137            return typeof(CommandBasedSession);
138        }
139139
140    protected static string CleanStringForCommandResponse(string aValue)
141    {
142      return aValue.Replace("\n","").Replace("\r","");
143    }
140        protected static string CleanStringForCommandResponse(string aValue)
141        {
142            return aValue.Replace("\n", "").Replace("\r", "");
143        }
144144
145    protected internal virtual void HandleCommandException(Connection aConnection, Exception aException)
146    {
147      /* On error, just close the connection, descendand classes may implement
148       * additional/different behavior */
149      aConnection.Close();
150    }
151  }
145        protected internal virtual void HandleCommandException(Connection aConnection, Exception aException)
146        {
147            /* On error, just close the connection, descendand classes may implement
148             * additional/different behavior */
149            aConnection.Close();
150        }
151    }
152152
153  
154  public class CommandBasedSession
155  {
156153
157    private IPEndPoint fRemoteEndPoint;
158    public IPEndPoint RemoteEndPoint
159    {
160      get { return fRemoteEndPoint; }
161      set { fRemoteEndPoint = value; }
162    }
154    public class CommandBasedSession
155    {
163156
164    private IPEndPoint fLocalEndPoint;
165    public IPEndPoint LocalEndPoint
166    {
167      get { return fLocalEndPoint; }
168      set { fLocalEndPoint = value; }
169    }
170  }
157        private IPEndPoint fRemoteEndPoint;
158        public IPEndPoint RemoteEndPoint
159        {
160            get { return fRemoteEndPoint; }
161            set { fRemoteEndPoint = value; }
162        }
171163
164        private IPEndPoint fLocalEndPoint;
165        public IPEndPoint LocalEndPoint
166        {
167            get { return fLocalEndPoint; }
168            set { fLocalEndPoint = value; }
169        }
170    }
172171
173  internal class CommandBasedWorker : Worker
174  {
175172
176    public CommandBasedWorker()
177    {
178    }
173    internal class CommandBasedWorker : Worker
174    {
179175
180    private char[] SPACE = {' '};
176        public CommandBasedWorker()
177        {
178        }
181179
182    protected override void DoWork()
183    {
184      CommandBasedServer lServer = (CommandBasedServer)Owner;
185      CommandBasedSession lSession = lServer.CreateSession();
186      lSession.RemoteEndPoint = ((IPEndPoint)DataConnection.RemoteEndPoint);
187      lSession.LocalEndPoint = ((IPEndPoint)DataConnection.RemoteEndPoint);
180        private char[] SPACE = { ' ' };
188181
189      try
190      {
191        lServer.InvokeOnClientConnected(new SessionEventArgs(lSession, DataConnection, lServer));
192        DataConnection.WriteLine(lServer.Greeting);
193        CommandEventArgs lArgs = new CommandEventArgs(lSession, DataConnection, lServer);
194        String lCmdLine;
182        protected override void DoWork()
183        {
184            CommandBasedServer lServer = (CommandBasedServer)Owner;
185            CommandBasedSession lSession = lServer.CreateSession();
186            lSession.RemoteEndPoint = ((IPEndPoint)DataConnection.RemoteEndPoint);
187            lSession.LocalEndPoint = ((IPEndPoint)DataConnection.RemoteEndPoint);
195188
196        while (DataConnection.Connected)
197        {
198          lCmdLine = DataConnection.ReadLine().Trim();
189            try
190            {
191                lServer.InvokeOnClientConnected(new SessionEventArgs(lSession, DataConnection, lServer));
192                DataConnection.WriteLine(lServer.Greeting);
193                CommandEventArgs lArgs = new CommandEventArgs(lSession, DataConnection, lServer);
194                String lCmdLine;
199195
200          if (lCmdLine.Length == 0)
201            continue;
202          int tempidx = lCmdLine.IndexOf(' ');
196                while (DataConnection.Connected)
197                {
198                    lCmdLine = DataConnection.ReadLine().Trim();
203199
204          if (tempidx == -1)
205          {
206            lArgs.Command = lCmdLine.ToUpper();
207            lArgs.AllParameters = "";
208            lArgs.Parameters = new String[0];
209          }
210          else
211          {
212            lArgs.Command = lCmdLine.Substring(0, tempidx).ToUpper();
213            lArgs.AllParameters = lCmdLine.Substring(tempidx + 1).Trim();
214            lArgs.Parameters = lArgs.AllParameters.Split(SPACE);
215          }
216          OnCommandHandler handler = (OnCommandHandler)lServer.commands[lArgs.Command];
200                    if (lCmdLine.Length == 0)
201                        continue;
202                    int tempidx = lCmdLine.IndexOf(' ');
217203
218          if (handler == null)
219          {
220            DataConnection.WriteLine(String.Format(lServer.UnknownCommand, lArgs.Command));
221          }
222          else
223          {
204                    if (tempidx == -1)
205                    {
206                        lArgs.Command = lCmdLine.ToUpper();
207                        lArgs.AllParameters = "";
208                        lArgs.Parameters = new String[0];
209                    }
210                    else
211                    {
212                        lArgs.Command = lCmdLine.Substring(0, tempidx).ToUpper();
213                        lArgs.AllParameters = lCmdLine.Substring(tempidx + 1).Trim();
214                        lArgs.Parameters = lArgs.AllParameters.Split(SPACE);
215                    }
216                    OnCommandHandler handler = (OnCommandHandler)lServer.commands[lArgs.Command];
224217
225            try
226            {
227              handler(lServer, lArgs);
228            }
229            catch (Exception e)
230            {
231              lServer.HandleCommandException(DataConnection, e);
232            }
233          }
234        }
235      }
236      catch (System.Net.Sockets.SocketException e)
237      {
238        Debug.Write(e.Message);
239      }
240      catch (ConnectionClosedException e)
241      {
242        Debug.Write(e.Message);
243      }
218                    if (handler == null)
219                    {
220                        DataConnection.WriteLine(String.Format(lServer.UnknownCommand, lArgs.Command));
221                    }
222                    else
223                    {
244224
245      lServer.InvokeOnClientDisconnected(new SessionEventArgs(lSession, DataConnection, lServer));
246    }
247  }
225                        try
226                        {
227                            handler(lServer, lArgs);
228                        }
229                        catch (Exception e)
230                        {
231                            lServer.HandleCommandException(DataConnection, e);
232                        }
233                    }
234                }
235            }
236#if DEBUGSERVER
237            catch (System.Net.Sockets.SocketException e)
238            {
239                Debug.Write(e.Message);
240            }
241            catch (ConnectionClosedException e)
242            {
243                Debug.Write(e.Message);
244            }
245#else
246            catch
247            {
248            }
249#endif
250
251            lServer.InvokeOnClientDisconnected(new SessionEventArgs(lSession, DataConnection, lServer));
252        }
253    }
248254}
Source/RemObjects.InternetPack/RemObjects.InternetPack.2008.csproj
2727    <UpgradeBackupLocation>
2828    </UpgradeBackupLocation>
2929    <SignAssembly>false</SignAssembly>
30    <OldToolsVersion>2.0</OldToolsVersion>
3130  </PropertyGroup>
3231  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
33    <OutputPath>..\..\bin\</OutputPath>
32    <OutputPath>bin\debug\</OutputPath>
3433    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
3534    <BaseAddress>285212672</BaseAddress>
3635    <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
3736    <ConfigurationOverrideFile>
3837    </ConfigurationOverrideFile>
39    <DefineConstants>DEBUG;TRACE;DEBUGSERVER;FULLFRAMEWORK;REMOBJECTS_SIGN_ASSEMBLY;DESIGN</DefineConstants>
38    <DefineConstants>TRACE;DEBUG;FULLFRAMEWORK;REMOBJECTS_SIGN_ASSEMBLY;DESIGN</DefineConstants>
4039    <DocumentationFile>
4140    </DocumentationFile>
4241    <DebugSymbols>true</DebugSymbols>
...... 
136135  </PropertyGroup>
137136  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Licensed|AnyCPU' ">
138137    <DebugSymbols>true</DebugSymbols>
139    <OutputPath>..\..\Bin\</OutputPath>
138    <OutputPath>bin\Licensed\</OutputPath>
140139    <DefineConstants>DEBUG;FULLFRAMEWORK;REMOBJECTS_SIGN_ASSEMBLY;DESIGN</DefineConstants>
141140    <BaseAddress>285212672</BaseAddress>
142141    <Optimize>true</Optimize>
...... 
147146    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
148147  </PropertyGroup>
149148  <ItemGroup>
150    <Reference Include="RemObjects.DebugServer">
151      <Name>RemObjects.DebugServer</Name>
152      <HintPath>..\..\Bin\RemObjects.DebugServer.dll</HintPath>
153    </Reference>
154149    <Reference Include="System">
155150      <Name>System</Name>
156151    </Reference>
Source/RemObjects.InternetPack/Server.cs
1111using System.ComponentModel;
1212using System.Net.Sockets;
1313using System.Net;
14using RemObjects.DebugServer;
1514using RemObjects.InternetPack.Helpers;
1615
1716namespace RemObjects.InternetPack
...... 
254253                }
255254                if (fBindingV6 != null && fBindV6)
256255                {
256                    if (this.Port == 0)
257                        fBindingV6.Port = lActualPort;
257258                    fBindingV6.EnableNagle = EnableNagle;
258259                    fBindingV6.Bind(new Listener(this, GetWorkerClass()));
259                    lActualPort = ((System.Net.IPEndPoint)fBindingV6.ListeningSocket.LocalEndPoint).Port;
260260                }
261261
262262                if (this.Port != lActualPort)
...... 
319319        public virtual void Listen()
320320        {
321321#if FULLFRAMEWORK
322#if DEBUGSERVER
322323            Debug.Write(DebugBuild.CAT_SERVER_HIGH, "Starting to Listen on {0}", fListeningSocket.LocalEndPoint);
323324#endif
325#endif
324326            Socket lSocket;
325327
326328            WorkerCollection lWorkers = null;
...... 
413415                if (lWorkers != null) lWorkers.Close();
414416            }
415417
418#if DEBUGSERVER
416419            Debug.Write(DebugBuild.CAT_SERVER_HIGH, "Done Listening ");
417        }
420#endif
421        }
418422    }
419423}
Source/RemObjects.InternetPack/HttpRequestResponse.cs
1111using System.Globalization;
1212using System.Text;
1313using System.IO;
14using RemObjects.DebugServer;
1514using RemObjects.InternetPack.Events;
1615
1716namespace RemObjects.InternetPack.Http
Source/RemObjects.InternetPack.SecureBlackbox/RemObjects.InternetPack.SecureBlackbox.2003.csproj
1<VisualStudioProject>
2    <CSHARP
3        ProjectType = "Local"
4        ProductVersion = "7.10.3077"
5        SchemaVersion = "2.0"
6        ProjectGuid = "{01F5EA8B-EFD5-439A-9DCF-E2D83ED01F81}"
7    >
8        <Build>
9            <Settings
10                ApplicationIcon = ""
11                AssemblyKeyContainerName = ""
12                AssemblyName = "RemObjects.InternetPack.SecureBlackbox"
13                AssemblyOriginatorKeyFile = ""
14                DefaultClientScript = "JScript"
15                DefaultHTMLPageLayout = "Grid"
16                DefaultTargetSchema = "IE50"
17                DelaySign = "false"
18                OutputType = "Library"
19                PreBuildEvent = ""
20                PostBuildEvent = ""
21                RootNamespace = "RemObjects.InternetPack.SecureBlackbox"
22                RunPostBuildEvent = "OnBuildSuccess"
23                StartupObject = ""
24            >
25                <Config
26                    Name = "Debug"
27                    AllowUnsafeBlocks = "false"
28                    BaseAddress = "285212672"
29                    CheckForOverflowUnderflow = "false"
30                    ConfigurationOverrideFile = ""
31                    DefineConstants = "DEBUG;TRACE"
32                    DocumentationFile = ""
33                    DebugSymbols = "true"
34                    FileAlignment = "4096"
35                    IncrementalBuild = "false"
36                    NoStdLib = "false"
37                    NoWarn = ""
38                    Optimize = "false"
39                    OutputPath = "bin\Debug\"
40                    RegisterForComInterop = "false"
41                    RemoveIntegerChecks = "false"
42                    TreatWarningsAsErrors = "false"
43                    WarningLevel = "4"
44                />
45                <Config
46                    Name = "Release"
47                    AllowUnsafeBlocks = "false"
48                    BaseAddress = "285212672"
49                    CheckForOverflowUnderflow = "false"
50                    ConfigurationOverrideFile = ""
51                    DefineConstants = "TRACE"
52                    DocumentationFile = ""
53                    DebugSymbols = "false"
54                    FileAlignment = "4096"
55                    IncrementalBuild = "false"
56                    NoStdLib = "false"
57                    NoWarn = ""
58                    Optimize = "true"
59                    OutputPath = "..\..\Bin\"
60                    RegisterForComInterop = "false"
61                    RemoveIntegerChecks = "false"
62                    TreatWarningsAsErrors = "false"
63                    WarningLevel = "4"
64                />
65            </Settings>
66            <References>
67                <Reference
68                    Name = "System"
69                    AssemblyName = "System"
70                    HintPath = "D:\WINNT\Microsoft.NET\Framework\v1.1.4322\System.dll"
71                />
72                <Reference
73                    Name = "System.Data"
74                    AssemblyName = "System.Data"
75                    HintPath = "D:\WINNT\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
76                />
77                <Reference
78                    Name = "System.XML"
79                    AssemblyName = "System.Xml"
80                    HintPath = "D:\WINNT\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
81                />
82                <Reference
83                    Name = "RemObjects.InternetPack.2003"
84                    Project = "{7C02E26A-2522-4C8F-8CAC-4E65854A09DE}"
85                    Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
86                />
87                <Reference
88                    Name = "SecureBlackbox.PKI"
89                    AssemblyName = "SecureBlackbox.PKI"
90                    HintPath = "C:\Program Files\EldoS\SecureBlackbox\SecureBlackbox.PKI.dll"
91                />
92                <Reference
93                    Name = "SecureBlackbox.SSLClient"
94                    AssemblyName = "SecureBlackbox.SSLClient"
95                    HintPath = "C:\Program Files\EldoS\SecureBlackbox\SecureBlackbox.SSLClient.dll"
96                />
97                <Reference
98                    Name = "SecureBlackbox.SSLServer"
99                    AssemblyName = "SecureBlackbox.SSLServer"
100                    HintPath = "C:\Program Files\EldoS\SecureBlackbox\SecureBlackbox.SSLServer.dll"
101                />
102                <Reference
103                    Name = "SecureBlackbox"
104                    AssemblyName = "SecureBlackbox"
105                    HintPath = "C:\Program Files\EldoS\SecureBlackbox\SecureBlackbox.dll"
106                />
107                <Reference
108                    Name = "SecureBlackbox.SSLSocket"
109                    AssemblyName = "SecureBlackbox.SSLSocket"
110                    HintPath = "C:\Program Files\EldoS\SecureBlackbox\SecureBlackbox.SSLSocket.dll"
111                />
112            </References>
113        </Build>
114        <Files>
115            <Include>
116                <File
117                    RelPath = "AssemblyInfo.cs"
118                    SubType = "Code"
119                    BuildAction = "Compile"
120                />
121                <File
122                    RelPath = "SSLConnection.cs"
123                    SubType = "Code"
124                    BuildAction = "Compile"
125                />
126                <File
127                    RelPath = "SSLConnectionFactory.cs"
128                    SubType = "Code"
129                    BuildAction = "Compile"
130                />
131            </Include>
132        </Files>
133    </CSHARP>
134</VisualStudioProject>
135

Archive Download the corresponding diff file

Revision: 8