cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Uploading file to auth http server, when login url is different to upload url??

From: <man_at_tfhs.net>
Date: Wed, 1 Nov 2006 17:58:47 -0000

On Wed, Nov 1, 2006, "Theodore H. Smith" <delete_at_elfdata.com> said:

>
> 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!

i would like to see a tcpdump of this. is it doing an http GET, followed
by a POST? also- what type of auth is it using? basic?

>
> 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 (as a shell tool not library), which eventually I
> found couldn't work, simply because... I can't log into one url and
> then upload to another. 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.
>
> Can Macs even do this?
>
> Must I resort to writing my own socket wrapper and do all the http
> stuff manually? :( If it can't be done with curl, perhaps some Mac
> people can tell me the easiest way to do this? As it looks to me,
> Cocoa can't do it.
>
> --
> http://elfdata.com/plugin/
>
>
>
>
>

-- 
m. allan noah
IT Director, TfHS.net
ph# (804) 355-5489
tf# (866) 724-9722
fx# (804) 355-0477
Received on 2006-11-01