public override WebResponse GetResponse() { WebResponse response = null; if (this.client == null || !this.client.IsConnected) { this.client = SshRequestCreator.GetOrCreateClient(this); } switch (this.Method) { case IOConnection.WrmDeleteFile: response = SshWebResponse.GetDeleteResponse(this.client, this.RequestUri.AbsolutePath); break; case IOConnection.WrmMoveFile: var moveTo = this.Headers[IOConnection.WrhMoveFileTo]; var authority = this.RequestUri.GetLeftPart(UriPartial.Authority); if (moveTo?.StartsWith(authority) == true) { response = SshWebResponse.GetMoveResponse(this.client, this.RequestUri.AbsolutePath.TrimStart('/'), moveTo.Substring(authority.Length).TrimStart('/')); } break; case null: response = SshWebResponse.GetDownloadResponse(this.client, this.RequestUri.AbsolutePath); break; } return(response ?? new SshWebResponse()); }
public override Stream GetRequestStream() { if (this.client == null || !this.client.IsConnected) { this.client = SshRequestCreator.GetOrCreateClient(this); } return(this.client.OpenWrite(this.RequestUri.AbsolutePath.TrimStart('/'))); }