Fixed a few typos.
[platform/upstream/curl.git] / docs / libcurl / curl_easy_getinfo.3
1 .\" **************************************************************************
2 .\" *                                  _   _ ____  _
3 .\" *  Project                     ___| | | |  _ \| |
4 .\" *                             / __| | | | |_) | |
5 .\" *                            | (__| |_| |  _ <| |___
6 .\" *                             \___|\___/|_| \_\_____|
7 .\" *
8 .\" * Copyright (C) 1998 - 2007, 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$
22 .\" **************************************************************************
23 .\"
24 .TH curl_easy_getinfo 3 "21 Mar 2006" "libcurl 7.15.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>
29
30 .B "CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ... );"
31
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.
40
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 *' 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_PRETRANSFER_TIME
75 Pass a pointer to a double to receive the time, in seconds, it took from the
76 start until the file transfer is just about to begin. This includes all
77 pre-transfer commands and negotiations that are specific to the particular
78 protocol(s) involved.
79 .IP CURLINFO_STARTTRANSFER_TIME
80 Pass a pointer to a double to receive the time, in seconds, it took from the
81 start until the first byte is just about to be transferred. This includes
82 CURLINFO_PRETRANSFER_TIME and also the time the server needs to calculate
83 the result.
84 .IP CURLINFO_REDIRECT_TIME
85 Pass a pointer to a double to receive the total time, in seconds, it took for
86 all redirection steps include name lookup, connect, pretransfer and transfer
87 before final transaction was started. CURLINFO_REDIRECT_TIME contains the
88 complete execution time for multiple redirections.  (Added in 7.9.7)
89 .IP CURLINFO_REDIRECT_COUNT
90 Pass a pointer to a long to receive the total number of redirections that were
91 actually followed.  (Added in 7.9.7)
92 .IP CURLINFO_SIZE_UPLOAD
93 Pass a pointer to a double to receive the total amount of bytes that were
94 uploaded.
95 .IP CURLINFO_SIZE_DOWNLOAD
96 Pass a pointer to a double to receive the total amount of bytes that were
97 downloaded. The amount is only for the latest transfer and will be reset again
98 for each new transfer.
99 .IP CURLINFO_SPEED_DOWNLOAD
100 Pass a pointer to a double to receive the average download speed that curl
101 measured for the complete download. Measured in bytes/second.
102 .IP CURLINFO_SPEED_UPLOAD
103 Pass a pointer to a double to receive the average upload speed that curl
104 measured for the complete upload. Measured in bytes/second.
105 .IP CURLINFO_HEADER_SIZE
106 Pass a pointer to a long to receive the total size of all the headers
107 received. Measured in number of bytes.
108 .IP CURLINFO_REQUEST_SIZE
109 Pass a pointer to a long to receive the total size of the issued
110 requests. This is so far only for HTTP requests. Note that this may be more
111 than one request if FOLLOWLOCATION is true.
112 .IP CURLINFO_SSL_VERIFYRESULT
113 Pass a pointer to a long to receive the result of the certification
114 verification that was requested (using the CURLOPT_SSL_VERIFYPEER option to
115 \fIcurl_easy_setopt(3)\fP).
116 .IP CURLINFO_SSL_ENGINES
117 Pass the address of a 'struct curl_slist *' to receive a linked-list of
118 OpenSSL crypto-engines supported. Note that engines are normally implemented
119 in separate dynamic libraries. Hence not all the returned engines may be
120 available at run-time. \fBNOTE:\fP you must call \fIcurl_slist_free_all(3)\fP
121 on the list pointer once you're done with it, as libcurl will not free the
122 data for you. (Added in 7.12.3)
123 .IP CURLINFO_CONTENT_LENGTH_DOWNLOAD
124 Pass a pointer to a double to receive the content-length of the download. This
125 is the value read from the Content-Length: field.
126 .IP CURLINFO_CONTENT_LENGTH_UPLOAD
127 Pass a pointer to a double to receive the specified size of the upload.
128 .IP CURLINFO_CONTENT_TYPE
129 Pass a pointer to a 'char *' to receive the content-type of the downloaded
130 object. This is the value read from the Content-Type: field. If you get NULL,
131 it means that the server didn't send a valid Content-Type header or that the
132 protocol used doesn't support this.
133 .IP CURLINFO_PRIVATE
134 Pass a pointer to a 'char *' to receive the pointer to the private data
135 associated with the curl handle (set with the CURLOPT_PRIVATE option to
136 \fIcurl_easy_setopt(3)\fP). (Added in 7.10.3)
137 .IP CURLINFO_HTTPAUTH_AVAIL
138 Pass a pointer to a long to receive a bitmask indicating the authentication
139 method(s) available. The meaning of the bits is explained in the
140 CURLOPT_HTTPAUTH option for \fIcurl_easy_setopt(3)\fP.  (Added in 7.10.8)
141 .IP CURLINFO_PROXYAUTH_AVAIL
142 Pass a pointer to a long to receive a bitmask indicating the authentication
143 method(s) available for your proxy authentication.  (Added in 7.10.8)
144 .IP CURLINFO_OS_ERRNO
145 Pass a pointer to a long to receive the errno variable from a connect failure.
146 (Added in 7.12.2)
147 .IP CURLINFO_NUM_CONNECTS
148 Pass a pointer to a long to receive how many new connections libcurl had to
149 create to achieve the previous transfer (only the successful connects are
150 counted).  Combined with \fICURLINFO_REDIRECT_COUNT\fP you are able to know
151 how many times libcurl successfully reused existing connection(s) or not.  See
152 the Connection Options of \fIcurl_easy_setopt(3)\fP to see how libcurl tries
153 to make persistent connections to save time.  (Added in 7.12.3)
154 .IP CURLINFO_COOKIELIST
155 Pass a pointer to a 'struct curl_slist *' to receive a linked-list of all
156 cookies cURL knows (expired ones, too). Don't forget to
157 \fIcurl_slist_free_all(3)\fP the list after it has been used.  If there are no
158 cookies (cookies for the handle have not been enabled or simply none have been
159 received) 'struct curl_slist *' will be set to point to NULL. (Added in
160 7.14.1)
161 .IP CURLINFO_LASTSOCKET
162 Pass a pointer to a long to receive the last socket used by this curl
163 session. If the socket is no longer valid, -1 is returned. When you finish
164 working with the socket, you must call curl_easy_cleanup() as usual and let
165 libcurl close the socket and cleanup other resources associated with the
166 handle. This is typically used in combination with \fICURLOPT_CONNECT_ONLY\fP.
167 (Added in 7.15.2)
168 .IP CURLINFO_FTP_ENTRY_PATH
169 Pass a pointer to a 'char *' to receive a pointer to a string holding the path
170 of the entry path. That is the initial path libcurl ended up in when logging
171 on to the remote FTP server. This stores a NULL as pointer if something is
172 wrong. (Added in 7.15.4)
173 .SH TIMES
174 .NF
175 An overview of the six time values available from curl_easy_getinfo()
176
177 curl_easy_perform()
178     |
179     |--NT
180     |--|--CT
181     |--|--|--PT
182     |--|--|--|--ST
183     |--|--|--|--|--TT
184     |--|--|--|--|--RT
185 .FI
186 .IP NT
187 \fICURLINFO_NAMELOOKUP_TIME\fP. The time it took from the start until the name
188 resolving was completed.
189 .IP CT
190 \fICURLINFO_CONNECT_TIME\fP. The time it took from the start until the connect
191 to the remote host (or proxy) was completed.
192 .IP PT
193 \fICURLINFO_PRETRANSFER_TIME\fP. The time it took from the start until the
194 file transfer is just about to begin. This includes all pre-transfer commands
195 and negotiations that are specific to the particular protocol(s) involved.
196 .IP ST
197 \fICURLINFO_STARTTRANSFER_TIME\fP. The time it took from the start until the
198 first byte is just about to be transferred.
199 .IP TT
200 \fICURLINFO_TOTAL_TIME\fP. Total time of the previous request.
201 .IP RT
202 \fICURLINFO_REDIRECT_TIME\fP. The time it took for all redirection steps
203 include name lookup, connect, pretransfer and transfer before final
204 transaction was started. So, this is zero if no redirection took place.
205 .SH RETURN VALUE
206 If the operation was successful, CURLE_OK is returned. Otherwise an
207 appropriate error code will be returned.
208 .SH "SEE ALSO"
209 .BR curl_easy_setopt "(3)"