~ubuntu-branches/ubuntu/vivid/curl/vivid

« back to all changes in this revision

Viewing changes to lib/getinfo.c

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Schuldei
  • Date: 2009-04-02 23:35:45 UTC
  • mto: (1.2.1 upstream) (3.2.3 sid)
  • mto: This revision was merged to the branch mainline in revision 38.
  • Revision ID: james.westby@ubuntu.com-20090402233545-geixkwhe3izccjt7
Tags: upstream-7.19.4
ImportĀ upstreamĀ versionĀ 7.19.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 *                            | (__| |_| |  _ <| |___
6
6
 *                             \___|\___/|_| \_\_____|
7
7
 *
8
 
 * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
 
8
 * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
9
9
 *
10
10
 * This software is licensed as described in the file COPYING, which
11
11
 * you should have received as part of this distribution. The terms
18
18
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
19
 * KIND, either express or implied.
20
20
 *
21
 
 * $Id: getinfo.c,v 1.61 2008-05-12 21:43:29 bagder Exp $
 
21
 * $Id: getinfo.c,v 1.67 2009-02-23 18:45:00 bagder Exp $
22
22
 ***************************************************************************/
23
23
 
24
24
#include "setup.h"
35
35
#include "memory.h"
36
36
#include "sslgen.h"
37
37
#include "connect.h" /* Curl_getconnectinfo() */
 
38
#include "progress.h"
38
39
 
39
40
/* Make this the last #include */
40
41
#include "memdebug.h"
78
79
  struct curl_slist **param_slistp=NULL;
79
80
  int type;
80
81
 
 
82
  union {
 
83
    struct curl_certinfo * to_certinfo;
 
84
    struct curl_slist    * to_slist;
 
85
  } ptr;
 
86
 
81
87
  if(!data)
82
88
    return CURLE_BAD_FUNCTION_ARGUMENT;
83
89
 
137
143
  case CURLINFO_CONNECT_TIME:
138
144
    *param_doublep = data->progress.t_connect;
139
145
    break;
 
146
  case CURLINFO_APPCONNECT_TIME:
 
147
    *param_doublep = data->progress.t_appconnect;
 
148
    break;
140
149
  case CURLINFO_PRETRANSFER_TIME:
141
150
    *param_doublep =  data->progress.t_pretransfer;
142
151
    break;
159
168
    *param_longp = data->set.ssl.certverifyresult;
160
169
    break;
161
170
  case CURLINFO_CONTENT_LENGTH_DOWNLOAD:
162
 
    *param_doublep = (double)data->progress.size_dl;
 
171
    *param_doublep = (data->progress.flags & PGRS_DL_SIZE_KNOWN)?
 
172
      (double)data->progress.size_dl:-1;
163
173
    break;
164
174
  case CURLINFO_CONTENT_LENGTH_UPLOAD:
165
 
    *param_doublep = (double)data->progress.size_ul;
 
175
    *param_doublep = (data->progress.flags & PGRS_UL_SIZE_KNOWN)?
 
176
      (double)data->progress.size_ul:-1;
166
177
    break;
167
178
  case CURLINFO_REDIRECT_TIME:
168
179
    *param_doublep =  data->progress.t_redirect;
210
221
       option had been enabled! */
211
222
    *param_charp = data->info.wouldredirect;
212
223
    break;
 
224
  case CURLINFO_PRIMARY_IP:
 
225
    /* Return the ip address of the most recent (primary) connection */
 
226
    *param_charp = data->info.ip;
 
227
    break;
 
228
  case CURLINFO_CERTINFO:
 
229
    /* Return the a pointer to the certinfo struct. Not really an slist
 
230
       pointer but we can pretend it is here */
 
231
    ptr.to_certinfo = &data->info.certs;
 
232
    *param_slistp = ptr.to_slist;
 
233
    break;
 
234
  case CURLINFO_CONDITION_UNMET:
 
235
    /* return if the condition prevented the document to get transfered */
 
236
    *param_longp = data->info.timecond;
 
237
    break;
213
238
  default:
214
239
    return CURLE_BAD_FUNCTION_ARGUMENT;
215
240
  }