cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLFORM_BUFFER vs CURLFORM_PTR

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 1 Sep 2006 00:07:48 +0200 (CEST)

On Thu, 31 Aug 2006, Mohun Biswas wrote:

> Sorry, I was wrong here. The basename-ing is being done by libcurl, as you
> say, but the lowercase transform is being done on the server side by the
> Apache Commons FileUpload package. So I'll address that with them if at all.

Ok, thanks for telling us. It might be good to know in the future.

> Interestingly, though their JavaDoc doesn't say anything about case, it does
> have this to say about file names:
>
> "Returns the original filename in the client's filesystem, as provided by
> the browser (or other client software). In most cases, this will be the
> base file name, without path information. However, some clients, such as
> the Opera browser, do include path information."
>
> So you're not out of the mainstream here.

I have a vague memory of me doing this basenaming exactly for the reason that
all browsers at the time did it that way, so if we didn't do it many receiving
scripts would go nuts. Also, it isn't always really want you want, passing on
long local path names in the uploads. I think it is a decent solution that the
default is basenamed, but you can set whatever you want with the FILENAME
option.

You might remember that I also changed the mime-boundary string for these
formposts to mimic the browsers' strings much closer for the same reason: too
many scripts assume that they receive data similar to how the browsers sent it
rather than what the standards say.

> though in my case I need the full pathname, I was able to work around it
> (since I control the server too) by swapping the two fields and passing the
> full pathname in the "name" parameter.

Good thinking!

(From your previous mail)
> Without having looked at the code in detail, it seems to me most intuitive
> that the presence of CURLFORM_FILENAME should in all cases be interpreted as
> a flag indicating that a file part is wanted.

I agree, it would indeed make sense from a user's point of view.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2006-09-01