~ubuntu-branches/ubuntu/lucid/curl/lucid-201101212007

« back to all changes in this revision

Viewing changes to docs/curl.html

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2008-02-08 11:20:41 UTC
  • mto: (3.1.1 lenny) (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 26.
  • Revision ID: james.westby@ubuntu.com-20080208112041-hed7sb5r6ghmjf8v
Tags: upstream-7.18.0
ImportĀ upstreamĀ versionĀ 7.18.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
<p class="level0">&nbsp;<a href="http://www.numericals.com/file">http://www.numericals.com/file</a>[1-100:10].txt &nbsp;<a href="http://www.letters.com/file">http://www.letters.com/file</a>[a-z:2].txt 
62
62
<p class="level0">If you specify URL without protocol:// prefix, curl will attempt to guess what protocol you might want. It will then default to HTTP but try other protocols based on often-used host name prefixes. For example, for host names starting with "ftp." curl will assume you want to speak FTP. 
63
63
<p class="level0">Curl will attempt to re-use connections for multiple file transfers, so that getting many files from the same server will not do multiple connects / handshakes. This improves speed. Of course this is only done on files specified on a single command line and cannot be used between separate curl invokes. <a name="PROGRESS"></a><h2 class="nroffsh">PROGRESS METER</h2>
64
 
<p class="level0">curl normally displays a progress meter during operations, indicating amount of transfered data, transfer speeds and estimated time left etc. 
 
64
<p class="level0">curl normally displays a progress meter during operations, indicating amount of transferred data, transfer speeds and estimated time left etc. 
65
65
<p class="level0">However, since curl displays data to the terminal by default, if you invoke curl to do an operation and it is about to write data to the terminal, it <span Class="emphasis">disables</span> the progress meter as otherwise it would mess up the output mixing progress meter and response data. 
66
66
<p class="level0">If you want a progress meter for HTTP POST or PUT requests, you need to redirect the response output to a file, using shell redirect (&gt;), -o [file] or similar. 
67
67
<p class="level0">It is not the same case for FTP upload as that operation is not spitting out any response data to the terminal. 
74
74
<p class="level1">(HTTP) Specify the User-Agent string to send to the HTTP server. Some badly done CGIs fail if this field isn't set to "Mozilla/4.0". To encode blanks in the string, surround the string with single quote marks. This can also be set with the <a class="emphasis" href="#-H--header">-H/--header</a> option of course. 
75
75
<p class="level1">If this option is set more than once, the last one will be the one that's used. 
76
76
<p class="level0"><a name="--anyauth"></a><span class="nroffip">--anyauth</span> 
77
 
<p class="level1">(HTTP) Tells curl to figure out authentication method by itself, and use the most secure one the remote site claims it supports. This is done by first doing a request and checking the response-headers, thus inducing an extra network round-trip. This is used instead of setting a specific authentication method, which you can do with <a class="emphasis" href="#--basic">--basic</a>, <a class="emphasis" href="#--digest">--digest</a>, <a class="emphasis" href="#--ntlm">--ntlm</a>, and <a class="emphasis" href="#--negotiate">--negotiate</a>. 
 
77
<p class="level1">(HTTP) Tells curl to figure out authentication method by itself, and use the most secure one the remote site claims it supports. This is done by first doing a request and checking the response-headers, thus possibly inducing an extra network round-trip. This is used instead of setting a specific authentication method, which you can do with <a class="emphasis" href="#--basic">--basic</a>, <a class="emphasis" href="#--digest">--digest</a>, <a class="emphasis" href="#--ntlm">--ntlm</a>, and <a class="emphasis" href="#--negotiate">--negotiate</a>. 
78
78
<p class="level1">Note that using --anyauth is not recommended if you do uploads from stdin, since it may require data to be sent twice and then the client must be able to rewind. If the need should arise when uploading from stdin, the upload operation will fail. 
79
79
<p class="level1">If this option is used several times, the following occurrences make no difference. 
80
80
<p class="level0"><a name="-b--cookie"></a><span class="nroffip">-b/--cookie &lt;name=data&gt;</span> 
113
113
<p class="level1">(FTP) Convert LF to CRLF in upload. Useful for MVS (OS/390). 
114
114
<p class="level1">If this option is used several times, the following occurrences make no difference. 
115
115
<p class="level0"><a name="-d--data"></a><span class="nroffip">-d/--data &lt;data&gt;</span> 
116
 
<p class="level1">(HTTP) Sends the specified data in a POST request to the HTTP server, in a way that can emulate as if a user has filled in a HTML form and pressed the submit button. Note that the data is sent exactly as specified with no extra processing (with all newlines cut off).  The data is expected to be "url-encoded". This will cause curl to pass the data to the server using the content-type application/x-www-form-urlencoded. Compare to <a class="emphasis" href="#-F--form">-F/--form</a>. If this option is used more than once on the same command line, the data pieces specified will be merged together with a separating &-letter. Thus, using '-d name=daniel -d skill=lousy' would generate a post chunk that looks like 'name=daniel&skill=lousy'. 
117
 
<p class="level1">If you start the data with the letter @, the rest should be a file name to read the data from, or - if you want curl to read the data from stdin.  The contents of the file must already be url-encoded. Multiple files can also be specified. Posting data from a file named 'foobar' would thus be done with <span Class="emphasis">--data</span> @foobar". 
118
 
<p class="level1">To post data purely binary, you should instead use the <a class="emphasis" href="#--data-binary">--data-binary</a> option. 
119
 
<p class="level1"><a class="emphasis" href="#-d--data">-d/--data</a> is the same as <a class="emphasis" href="#--data-ascii">--data-ascii</a>. 
120
 
<p class="level1">If this option is used several times, the ones following the first will append data. 
121
 
<p class="level0"><a name="--data-ascii"></a><span class="nroffip">--data-ascii &lt;data&gt;</span> 
122
 
<p class="level1">(HTTP) This is an alias for the <a class="emphasis" href="#-d--data">-d/--data</a> option. 
123
 
<p class="level1">If this option is used several times, the ones following the first will append data. 
 
116
<p class="level1">(HTTP) Sends the specified data in a POST request to the HTTP server, in the same way that a browser does when a user has filled in an HTML form and presses the submit button. This will cause curl to pass the data to the server using the content-type application/x-www-form-urlencoded.  Compare to <a class="emphasis" href="#-F--form">-F/--form</a>. 
 
117
<p class="level1"><a class="emphasis" href="#-d--data">-d/--data</a> is the same as <span Class="emphasis">--data-ascii</span>. To post data purely binary, you should instead use the <a class="emphasis" href="#--data-binary">--data-binary</a> option. To URL encode the value of a form field you may use <a class="emphasis" href="#--data-urlencode">--data-urlencode</a>. 
 
118
<p class="level1">If any of these options is used more than once on the same command line, the data pieces specified will be merged together with a separating &-letter. Thus, using '-d name=daniel -d skill=lousy' would generate a post chunk that looks like 'name=daniel&skill=lousy'. 
 
119
<p class="level1">If you start the data with the letter @, the rest should be a file name to read the data from, or - if you want curl to read the data from stdin.  The contents of the file must already be url-encoded. Multiple files can also be specified. Posting data from a file named 'foobar' would thus be done with <span Class="emphasis">--data @foobar</span>. 
124
120
<p class="level0"><a name="--data-binary"></a><span class="nroffip">--data-binary &lt;data&gt;</span> 
125
 
<p class="level1">(HTTP) This posts data in a similar manner as <a class="emphasis" href="#--data-ascii">--data-ascii</a> does, although when using this option the entire context of the posted data is kept as-is. If you want to post a binary file without the strip-newlines feature of the <a class="emphasis" href="#--data-ascii">--data-ascii</a> option, this is for you. 
126
 
<p class="level1">If this option is used several times, the ones following the first will append data. 
 
121
<p class="level1">(HTTP) This posts data exactly as specified with no extra processing whatsoever. 
 
122
<p class="level1">If you start the data with the letter @, the rest should be a filename.  Data is posted in a similar manner as <span Class="emphasis">--data-ascii</span> does, except that newlines are preserved and conversions are never done. 
 
123
<p class="level1">If this option is used several times, the ones following the first will append data. As described in <a class="emphasis" href="#-d--data">-d/--data</a>. 
 
124
<p class="level0"><a name="--data-urlencode"></a><span class="nroffip">--data-urlencode &lt;data&gt;</span> 
 
125
<p class="level1">(HTTP) This posts data, similar to the other --data options with the exception that this performs URL encoding. (Added in 7.18.0) 
 
126
<p class="level1">To be CGI compliant, the &lt;data&gt; part should begin with a <span Class="emphasis">name</span> followed by a separator and a content specification. The &lt;data&gt; part can be passed to curl using one of the following syntaxes: 
 
127
<p class="level2">
 
128
<p class="level1"><a name="content"></a><span class="nroffip">content</span> 
 
129
<p class="level2">This will make curl URL encode the content and pass that on. Just be careful so that the content doesn't contain any = or @ letters, as that will then make the syntax match one of the other cases below! 
 
130
<p class="level1"><a name="content"></a><span class="nroffip">=content</span> 
 
131
<p class="level2">This will make curl URL encode the content and pass that on. The preceding = letter is not included in the data. 
 
132
<p class="level1"><a name="namecontent"></a><span class="nroffip">name=content</span> 
 
133
<p class="level2">This will make curl URL encode the content part and pass that on. Note that the name part is expected to be URL encoded already. 
 
134
<p class="level1"><a name="filename"></a><span class="nroffip">@filename</span> 
 
135
<p class="level2">This will make curl load data from the given file (including any newlines), URL encode that data and pass it on in the POST. 
 
136
<p class="level1"><a name="namefilename"></a><span class="nroffip">name@filename</span> 
 
137
<p class="level2">This will make curl load data from the given file (including any newlines), URL encode that data and pass it on in the POST. The name part gets an equal sign appended, resulting in <span Class="emphasis">name=urlencoded-file-content</span>. Note that the name is expected to be URL encoded already. 
 
138
<p class="level1">
127
139
<p class="level0"><a name="--digest"></a><span class="nroffip">--digest</span> 
128
140
<p class="level1">(HTTP) Enables HTTP Digest authentication. This is a authentication that prevents the password from being sent over the wire in clear text. Use this in combination with the normal <a class="emphasis" href="#-u--user">-u/--user</a> option to set user name and password. See also <a class="emphasis" href="#--ntlm">--ntlm</a>, <a class="emphasis" href="#--negotiate">--negotiate</a> and <a class="emphasis" href="#--anyauth">--anyauth</a> for related options. 
129
141
<p class="level1">If this option is used several times, the following occurrences make no difference. 
236
248
<p class="level1">See also the <a class="emphasis" href="#-A--user-agent">-A/--user-agent</a> and <a class="emphasis" href="#-e--referer">-e/--referer</a> options. 
237
249
<p class="level1">This option can be used multiple times to add/replace/remove multiple headers. 
238
250
<p class="level0"><a name="--hostpubmd5"></a><span class="nroffip">--hostpubmd5</span> 
239
 
<p class="level1">Pass a string containing 32 hexadecimal digits. The string should be the 128 bit MD5 cheksum of the remote host's public key, curl will refuse the connection with the host unless the md5sums match. This option is only for SCP and SFTP transfers. (Added in 7.17.1) 
 
251
<p class="level1">Pass a string containing 32 hexadecimal digits. The string should be the 128 bit MD5 checksum of the remote host's public key, curl will refuse the connection with the host unless the md5sums match. This option is only for SCP and SFTP transfers. (Added in 7.17.1) 
240
252
<p class="level0"><a name="--ignore-content-length"></a><span class="nroffip">--ignore-content-length</span> 
241
253
<p class="level1">(HTTP) Ignore the Content-Length header. This is particularly useful for servers running Apache 1.x, which will report incorrect Content-Length for files larger than 2 gigabytes. 
242
254
<p class="level0"><a name="-i--include"></a><span class="nroffip">-i/--include</span> 
256
268
<p class="level1">(SSL) This option explicitly allows curl to perform "insecure" SSL connections and transfers. All SSL connections are attempted to be made secure by using the CA certificate bundle installed by default. This makes all connections considered "insecure" to fail unless <a class="emphasis" href="#-k--insecure">-k/--insecure</a> is used. 
257
269
<p class="level1">See this online resource for further details: <span Class="bold"><a href="http://curl.haxx.se/docs/sslcerts.html">http://curl.haxx.se/docs/sslcerts.html</a></span> 
258
270
<p class="level1">If this option is used twice, the second time will again disable it. 
 
271
<p class="level0"><a name="--keepalive-time"></a><span class="nroffip">--keepalive-time &lt;seconds&gt;</span> 
 
272
<p class="level1">This option sets the time a connection needs to remain idle before sending keepalive probes and the time between individual keepalive probes. It is currently effective on operating systems offering the TCP_KEEPIDLE and TCP_KEEPINTVL socket options (meaning Linux, recent AIX, HP-UX and more). This option has no effect if <a class="emphasis" href="#--no-keepalive">--no-keepalive</a> is used. (Added in 7.18.0) 
 
273
<p class="level1">If this option is used multiple times, the last occurrence sets the amount. 
259
274
<p class="level0"><a name="--key"></a><span class="nroffip">--key &lt;key&gt;</span> 
260
275
<p class="level1">(SSL/SSH) Private key file name. Allows you to provide your private key in this separate file. 
261
276
<p class="level1">If this option is used several times, the last one will be used. 
267
282
<p class="level1">This option requires that the library was built with kerberos4 or GSSAPI (GSS-Negotiate) support. This is not very common. Use <a class="emphasis" href="#-V--version">-V/--version</a> to see if your curl supports it. 
268
283
<p class="level1">If this option is used several times, the last one will be used. 
269
284
<p class="level0"><a name="-K--config"></a><span class="nroffip">-K/--config &lt;config file&gt;</span> 
270
 
<p class="level1">Specify which config file to read curl arguments from. The config file is a text file in which command line arguments can be written which then will be used as if they were written on the actual command line. Options and their parameters must be specified on the same config file line. If the parameter is to contain white spaces, the parameter must be enclosed within quotes.  If the first column of a config line is a '#' character, the rest of the line will be treated as a comment. Only write one option per physical line in the config file. 
 
285
<p class="level1">Specify which config file to read curl arguments from. The config file is a text file in which command line arguments can be written which then will be used as if they were written on the actual command line. Options and their parameters must be specified on the same config file line, separated by white space, colon, the equals sign or any combination thereof (however, the preferred separator is the equals sign). If the parameter is to contain white spaces, the parameter must be enclosed within quotes. Within double quotes, the following escape sequences are available: \\, \", \t, \n, \r and \v. A backlash preceding any other letter is  ignored. If the first column of a config line is a '#' character, the rest of the line will be treated as a comment. Only write one option per physical line in the config file. 
271
286
<p class="level1">Specify the filename to -K/--config as '-' to make curl read the file from stdin. 
272
287
<p class="level1">Note that to be able to specify a URL in the config file, you need to specify it using the <a class="emphasis" href="#--url">--url</a> option, and not by simply writing the URL on its own line. So, it could look similar to this: 
273
288
<p class="level1">url = "<a href="http://curl.haxx.se/docs/">http://curl.haxx.se/docs/</a>" 
293
308
<p class="level0"><a name="--libcurl"></a><span class="nroffip">--libcurl &lt;file&gt;</span> 
294
309
<p class="level1">Append this option to any ordinary curl command line, and you will get a libcurl-using source code written to the file that does the equivalent operation of what your command line operation does! 
295
310
<p class="level1">NOTE: this does not properly support -F and the sending of multipart formposts, so in those cases the output program will be missing necessary calls to <span Class="emphasis">curl_formadd(3)</span>, and possibly more. 
296
 
<p class="level1">If this option is used several times, the last given file name will be used. 
 
311
<p class="level1">If this option is used several times, the last given file name will be used. (Added in 7.16.1) 
297
312
<p class="level0"><a name="--limit-rate"></a><span class="nroffip">--limit-rate &lt;speed&gt;</span> 
298
313
<p class="level1">Specify the maximum transfer rate you want curl to use. This feature is useful if you have a limited pipe and you'd like your transfer not use your entire bandwidth. 
299
314
<p class="level1">The given speed is measured in bytes/second, unless a suffix is appended. Appending 'k' or 'K' will count the number as kilobytes, 'm' or M' makes it megabytes while 'g' or 'G' makes it gigabytes. Examples: 200K, 3m and 1G. 
337
352
<p class="level0"><a name="-N--no-buffer"></a><span class="nroffip">-N/--no-buffer</span> 
338
353
<p class="level1">Disables the buffering of the output stream. In normal work situations, curl will use a standard buffered output stream that will have the effect that it will output the data in chunks, not necessarily exactly when the data arrives. Using this option will disable that buffering. 
339
354
<p class="level1">If this option is used twice, the second will again switch on buffering. 
 
355
<p class="level0"><a name="--no-keepalive"></a><span class="nroffip">--no-keepalive</span> 
 
356
<p class="level1">Disables the use of keepalive messages on the TCP connection, as by default curl enables them. 
 
357
<p class="level1">If this option is used twice, the second will again enable keepalive. 
340
358
<p class="level0"><a name="--no-sessionid"></a><span class="nroffip">--no-sessionid</span> 
341
359
<p class="level1">(SSL) Disable curl's use of SSL session-ID caching.  By default all transfers are done using the cache. Note that while nothing ever should get hurt by attempting to reuse SSL session-IDs, there seem to be broken SSL implementations in the wild that may require you to disable this in order for you to succeed. (Added in 7.16.0) 
342
360
<p class="level1">If this option is used twice, the second will again switch on use of the session cache. 
362
380
<p class="level0"><a name="--post301"></a><span class="nroffip">--post301</span> 
363
381
<p class="level1">Tells curl to respect RFC 2616/10.3.2 and not convert POST requests into GET requests when following a 301 redirection. The non-RFC behaviour is ubiquitous in web browsers, so curl does the conversion by default to maintain consistency. However, a server may requires a POST to remain a POST after such a redirection. This option is meaningful only when using <a class="emphasis" href="#-L--location">-L/--location</a> (Added in 7.17.1) 
364
382
<p class="level0"><a name="--proxy-anyauth"></a><span class="nroffip">--proxy-anyauth</span> 
365
 
<p class="level1">Tells curl to pick a suitable authentication method when communicating with the given proxy. This will cause an extra request/response round-trip. (Added in 7.13.2) 
 
383
<p class="level1">Tells curl to pick a suitable authentication method when communicating with the given proxy. This might cause an extra request/response round-trip. (Added in 7.13.2) 
366
384
<p class="level1">If this option is used twice, the second will again disable the proxy use-any authentication. 
367
385
<p class="level0"><a name="--proxy-basic"></a><span class="nroffip">--proxy-basic</span> 
368
386
<p class="level1">Tells curl to use HTTP Basic authentication when communicating with the given proxy. Use <a class="emphasis" href="#--basic">--basic</a> for enabling HTTP Basic with a remote host. Basic is the default authentication method curl uses with proxies. 
403
421
<p class="level0"><a name="--random-file"></a><span class="nroffip">--random-file &lt;file&gt;</span> 
404
422
<p class="level1">(SSL) Specify the path name to file containing what will be considered as random data. The data is used to seed the random engine for SSL connections. See also the <a class="emphasis" href="#--egd-file">--egd-file</a> option. 
405
423
<p class="level0"><a name="-r--range"></a><span class="nroffip">-r/--range &lt;range&gt;</span> 
406
 
<p class="level1">(HTTP/FTP) Retrieve a byte range (i.e a partial document) from a HTTP/1.1 or FTP server. Ranges can be specified in a number of ways. 
 
424
<p class="level1">(HTTP/FTP/FILE) Retrieve a byte range (i.e a partial document) from a HTTP/1.1, FTP server or a local FILE. Ranges can be specified in a number of ways. 
407
425
<p class="level2">
408
426
<p class="level2"><span Class="bold">0-499</span> specifies the first 500 bytes 
409
427
<p class="level2"><span Class="bold">500-999</span> specifies the second 500 bytes 
444
462
<p class="level1">Use the specified SOCKS4 proxy. If the port number is not specified, it is assumed at port 1080. (Added in 7.15.2) 
445
463
<p class="level1">This option overrides any previous use of <a class="emphasis" href="#-x--proxy">-x/--proxy</a>, as they are mutually exclusive. 
446
464
<p class="level1">If this option is used several times, the last one will be used. 
 
465
<p class="level0"><a name="--socks4a"></a><span class="nroffip">--socks4a &lt;host[:port]&gt;</span> 
 
466
<p class="level1">Use the specified SOCKS4a proxy. If the port number is not specified, it is assumed at port 1080. (Added in 7.18.0) 
 
467
<p class="level1">This option overrides any previous use of <a class="emphasis" href="#-x--proxy">-x/--proxy</a>, as they are mutually exclusive. 
 
468
<p class="level1">If this option is used several times, the last one will be used. 
 
469
<p class="level0"><a name="--socks5-hostname"></a><span class="nroffip">--socks5-hostname &lt;host[:port]&gt;</span> 
 
470
<p class="level1">Use the specified SOCKS5 proxy (and let the proxy resolve the host name). If the port number is not specified, it is assumed at port 1080. (Added in 7.18.0) 
 
471
<p class="level1">This option overrides any previous use of <a class="emphasis" href="#-x--proxy">-x/--proxy</a>, as they are mutually exclusive. 
 
472
<p class="level1">If this option is used several times, the last one will be used. (This option was previously wrongly documented and used as --socks without the number appended.) 
447
473
<p class="level0"><a name="--socks5"></a><span class="nroffip">--socks5 &lt;host[:port]&gt;</span> 
448
 
<p class="level1">Use the specified SOCKS5 proxy. If the port number is not specified, it is assumed at port 1080. (Added in 7.11.1) 
 
474
<p class="level1">Use the specified SOCKS5 proxy - but resolve the host name locally. If the port number is not specified, it is assumed at port 1080. 
449
475
<p class="level1">This option overrides any previous use of <a class="emphasis" href="#-x--proxy">-x/--proxy</a>, as they are mutually exclusive. 
450
476
<p class="level1">If this option is used several times, the last one will be used. (This option was previously wrongly documented and used as --socks without the number appended.) 
451
477
<p class="level0"><a name="--stderr"></a><span class="nroffip">--stderr &lt;file&gt;</span> 
480
506
<p class="level1">If this option is used several times, each occurrence will toggle it on/off. 
481
507
<p class="level0"><a name="-u--user"></a><span class="nroffip">-u/--user &lt;user:password&gt;</span> 
482
508
<p class="level1">Specify user and password to use for server authentication. Overrides <a class="emphasis" href="#-n--netrc">-n/--netrc</a> and <a class="emphasis" href="#--netrc-optional">--netrc-optional</a>. 
 
509
<p class="level1">If you just give the user name (without entering a colon) curl will prompt for a password. 
483
510
<p class="level1">If you use an SSPI-enabled curl binary and do NTLM authentication, you can force curl to pick up the user name and password from your environment by simply specifying a single colon with this option: "-u :". 
484
511
<p class="level1">If this option is used several times, the last one will be used. 
485
512
<p class="level0"><a name="-U--proxy-user"></a><span class="nroffip">-U/--proxy-user &lt;user:password&gt;</span>