ArxOne / FTP

Simple FTP client
MIT License
37 stars 15 forks source link

MVS-z/OS FTP server #42

Closed zio69 closed 5 years ago

zio69 commented 5 years ago

Hello there, I'm "toying" with a tiny utility to parse Cobol "layouts" (copy files) and while looking for an alternative to FtpWebRequest I found your nice ftp client. However, just like most FTP clients, it adds a slash to paths to make them absolute. Which is fine on z/Os too, unless one is trying to access "traditional" mainframe files, in which case it's a bane! (and obviously this is my case....!) I made a few tiny modifications to FtpPath (and since I was there, I also added an MVS platform) - would you be interested in adding them to your code? Should I make a pull request?? (I'm sorry, I'm a noob in this field - my main business is on mainframes.... )

picrap commented 5 years ago

Sure! If the changes don't break everything else, it's welcome :)

zio69 commented 5 years ago

FtpPath.zip Well, I sure hope it will not break anything. I've added an optional parameter to FtpPath - so whenever I need not to have a slash in front of the filename/path, I just set it and path will come out "clean". I had thought of a "general" removing of the slash for MVS-z/OS but that would be wrong, as USS (Unix System Services) and Linux VMs use "traditional" posix naming convention.

picrap commented 5 years ago

I integrated your changes (simplified a bit, see commit 8df4ac7046cc6a2635d59db60b12870f0e21e88c). In the library there is a FtpPlatform class which contains characteristics about platforms. Maybe if with a detection of MVS-z/OS platform we could have a specialized class like MvsFtpPlatform where paths could be non-rooted. What do you think? You're always welcome to fork, make the changes and submit a pull request. Thanks for your contribution anyway!

zio69 commented 5 years ago

I actually implemented the FtrpPlatform and FtpServerType to identify MVS-z/OS, However, I realized it would be wrong to assume that one always needs to remove the leading slash. As I discovered reading FTP Server's documentation, one can freely change "mode" during a session, using custom IBM commands to switch between "dataset mode" (no slashes at all) and "directory mode" (slash). And even when you're in either mode you can reference the other mode enclosing your path/dataset between hyphens. Hence I thought it would be best to leave it to the programmer to decide when the leading slash is needed or not..... But if you want to dig deeper in this matter, I'd be happy to help in my spare moments. I'm not sure it's worth the effort (there are not many people working with .net on mainframes......), but surely it would give ArxOne a unique feature!!

Anyhoo, here are the other mini-changes I did.... Hope I didn't break anything!!! :D

ArxOne.Ftp.zip

picrap commented 5 years ago

I've included your changes in release 1.14. If you want to continue to improve the project, you can fork it and submit pull requests. Thank you for your contribution!