Skip to content

Commit

Permalink
remove "-pre" suffix, clean up log on FTP actions, add useful FTP links
Browse files Browse the repository at this point in the history
  • Loading branch information
atauenis committed Dec 21, 2022
1 parent f39cf28 commit 987a59b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions FtpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ public NetworkStream GetPasvDataStream(string PasvInfo)
int PasvPort2 = Convert.ToInt32(PasvParts[5]);
int PasvPort = (PasvPort1 * 256) + PasvPort2; //(p1 * 256) + p2 = data port

#if DEBUG
Log.WriteLine(" Passive connect: " + PasvIP + ":" + PasvPort);
#endif
PasvClient = new TcpClient();
PasvClient.Connect(PasvIP,PasvPort);
return PasvClient.GetStream();
Expand Down
8 changes: 8 additions & 0 deletions FtpClientGUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ public FtpClientPage GetResultPage()
if (cmd.Code != 257)
{
Page.Content += "<p><b>&quot;Print Working Directory&quot; command has returned an unexpected result:</b> " + cmd.ToString() + "</p>";
Page.Content += "<p>Return to <a href='/!ftp/'><b>start page</b></a> and try to connect again.</p>";
return Page;
}

Expand All @@ -240,13 +241,15 @@ public FtpClientPage GetResultPage()
if (cmd.Code != 200)
{
Page.Content += "<p><b>Cannot set ASCII mode:</b> " + cmd.ToString() + "</p>";
Page.Content += "<p>Return to <a href='/!ftp/'><b>start page</b></a> and try to connect again.</p>";
return Page;
}

cmd = Backend.TransmitCommand("PASV");
if (cmd.Code != 227)
{
Page.Content += "<p><b>Cannot prepare data connection:</b> " + cmd.ToString() + "</p>";
Page.Content += "<p>Return to <a href='/!ftp/'><b>start page</b></a> and try to connect again.</p>";
return Page;
}

Expand All @@ -258,13 +261,15 @@ public FtpClientPage GetResultPage()
catch
{
Page.Content += "<p><b>Cannot establish data connection:</b> " + cmd.ToString() + "</p>";
Page.Content += "<p>Return to <a href='/!ftp/'><b>start page</b></a> and try to connect again.</p>";
return Page;
}

cmd = Backend.TransmitCommand("LIST");
if (cmd.Code != 150)
{
Page.Content += "<p><b>Directory listing is inaccessible:</b> " + cmd.ToString() + "</p>";
Page.Content += "<p>Return to <a href='/!ftp/'><b>start page</b></a> and try to connect again.</p>";
return Page;
}
StreamReader sr = new StreamReader(datastream);
Expand Down Expand Up @@ -337,20 +342,23 @@ public FtpClientPage GetResultPage()
if (string.IsNullOrEmpty(filename))
{
Page.Content += "<h2>Nothing to download</h2>";
Page.Content += "<p><a href='/!ftp/?client=" + ClientID + "&task=listdir'>Click here</a> to see directory listing.</p>";
return Page;
}

cmd = Backend.TransmitCommand("TYPE I");
if (cmd.Code != 200)
{
Page.Content += "<p><b>Cannot set BINARY mode:</b> " + cmd.ToString() + "</p>";
Page.Content += "<p>Return to <a href='/!ftp/'><b>start page</b></a> and try to connect again.</p>";
return Page;
}

cmd = Backend.TransmitCommand("PASV");
if (cmd.Code != 227)
{
Page.Content += "<p><b>Cannot prepare data connection:</b> " + cmd.ToString() + "</p>";
Page.Content += "<p>Return to <a href='/!ftp/'><b>start page</b></a> and try to connect again.</p>";
return Page;
}
System.Net.Sockets.NetworkStream datastream2 = Backend.GetPasvDataStream(cmd.Result);
Expand Down
3 changes: 2 additions & 1 deletion Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ static void Main(string[] args)
Assembly.GetExecutingAssembly().GetName().Version.Major + "." +
Assembly.GetExecutingAssembly().GetName().Version.Minor + "." +
Assembly.GetExecutingAssembly().GetName().Version.Build
+ "-pre");
/*+ "-pre"*/
);
Variables.Add("WOSystem", Environment.OSVersion.ToString());

Console.Title = "WebOne";
Expand Down
2 changes: 1 addition & 1 deletion WebOne.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<TargetFramework>net6.0</TargetFramework>
<Authors>Alexander Tauenis</Authors>
<Version>0.14.0</Version>
<VersionSuffix>-pre</VersionSuffix> <!--<VersionSuffix>-pre</VersionSuffix>-->
<VersionSuffix></VersionSuffix> <!--<VersionSuffix>-pre</VersionSuffix>-->
<PackageVersion>$(Version)$(VersionSuffix)</PackageVersion>
<Company>World</Company>
<Product>WebOne HTTP Proxy Server</Product>
Expand Down

0 comments on commit 987a59b

Please sign in to comment.