cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: curl POST using the -F option

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 21 Feb 2003 16:27:45 +0100 (CET)

On Thu, 20 Feb 2003, David Haggerty wrote:

> I am not having luck posting using the -F (multipart/form-data) option,
> which I need to use.
>
> To debug my problem, I created a really simple example that hits a JSP file
> that just throws back the values I sent it.

A POST request is not values being sent, it is a chunk of data. You may of
course treat the data as fields if you want...

> 1) I sent it using curl and option -F
> 2) I sent it using curl and option -d
> 3) I created a test form and submitted it that way

That test form you showed us, does not make a browser send a
multipart/form-data POST, just an ordinary one. And the -d test also proved
your program could receive a normal post...

> When I do (1) and turn verbose on, I don't see it being sent in the header.

POST data is not sent in the header.

> Shouldn't it display below Content-Type: .... and above the start of the
> HTML returned the variables I am sending?

The actual data is sent in the request-body, and is not displayed with -v.
Try --trace or --trace-ascii for that.

> C:\curl>curl -v -F "BatchID=7" http://intranet.yfu.org/jsp/test.jsp

[snip]

> <html> <body> Results:
>
> </body> <html>

This merely proves that your receiving end can't receive multipart data
properly.

> -------------------JSP Program if anyone wants to look at it --------------------------

I know next to nothing about JSP so I can't tell if this is supposed to work
or not.

-- 
 Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs.
-------------------------------------------------------
This SF.net email is sponsored by: SlickEdit Inc. Develop an edge.
The most comprehensive and flexible code editor you can use.
Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial.
www.slickedit.com/sourceforge
Received on 2003-02-21