Uploading file to auth http server, when login url is different to upload url??
Uploading file to auth http server, when login url is different to upload url??
- Subject: Uploading file to auth http server, when login url is different to upload url??
- From: "Theodore H. Smith" <email@hidden>
- Date: Wed, 1 Nov 2006 17:18:40 +0000
Hi people,
I'm trying to do something that is actually quite simple on the PC,
but for the Mac I'm finding this hard. So this is a bit of a shame
really.
I want to log into into a certain url with http auth by supplying a
name and password, and without breaking the http connection, then
upload a file to a different url!
It's done on the PC using this library called W3Client which was
found on codeproject.com:
W3Client w3;
w3.Connect("http://gdst2.simslearning.co.uk/learnwise", username,
password); // logs in here
w3.AddPostArgument("course", strFile, TRUE);
w3.Request("/coursebuilder/importCourse/org/dep",
W3Client::reqPostMultipartsFormdata); // uploads!
See, easy!
w3.Request will connect to the URL "http://gdst2.simslearning.co.uk/
learnwise/coursebuilder/importCourse/org/dep"
So basically, it appends the thing to the URL it connected to.
The uploading is done via the Post argument thingy.
So, I can do this with 4 lines of code on the PC using W3Client.
I tried with curl, which eventually I found couldn't work, simply
because... I can't log into one url and then upload to another.
Believe me I tried all sorts of different combinations with curl. I
tried multiple connection attempts (calling curl then calling it
again after it completes). I tried passing two urls to curl, that
also failed because the login page refuses to login if I've got any
POST arguments!
It just won't work.
I don't see the ability to post arguments using Cocoa? And also the
API is really hard to use. It's delegate madness and class madness. I
must use about 4 classes and a delegate to do something I could do
with 4 lines of code with W3Client. W3Client is written for the Win32
API however. And even then I haven't seen http post with
NSURLConnection, and I haven't seen the ability to log into a
different page than you upload to.
So how can I upload using http post to a different url than the one I
logged in, to acheive what I did with the above 4 lines of W3Client
code?
Can Macs even do this?
Must I resort to writing my own socket wrapper and do all the http
stuff manually? :(
--
http://elfdata.com/plugin/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden