{
FtpStatusCode status = SendCommand (AbortCommand);
if (status != FtpStatusCode.ClosingData)
- throw CreateExceptionFromResponse (0); // Probably ignore it by now
+ throw CreateExceptionFromResponse (); // Probably ignore it by now
aborted = true;
if (asyncRead != null) {
void ProcessSimpleRequest ()
{
if (SendCommand (method, requestUri.LocalPath) != FtpStatusCode.PathnameCreated) {
- asyncRead.SetCompleted (true, CreateExceptionFromResponse (0));
+ asyncRead.SetCompleted (true, CreateExceptionFromResponse ());
return;
}
{
FtpStatusCode status = SendCommand (method, requestUri.LocalPath);
if (status != FtpStatusCode.FileStatus) {
- asyncRead.SetCompleted (true, CreateExceptionFromResponse (0));
+ asyncRead.SetCompleted (true, CreateExceptionFromResponse ());
return;
}
}
ftpResponse.UpdateStatus (statusCode, statusDescription);
- asyncRead.SetCompleted (true, CreateExceptionFromResponse (0));
+ asyncRead.SetCompleted (true, CreateExceptionFromResponse ());
}
void UploadData ()
{
if (gotRequestStream) {
if (GetResponseCode () != FtpStatusCode.ClosingData)
- asyncRead.SetCompleted (true, CreateExceptionFromResponse (0));
+ asyncRead.SetCompleted (true, CreateExceptionFromResponse ());
return;
}
if (offset > 0) {
status = SendCommand (RestCommand, offset.ToString ());
if (status != FtpStatusCode.FileCommandPending) {
- asyncRead.SetCompleted (true, CreateExceptionFromResponse (0));
+ asyncRead.SetCompleted (true, CreateExceptionFromResponse ());
return;
}
}
controlReader = new StreamReader (controlStream, Encoding.ASCII);
if (!Authenticate ()) {
- SetResponseError (CreateExceptionFromResponse (0));
+ SetResponseError (CreateExceptionFromResponse ());
return false;
}
return sock;
}
- Exception CreateExceptionFromResponse (WebExceptionStatus status)
+ Exception CreateExceptionFromResponse ()
{
- WebException exc = new WebException ("Server returned an error: " + statusDescription, null, status,
- ftpResponse);
+ WebException exc = new WebException ("Server returned an error: " + statusDescription, null,
+ WebExceptionStatus.ProtocolError, ftpResponse);
return exc;
}
if (usePassive) {
status = SendCommand (PassiveCommand);
if (status != FtpStatusCode.EnteringPassive) {
- SetResponseError (CreateExceptionFromResponse (0));
+ SetResponseError (CreateExceptionFromResponse ());
return null;
}
if (status != FtpStatusCode.CommandOK) {
sock.Close ();
- SetResponseError (CreateExceptionFromResponse (0));
+ SetResponseError (CreateExceptionFromResponse ());
return null;
}
status = SendCommand (TypeCommand, DataType);
if (status != FtpStatusCode.CommandOK) {
- SetResponseError (CreateExceptionFromResponse (0));
+ SetResponseError (CreateExceptionFromResponse ());
return false;
}
}
status = SendCommand (method, requestUri.LocalPath);
if (status != FtpStatusCode.OpeningData) {
- SetResponseError (CreateExceptionFromResponse (0));
+ SetResponseError (CreateExceptionFromResponse ());
return false;
}