cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: [patch] use only basename in "filename" attribute in -F post

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Tue, 28 Sep 2004 15:43:15 +0200 (CEST)

On Mon, 27 Sep 2004, Fedor Karpelevitch wrote:

> currently curl by default sets "filename" attribute for an uploaded file to
> whatever was specified on command line.

Correct.

> RFC is not entirely clear (to me) regarding what exactly should be put in
> this field

To me it is clear. It doesn't dictate details such as this.

> browsers I checked (IE, mozilla, konqueror) seem to agree in putting just
> the basename of the file there.

Are you _sure_ that all browsers do this on all operating systems no matter
what path you use? I am very sure at least some browsers on some operating
systems have passed along the full path at some point. (Since I spent a few
days debugging exaclty such a case a few years back when I introduced the way
to set only the file name.)

> Attached is my patch to fix this problem (works for me). I am not sure it is
> done right (it's been several years since I wrote anything in C), but you
> get the idea at least. Let me know if this patch can be accepted.

libgen.h is not a very portable header to use unconditionally and neither is
basename(). They are both present in IEEE Std 1003.1-2001 but not ANSI C and
thus not likely to be present on all systems that (lib)curl builds on.

Besides this, I think I'd rather document the existing functionality of
curl_formadd() and family, and have the -F approach fixed for this in the app
code.

Comments?

-- 
      Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
       Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2004-09-28