cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: send file to https webserver

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Mon, 27 Sep 2010 13:35:15 -0700

On Mon, Sep 27, 2010 at 01:00:56PM -0700, Ron Eggler wrote:
> We would like to send a file to a perl file on an https:// remote
> webserver. The browser would ask for user credentials username &
> password. We've tried several things and the closest we've seeminly
> gotten was with "curl -k -U admin
> https://192.168.101.176/cgi-bin/upload.cgi" - after this it would ask
> for the password but then it's still barkingn with a 404 about
> "Authorization Required" - how come? How do we get a file XYZ.bin"
> sent to https://192.168.101.176/cgi-bin/upload.cgi?
> Been all over google but didn't find help to get this solved.
> Thanks for hints and suggestions!

You're using the -U option which specifies a proxy user/password, not
a web site user/password. Are you running through a proxy? If not (or even
if you are), then you need -u to use HTTP authentication (and --anyauth
to let curl automatically choose the best HTTP authentication method).
Note also that a 404 error is not an authentication error code.

curl supports HTTP authentication directly, but many web sites implement
their own authentication methods which use cookies instead. So, even with
-u, it still might not work. If that happens, then trace a successful web
browser upload (using LiveHttpHeaders for Firefox, or similar features on
other browsers) and compare that to the output you get when you add the
-v option to curl.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-09-27