Comments (16)
Hi Harry, I'm not planning anything, but I'm interested to hear more specifically what you want to make use of this for. The challenges to overcome:
- Parse the header/response — libcurl only hands us the raw text of it, which might happen to cover multiple response codes from the server
- Figure out a reasonably API for the file manager to expose
- Handle the equivalent for other protocols than FTP
from connectionkit.
Well the issue is that a lot of the commands won't be similar for all protocols. Some will be specific to FTP or SFTP, for example.
It sounds like there's a lot involved - more than I realised.
I wanted to use it to get the time for certain files on the server to then work out the time difference between local and server times. There are also other commands that would be useful to get - for example, whether the server is a Windows server.
On a possibly related note - some SFTP clients get the correct working directory that the user would be working on - is this through one of these commands that gives out a response, or a separate one?
from connectionkit.
I wanted to use it to get the time for certain files on the server to then work out the time difference between local and server times
When performing a directory listing, you can request that the file's modification date be included in the returned resource properties. Is that good enough? If not, how does it fall short?
some SFTP clients get the correct working directory that the user would be working on - is this through one of these commands that gives out a response, or a separate one?
I'm not too sure on this one how/if libcurl vends that info out. What would you be wanting to make use of it for? Right now, you can happily pass in URLs comprised of a relative path. For FTP and SFTP, that path is resolved relative to the home directory. Doing a directory listing thus enables you to discover the home directory's true path.
from connectionkit.
The modification date returns the date on the server, rather than the local date for the user - for example, if the server is in a time zone that's +2 hours, and the user creates a file, the user would see the file as +2 hours (in the future).
Perhaps it was just how I was connecting to the server in that case. I was just connecting to the base address, rather than a relative address to the home directory.
from connectionkit.
OK, so how would one use the SYST
command to handle that time difference?
from connectionkit.
One wouldn't - SYST is to determine whether the user is connecting to a Windows server (or any other server). 'mtime', 'atime' etc could work though.
from connectionkit.
OK, so SYST
tells you whether you're connected to a Windows server or not. But how do you then find out the difference in time between the two? I really need some sort of pseudo-code or similar to understand what the heck it is you'd actually like implemented!
from connectionkit.
Sorry - think some miscommunication going on here.
SYST is to determine what the server is. CK currently doesn't support for Windows servers (which is fine), so it's useful to know without having to parse things.
Getting time difference would be done using MTIME via SFTP. I believe FileZilla uses this same method to check time differences and accounts for it accordingly in the user interface.
from connectionkit.
I guess you might be able to use a SITE command to get back a time on some servers. In which case you'd need to be able to parse the results from the command. The trick I've seen for figuring out the timezone it is to make a directory/file, get it back and examine its time, then compare it against your local time to figure out the offset - all of which doesn't need anything special.
from connectionkit.
Can you clarify on our lack of support for Windows servers please? I'm aware of one issue, but there might be others, and I'd like to figure it out in the end!
from connectionkit.
Sorry for the late reply.
@samdeane thanks, that's actually a really good idea.
@mikeabdullah so, the issue is that for some Windows servers, the URLs come back with no resource values. They're all default values or nil. All except the NSURLNameKey value, which has a line of text for all the available data. Actual item name, file size or "
" (if it's a folder), and modified date. At the moment I'm using really basic methods of determining whether the URL is returned from a Windows server. Only problem is, the methods MAY fail at some point, and I'm having to do it on every item that comes back, from any server.from connectionkit.
Sounds to me like that's a problem with parsing windows directories. We have an issue already for FTP - is this a different one @mikeabdullah? The good news is, I think it's on my list of things to try to fix...
from connectionkit.
Ah yes, that's the problem I have in mind. By default, Windows FTP servers return results in MS-DOS format, but there is a command that can be sent to switch them over to unix-style. Unfortunately, that command acts as a toggle, so combined with how libcurl manages connections, there's no accurate way to set it!
Ideally then, we write our own parser for Windows-style listings, or find an open source one that can be used. After that, it's a question of whether we query servers to know what type they are, or are able to automatically recognise the listing style that comes back and handle it from there.
from connectionkit.
@gbrhaz Out of interest, what "basic methods" are you using to determine this at the moment?
from connectionkit.
@mikeabdullah I look at a few keys: NSURLFileResourceTypeKey and a few others. NSURLFileResourceTypeKey value comes out as NSURLFileResourceTypeUnknown. So far this has worked fine, but I also put in some quick tests when parsing the name value itself.
from connectionkit.
Thanks, that makes sense
from connectionkit.
Related Issues (20)
- Updating look of CK2OpenPanel for 10.10+
- Support file download HOT 1
- Open Panel error-handling HOT 2
- Authentication HOT 3
- New Folder button shouldn’t be enabled until actually connected HOT 12
- Support uploading of directories using CK2FileManager
- Optimise dequeuing FTP operations
- private ssh key authentication on sftp HOT 2
- Down/Upload and a Crash in Release Build HOT 3
- Add cocoapod HOT 2
- -[CK2OpenPanelController pathControlItemSelected:] exception HOT 4
- CK2FileManager's -enumerateContentsOfURL... sometimes doles out URLs without the username
- -createFileAtURL:... with intermediate directories set to YES doesn't seem to work? HOT 13
- Open panel kicks off a directory listing when being cancelled HOT 6
- Is anyone using -[CK2FileManager setAttributes:…] in their code? HOT 2
- Receiving URL of form https://@dav.box.com/dav HOT 17
- Support for FTP using SSL in Swift 3? HOT 5
- NSURLErrorDomain error -1012 on Sierra? HOT 1
- Incorporate CurlHandle fix 82d036fa7e453b71a01a8a6ba2d7e31560490009
- libcurl broken on 10.12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from connectionkit.