Install curl-7.19.5.tar.bz2
[msysgit/bosko.git] / mingw / share / man / man3 / curl_easy_getinfo.3
blob90ef04675a62d3494825733a71a24648c0848a90
1 .\" **************************************************************************
2 .\" *                                  _   _ ____  _
3 .\" *  Project                     ___| | | |  _ \| |
4 .\" *                             / __| | | | |_) | |
5 .\" *                            | (__| |_| |  _ <| |___
6 .\" *                             \___|\___/|_| \_\_____|
7 .\" *
8 .\" * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
9 .\" *
10 .\" * This software is licensed as described in the file COPYING, which
11 .\" * you should have received as part of this distribution. The terms
12 .\" * are also available at http://curl.haxx.se/docs/copyright.html.
13 .\" *
14 .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 .\" * copies of the Software, and permit persons to whom the Software is
16 .\" * furnished to do so, under the terms of the COPYING file.
17 .\" *
18 .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 .\" * KIND, either express or implied.
20 .\" *
21 .\" * $Id: curl_easy_getinfo.3,v 1.42 2009-05-07 09:31:24 bagder Exp $
22 .\" **************************************************************************
23 .\"
24 .TH curl_easy_getinfo 3 "11 Feb 2009" "libcurl 7.19.4" "libcurl Manual"
25 .SH NAME
26 curl_easy_getinfo - extract information from a curl handle
27 .SH SYNOPSIS
28 .B #include <curl/curl.h>
30 .B "CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ... );"
32 .SH DESCRIPTION
33 Request internal information from the curl session with this function.  The
34 third argument \fBMUST\fP be a pointer to a long, a pointer to a char *, a
35 pointer to a struct curl_slist * or a pointer to a double (as this
36 documentation describes further down).  The data pointed-to will be filled in
37 accordingly and can be relied upon only if the function returns CURLE_OK.  Use
38 this function AFTER a performed transfer if you want to get transfer- oriented
39 data.
41 You should not free the memory returned by this function unless it is
42 explicitly mentioned below.
43 .SH AVAILABLE INFORMATION
44 The following information can be extracted:
45 .IP CURLINFO_EFFECTIVE_URL
46 Pass a pointer to a char pointer to receive the last used effective URL.
47 .IP CURLINFO_RESPONSE_CODE
48 Pass a pointer to a long to receive the last received HTTP or FTP code. This
49 option was known as CURLINFO_HTTP_CODE in libcurl 7.10.7 and earlier. This
50 will be zero if no server response code has been received. Note that a proxy's
51 CONNECT response should be read with \fICURLINFO_HTTP_CONNECTCODE\fP and not
52 this.
53 .IP CURLINFO_HTTP_CONNECTCODE
54 Pass a pointer to a long to receive the last received proxy response code to a
55 CONNECT request.
56 .IP CURLINFO_FILETIME
57 Pass a pointer to a long to receive the remote time of the retrieved document
58 (in number of seconds since 1 jan 1970 in the GMT/UTC time zone). If you get
59 -1, it can be because of many reasons (unknown, the server hides it or the
60 server doesn't support the command that tells document time etc) and the time
61 of the document is unknown. Note that you must tell the server to collect this
62 information before the transfer is made, by using the CURLOPT_FILETIME option
63 to \fIcurl_easy_setopt(3)\fP or you will unconditionally get a -1 back. (Added
64 in 7.5)
65 .IP CURLINFO_TOTAL_TIME
66 Pass a pointer to a double to receive the total time in seconds for the
67 previous transfer, including name resolving, TCP connect etc.
68 .IP CURLINFO_NAMELOOKUP_TIME
69 Pass a pointer to a double to receive the time, in seconds, it took from the
70 start until the name resolving was completed.
71 .IP CURLINFO_CONNECT_TIME
72 Pass a pointer to a double to receive the time, in seconds, it took from the
73 start until the connect to the remote host (or proxy) was completed.
74 .IP CURLINFO_APPCONNECT_TIME
75 Pass a pointer to a double to receive the time, in seconds, it took from the
76 start until the SSL/SSH connect/handshake to the remote host was completed.
77 This time is most often very near to the PRETRANSFER time, except for cases
78 such as HTTP pippelining where the pretransfer time can be delayed due to
79 waits in line for the pipeline and more. (Added in 7.19.0)
80 .IP CURLINFO_PRETRANSFER_TIME
81 Pass a pointer to a double to receive the time, in seconds, it took from the
82 start until the file transfer is just about to begin. This includes all
83 pre-transfer commands and negotiations that are specific to the particular
84 protocol(s) involved.
85 .IP CURLINFO_STARTTRANSFER_TIME
86 Pass a pointer to a double to receive the time, in seconds, it took from the
87 start until the first byte is just about to be transferred. This includes
88 CURLINFO_PRETRANSFER_TIME and also the time the server needs to calculate
89 the result.
90 .IP CURLINFO_REDIRECT_TIME
91 Pass a pointer to a double to receive the total time, in seconds, it took for
92 all redirection steps include name lookup, connect, pretransfer and transfer
93 before final transaction was started. CURLINFO_REDIRECT_TIME contains the
94 complete execution time for multiple redirections.  (Added in 7.9.7)
95 .IP CURLINFO_REDIRECT_COUNT
96 Pass a pointer to a long to receive the total number of redirections that were
97 actually followed.  (Added in 7.9.7)
98 .IP CURLINFO_REDIRECT_URL
99 Pass a pointer to a char pointer to receive the URL a redirect \fIwould\fP
100 take you to if you would enable CURLOPT_FOLLOWLOCATION. This can come very
101 handy if you think using the built-in libcurl redirect logic isn't good enough
102 for you but you would still prefer to avoid implementing all the magic of
103 figuring out the new URL. (Added in 7.18.2)
104 .IP CURLINFO_SIZE_UPLOAD
105 Pass a pointer to a double to receive the total amount of bytes that were
106 uploaded.
107 .IP CURLINFO_SIZE_DOWNLOAD
108 Pass a pointer to a double to receive the total amount of bytes that were
109 downloaded. The amount is only for the latest transfer and will be reset again
110 for each new transfer.
111 .IP CURLINFO_SPEED_DOWNLOAD
112 Pass a pointer to a double to receive the average download speed that curl
113 measured for the complete download. Measured in bytes/second.
114 .IP CURLINFO_SPEED_UPLOAD
115 Pass a pointer to a double to receive the average upload speed that curl
116 measured for the complete upload. Measured in bytes/second.
117 .IP CURLINFO_HEADER_SIZE
118 Pass a pointer to a long to receive the total size of all the headers
119 received. Measured in number of bytes.
120 .IP CURLINFO_REQUEST_SIZE
121 Pass a pointer to a long to receive the total size of the issued
122 requests. This is so far only for HTTP requests. Note that this may be more
123 than one request if FOLLOWLOCATION is true.
124 .IP CURLINFO_SSL_VERIFYRESULT
125 Pass a pointer to a long to receive the result of the certification
126 verification that was requested (using the CURLOPT_SSL_VERIFYPEER option to
127 \fIcurl_easy_setopt(3)\fP).
128 .IP CURLINFO_SSL_ENGINES
129 Pass the address of a 'struct curl_slist *' to receive a linked-list of
130 OpenSSL crypto-engines supported. Note that engines are normally implemented
131 in separate dynamic libraries. Hence not all the returned engines may be
132 available at run-time. \fBNOTE:\fP you must call \fIcurl_slist_free_all(3)\fP
133 on the list pointer once you're done with it, as libcurl will not free the
134 data for you. (Added in 7.12.3)
135 .IP CURLINFO_CONTENT_LENGTH_DOWNLOAD
136 Pass a pointer to a double to receive the content-length of the download. This
137 is the value read from the Content-Length: field. Since 7.19.4, this returns -1
138 if the size isn't known.
139 .IP CURLINFO_CONTENT_LENGTH_UPLOAD
140 Pass a pointer to a double to receive the specified size of the upload.  Since
141 7.19.4, this returns -1 if the size isn't known.
142 .IP CURLINFO_CONTENT_TYPE
143 Pass a pointer to a char pointer to receive the content-type of the downloaded
144 object. This is the value read from the Content-Type: field. If you get NULL,
145 it means that the server didn't send a valid Content-Type header or that the
146 protocol used doesn't support this.
147 .IP CURLINFO_PRIVATE
148 Pass a pointer to a char pointer to receive the pointer to the private data
149 associated with the curl handle (set with the CURLOPT_PRIVATE option to
150 \fIcurl_easy_setopt(3)\fP). Please note that for internal reasons, the
151 value is returned as a char pointer, although effectively being a 'void *'.
152 (Added in 7.10.3)
153 .IP CURLINFO_HTTPAUTH_AVAIL
154 Pass a pointer to a long to receive a bitmask indicating the authentication
155 method(s) available. The meaning of the bits is explained in the
156 CURLOPT_HTTPAUTH option for \fIcurl_easy_setopt(3)\fP.  (Added in 7.10.8)
157 .IP CURLINFO_PROXYAUTH_AVAIL
158 Pass a pointer to a long to receive a bitmask indicating the authentication
159 method(s) available for your proxy authentication.  (Added in 7.10.8)
160 .IP CURLINFO_OS_ERRNO
161 Pass a pointer to a long to receive the errno variable from a connect failure.
162 (Added in 7.12.2)
163 .IP CURLINFO_NUM_CONNECTS
164 Pass a pointer to a long to receive how many new connections libcurl had to
165 create to achieve the previous transfer (only the successful connects are
166 counted).  Combined with \fICURLINFO_REDIRECT_COUNT\fP you are able to know
167 how many times libcurl successfully reused existing connection(s) or not.  See
168 the Connection Options of \fIcurl_easy_setopt(3)\fP to see how libcurl tries
169 to make persistent connections to save time.  (Added in 7.12.3)
170 .IP CURLINFO_PRIMARY_IP
171 Pass a pointer to a char pointer to receive the pointer to a zero-terminated
172 string holding the IP address of the most recent connection done with this
173 \fBcurl\fP handle. This string may be IPv6 if that's enabled. Note that you
174 get a pointer to a memory area that will be re-used at next request so you
175 need to copy the string if you want to keep the information. (Added in 7.19.0)
176 .IP CURLINFO_COOKIELIST
177 Pass a pointer to a 'struct curl_slist *' to receive a linked-list of all
178 cookies cURL knows (expired ones, too). Don't forget to
179 \fIcurl_slist_free_all(3)\fP the list after it has been used.  If there are no
180 cookies (cookies for the handle have not been enabled or simply none have been
181 received) 'struct curl_slist *' will be set to point to NULL. (Added in
182 7.14.1)
183 .IP CURLINFO_LASTSOCKET
184 Pass a pointer to a long to receive the last socket used by this curl
185 session. If the socket is no longer valid, -1 is returned. When you finish
186 working with the socket, you must call curl_easy_cleanup() as usual and let
187 libcurl close the socket and cleanup other resources associated with the
188 handle. This is typically used in combination with \fICURLOPT_CONNECT_ONLY\fP.
189 (Added in 7.15.2)
190 .IP CURLINFO_FTP_ENTRY_PATH
191 Pass a pointer to a char pointer to receive a pointer to a string holding the
192 path of the entry path. That is the initial path libcurl ended up in when
193 logging on to the remote FTP server. This stores a NULL as pointer if
194 something is wrong. (Added in 7.15.4)
195 .IP CURLINFO_CERTINFO
196 Pass a pointer to a 'struct curl_certinfo *' and you'll get it set to point to
197 struct that holds a number of linked lists with info about the certificate
198 chain, assuming you had CURLOPT_CERTINFO enabled when the previous request was
199 done. The struct reports how many certs it found and then you can extract info
200 for each of those certs by following the linked lists. The info chain is
201 provided in a series of data in the format "name:content" where the content is
202 for the specific named data. See also the certinfo.c example. NOTE: this
203 option is only available in libcurl built with OpenSSL support. (Added in
204 7.19.1)
205 .IP CURLINFO_CONDITION_UNMET
206 Pass a pointer to a long to receive the number 1 if the condition provided in
207 the previous request didn't match (see \fICURLOPT_TIMECONDITION\fP). Alas, if
208 this returns a 1 you know that the reason you didn't get data in return is
209 because it didn't fulfill the condition. The long ths argument points to will
210 get a zero stored if the condition instead was met. (Added in 7.19.4)
211 .SH TIMES
213 An overview of the six time values available from curl_easy_getinfo()
215 curl_easy_perform()
216     |
217     |--NAMELOOKUP
218     |--|--CONNECT
219     |--|--|--APPCONNECT
220     |--|--|--|--PRETRANSFER
221     |--|--|--|--|--STARTTRANSFER
222     |--|--|--|--|--|--TOTAL
223     |--|--|--|--|--|--REDIRECT
225 .IP NAMELOOKUP
226 \fICURLINFO_NAMELOOKUP_TIME\fP. The time it took from the start until the name
227 resolving was completed.
228 .IP CONNECT
229 \fICURLINFO_CONNECT_TIME\fP. The time it took from the start until the connect
230 to the remote host (or proxy) was completed.
231 .IP APPCONNECT
232 \fICURLINFO_APPCONNECT_TIME\fP. The time it took from the start until the SSL
233 connect/handshake with the remote host was completed. (Added in in 7.19.0)
234 .IP PRETRANSFER
235 \fICURLINFO_PRETRANSFER_TIME\fP. The time it took from the start until the
236 file transfer is just about to begin. This includes all pre-transfer commands
237 and negotiations that are specific to the particular protocol(s) involved.
238 .IP STARTTRANSFER
239 \fICURLINFO_STARTTRANSFER_TIME\fP. The time it took from the start until the
240 first byte is just about to be transferred.
241 .IP TOTAL
242 \fICURLINFO_TOTAL_TIME\fP. Total time of the previous request.
243 .IP REDIRECT
244 \fICURLINFO_REDIRECT_TIME\fP. The time it took for all redirection steps
245 include name lookup, connect, pretransfer and transfer before final
246 transaction was started. So, this is zero if no redirection took place.
247 .SH RETURN VALUE
248 If the operation was successful, CURLE_OK is returned. Otherwise an
249 appropriate error code will be returned.
250 .SH "SEE ALSO"
251 .BR curl_easy_setopt "(3)"