cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Need help!

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Tue, 16 Dec 2003 16:53:41 +0100 (CET)

On Mon, 15 Dec 2003, Zhang, David wrote:

> Curl -H 'POST /myServlet HTTP/1.1 User-Agent: Java1.3.0 Host:
> myWebsite.com:80 Accept: text/html, image/gif, image/jpeg, *; q=.2, */*;
> q=.2 Connection: keep-alive Content-type: application/x-www-form-urlencoded
> Content-length: 256 -d 'data' http://myWebsite.com/myServlet:80

1. The "POST" is not a header, it is the request itself. You can't replace
   that with -H. -d makes it a POST.

2. Each header you want to replace/add must be specified with a separate -H,
   like in -H "User-Agent: Java1.3.0" -H "Accept: text/html"

3. I advice not you fool around and replacing the Content-length header,
   you'll only end up shooting yourself in the foot.

4. -d POSTs imply "Content-type: application/x-www-form-urlencoded" by default

5. curl sets Host: header fine by itself so you don't need to set it when
   you're not trying something funny (like using a different Host: than what
   is in the URL)

6. "Connection: keep-alive" will not add any functionality to curl's request,
   AFAICS

-- 
    Daniel Stenberg -- http://curl.haxx.se/ -- http://daniel.haxx.se/
   [[ Do not send mails to this email address. They won't reach me. ]]
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
Received on 2003-12-16