Comments (17)
So this is a URL vended out by a directory listing?
from connectionkit.
I guess so, yeah. I had it logging at the point that CK2OpenPanel returns it but all the URLs it gets come from directory listings.
from connectionkit.
All URLs the WebDAV protocol vends out should be going via the +URLByReplacingUserInfoInURL:withUser:
method. So three possibilities come to mind:
A) An empty username is being fed into this method
B) This method is being bypassed for certain URLs
C) A particular username confuses this method into screwing up
There's tests against C. Presently I suspect A.
from connectionkit.
Ok, after more investigation, I think this may be something that was fixed in more recent versions of CK2. Checking, the user is using an older version whereas I'm doing my test on the latest. Seems like I can replicate his problem running on that version on my test machine. I'll see if I can get him to run the latest as well to see if the problem goes away.
That said, #75 is happening for me running the latest.
from connectionkit.
In which case, since you can repro #75, can you set a breakpoint on line 100
of CKWebDAVProtocol.m
and see if you can catch it in action there?
from connectionkit.
Ok, it seems _user is nil and therefore it ends up stripping the user out. Anything else I should check?
from connectionkit.
Oh dear, this is a knotty mess. _user
gets filled in in response to an authentication challenge. But I suppose there's two cases where this might not happen:
- DAVKit never issues us a challenge
- The client chooses a behaviour other than
CK2AuthChallengeUseCredential
, e.g.NSURLSessionAuthChallengePerformDefaultHandling
instead
Are you able to isolate which of the above is the case?
from connectionkit.
Is there a good spot to check for this?
from connectionkit.
Ok, so breaking in -webDAVSession:didReceiveChallenge:..., the disposition does seem to be CK2AuthChallengeUseCredential. I don't see any cases of it being otherwise.
Also, it seems that it doesn't happen when I step through, possibly implying something timing based?
from connectionkit.
Ugh, a timing-based bug is not what we want.
I wonder if I've been treating this all wrong in the API. Let's rewind:
Imagine getting a directory list for http://example.com/myfolder/
What you get back likely depends on the user that you log in as. So if you're writing an app which needs to do some keying or caching based on URL, and the user might log in to multiple accounts across that, then you benefit from getting back unique URLs which include the username.
I think everyone else gets no benefit from the username, and just wants consistency. So I'm thinking, rather than CK attempting to figure out which username is being used for a particular operation, how about we just respect whatever user is specified in the original request URL?
- Clients which don't specify a user and have simple needs don't get back a user, and are happy
- Clients which know the user upfront can specify it in the URL, and will get that back again in the results, and are happy
- Complex clients to whom the user matters as discussed above, and might not know if upfront, can take on responsibility for manipulating the URLs they get back if needed
How would that arrangement suit you?
from connectionkit.
That seems reasonable. That does mean that I do need to specify it up front, which is fine. I had just assumed it would work fine if the user was provided during authentication. You might need to warn other people that they may need to change their clients to compensate.
from connectionkit.
Also, I did notice when tracing through that the user name was intact, it just got erased. Maybe an alternative is to not re-write the URL if the user is nil?
Actually, I should elaborate: the case I am seeing this is not via the open panel. I do have an URL in this case with the username specified so that is fed in to CK2FileManager. It gets erased because _user isn't set. I'm not sure if I've seen this with CK2OpenPanel where I do not supply the user in the initial URL. I'll test that more to see if I can replicate it then.
from connectionkit.
Alright, let me try that out on a branch since it's potentially breaking
from connectionkit.
@MrNoodle please can you give the simplify-user-handling
branch a go, and let me know how that gets on.
from connectionkit.
Seems to work fine for me. Tested both sending in an URL with a user and without and it followed the format of the sent in URL.
Will this be merged into v2.x-beta?
from connectionkit.
Excellent! I'll give people a little warning and time, and then merge it into the 2.x branch. Is that OK by you, or are you keen to get it merged straight away?
from connectionkit.
Actually, I have my own branch off of v2.x-beta that has a couple of minor changes for myself (like getting rid of warnings since I'm running a later version of Xcode). I can just merge into that branch and use that. Either that or I can cherry-pick the change. Either way, that's fine.
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
- 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.