Coverage Report

Created: 2024-05-04 12:45

/proc/self/cwd/external/curl/lib/getinfo.c
Line
Count
Source (jump to first uncovered line)
1
/***************************************************************************
2
 *                                  _   _ ____  _
3
 *  Project                     ___| | | |  _ \| |
4
 *                             / __| | | | |_) | |
5
 *                            | (__| |_| |  _ <| |___
6
 *                             \___|\___/|_| \_\_____|
7
 *
8
 * Copyright (C) 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 https://curl.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
 * SPDX-License-Identifier: curl
22
 *
23
 ***************************************************************************/
24
25
#include "curl_setup.h"
26
27
#include <curl/curl.h>
28
29
#include "urldata.h"
30
#include "getinfo.h"
31
32
#include "vtls/vtls.h"
33
#include "connect.h" /* Curl_getconnectinfo() */
34
#include "progress.h"
35
36
/* The last #include files should be: */
37
#include "curl_memory.h"
38
#include "memdebug.h"
39
40
/*
41
 * Initialize statistical and informational data.
42
 *
43
 * This function is called in curl_easy_reset, curl_easy_duphandle and at the
44
 * beginning of a perform session. It must reset the session-info variables,
45
 * in particular all variables in struct PureInfo.
46
 */
47
CURLcode Curl_initinfo(struct Curl_easy *data)
48
0
{
49
0
  struct Progress *pro = &data->progress;
50
0
  struct PureInfo *info = &data->info;
51
52
0
  pro->t_nslookup = 0;
53
0
  pro->t_connect = 0;
54
0
  pro->t_appconnect = 0;
55
0
  pro->t_pretransfer = 0;
56
0
  pro->t_starttransfer = 0;
57
0
  pro->timespent = 0;
58
0
  pro->t_redirect = 0;
59
0
  pro->is_t_startransfer_set = false;
60
61
0
  info->httpcode = 0;
62
0
  info->httpproxycode = 0;
63
0
  info->httpversion = 0;
64
0
  info->filetime = -1; /* -1 is an illegal time and thus means unknown */
65
0
  info->timecond = FALSE;
66
67
0
  info->header_size = 0;
68
0
  info->request_size = 0;
69
0
  info->proxyauthavail = 0;
70
0
  info->httpauthavail = 0;
71
0
  info->numconnects = 0;
72
73
0
  free(info->contenttype);
74
0
  info->contenttype = NULL;
75
76
0
  free(info->wouldredirect);
77
0
  info->wouldredirect = NULL;
78
79
0
  info->conn_primary_ip[0] = '\0';
80
0
  info->conn_local_ip[0] = '\0';
81
0
  info->conn_primary_port = 0;
82
0
  info->conn_local_port = 0;
83
0
  info->retry_after = 0;
84
85
0
  info->conn_scheme = 0;
86
0
  info->conn_protocol = 0;
87
88
0
#ifdef USE_SSL
89
0
  Curl_ssl_free_certinfo(data);
90
0
#endif
91
0
  return CURLE_OK;
92
0
}
93
94
static CURLcode getinfo_char(struct Curl_easy *data, CURLINFO info,
95
                             const char **param_charp)
96
0
{
97
0
  switch(info) {
98
0
  case CURLINFO_EFFECTIVE_URL:
99
0
    *param_charp = data->state.url?data->state.url:(char *)"";
100
0
    break;
101
0
  case CURLINFO_EFFECTIVE_METHOD: {
102
0
    const char *m = data->set.str[STRING_CUSTOMREQUEST];
103
0
    if(!m) {
104
0
      if(data->set.opt_no_body)
105
0
        m = "HEAD";
106
0
#ifndef CURL_DISABLE_HTTP
107
0
      else {
108
0
        switch(data->state.httpreq) {
109
0
        case HTTPREQ_POST:
110
0
        case HTTPREQ_POST_FORM:
111
0
        case HTTPREQ_POST_MIME:
112
0
          m = "POST";
113
0
          break;
114
0
        case HTTPREQ_PUT:
115
0
          m = "PUT";
116
0
          break;
117
0
        default: /* this should never happen */
118
0
        case HTTPREQ_GET:
119
0
          m = "GET";
120
0
          break;
121
0
        case HTTPREQ_HEAD:
122
0
          m = "HEAD";
123
0
          break;
124
0
        }
125
0
      }
126
0
#endif
127
0
    }
128
0
    *param_charp = m;
129
0
  }
130
0
    break;
131
0
  case CURLINFO_CONTENT_TYPE:
132
0
    *param_charp = data->info.contenttype;
133
0
    break;
134
0
  case CURLINFO_PRIVATE:
135
0
    *param_charp = (char *) data->set.private_data;
136
0
    break;
137
0
  case CURLINFO_FTP_ENTRY_PATH:
138
    /* Return the entrypath string from the most recent connection.
139
       This pointer was copied from the connectdata structure by FTP.
140
       The actual string may be free()ed by subsequent libcurl calls so
141
       it must be copied to a safer area before the next libcurl call.
142
       Callers must never free it themselves. */
143
0
    *param_charp = data->state.most_recent_ftp_entrypath;
144
0
    break;
145
0
  case CURLINFO_REDIRECT_URL:
146
    /* Return the URL this request would have been redirected to if that
147
       option had been enabled! */
148
0
    *param_charp = data->info.wouldredirect;
149
0
    break;
150
0
  case CURLINFO_REFERER:
151
    /* Return the referrer header for this request, or NULL if unset */
152
0
    *param_charp = data->state.referer;
153
0
    break;
154
0
  case CURLINFO_PRIMARY_IP:
155
    /* Return the ip address of the most recent (primary) connection */
156
0
    *param_charp = data->info.conn_primary_ip;
157
0
    break;
158
0
  case CURLINFO_LOCAL_IP:
159
    /* Return the source/local ip address of the most recent (primary)
160
       connection */
161
0
    *param_charp = data->info.conn_local_ip;
162
0
    break;
163
0
  case CURLINFO_RTSP_SESSION_ID:
164
0
    *param_charp = data->set.str[STRING_RTSP_SESSION_ID];
165
0
    break;
166
0
  case CURLINFO_SCHEME:
167
0
    *param_charp = data->info.conn_scheme;
168
0
    break;
169
0
  case CURLINFO_CAPATH:
170
#ifdef CURL_CA_PATH
171
    *param_charp = CURL_CA_PATH;
172
#else
173
0
    *param_charp = NULL;
174
0
#endif
175
0
    break;
176
0
  case CURLINFO_CAINFO:
177
0
#ifdef CURL_CA_BUNDLE
178
0
    *param_charp = CURL_CA_BUNDLE;
179
#else
180
    *param_charp = NULL;
181
#endif
182
0
    break;
183
184
0
  default:
185
0
    return CURLE_UNKNOWN_OPTION;
186
0
  }
187
188
0
  return CURLE_OK;
189
0
}
190
191
static CURLcode getinfo_long(struct Curl_easy *data, CURLINFO info,
192
                             long *param_longp)
193
0
{
194
0
  curl_socket_t sockfd;
195
196
0
  union {
197
0
    unsigned long *to_ulong;
198
0
    long          *to_long;
199
0
  } lptr;
200
201
#ifdef DEBUGBUILD
202
  char *timestr = getenv("CURL_TIME");
203
  if(timestr) {
204
    unsigned long val = strtol(timestr, NULL, 10);
205
    switch(info) {
206
    case CURLINFO_LOCAL_PORT:
207
      *param_longp = (long)val;
208
      return CURLE_OK;
209
    default:
210
      break;
211
    }
212
  }
213
  /* use another variable for this to allow different values */
214
  timestr = getenv("CURL_DEBUG_SIZE");
215
  if(timestr) {
216
    unsigned long val = strtol(timestr, NULL, 10);
217
    switch(info) {
218
    case CURLINFO_HEADER_SIZE:
219
    case CURLINFO_REQUEST_SIZE:
220
      *param_longp = (long)val;
221
      return CURLE_OK;
222
    default:
223
      break;
224
    }
225
  }
226
#endif
227
228
0
  switch(info) {
229
0
  case CURLINFO_RESPONSE_CODE:
230
0
    *param_longp = data->info.httpcode;
231
0
    break;
232
0
  case CURLINFO_HTTP_CONNECTCODE:
233
0
    *param_longp = data->info.httpproxycode;
234
0
    break;
235
0
  case CURLINFO_FILETIME:
236
0
    if(data->info.filetime > LONG_MAX)
237
0
      *param_longp = LONG_MAX;
238
0
    else if(data->info.filetime < LONG_MIN)
239
0
      *param_longp = LONG_MIN;
240
0
    else
241
0
      *param_longp = (long)data->info.filetime;
242
0
    break;
243
0
  case CURLINFO_HEADER_SIZE:
244
0
    *param_longp = (long)data->info.header_size;
245
0
    break;
246
0
  case CURLINFO_REQUEST_SIZE:
247
0
    *param_longp = (long)data->info.request_size;
248
0
    break;
249
0
  case CURLINFO_SSL_VERIFYRESULT:
250
0
    *param_longp = data->set.ssl.certverifyresult;
251
0
    break;
252
0
#ifndef CURL_DISABLE_PROXY
253
0
  case CURLINFO_PROXY_SSL_VERIFYRESULT:
254
0
    *param_longp = data->set.proxy_ssl.certverifyresult;
255
0
    break;
256
0
#endif
257
0
  case CURLINFO_REDIRECT_COUNT:
258
0
    *param_longp = data->state.followlocation;
259
0
    break;
260
0
  case CURLINFO_HTTPAUTH_AVAIL:
261
0
    lptr.to_long = param_longp;
262
0
    *lptr.to_ulong = data->info.httpauthavail;
263
0
    break;
264
0
  case CURLINFO_PROXYAUTH_AVAIL:
265
0
    lptr.to_long = param_longp;
266
0
    *lptr.to_ulong = data->info.proxyauthavail;
267
0
    break;
268
0
  case CURLINFO_OS_ERRNO:
269
0
    *param_longp = data->state.os_errno;
270
0
    break;
271
0
  case CURLINFO_NUM_CONNECTS:
272
0
    *param_longp = data->info.numconnects;
273
0
    break;
274
0
  case CURLINFO_LASTSOCKET:
275
0
    sockfd = Curl_getconnectinfo(data, NULL);
276
277
    /* note: this is not a good conversion for systems with 64 bit sockets and
278
       32 bit longs */
279
0
    if(sockfd != CURL_SOCKET_BAD)
280
0
      *param_longp = (long)sockfd;
281
0
    else
282
      /* this interface is documented to return -1 in case of badness, which
283
         may not be the same as the CURL_SOCKET_BAD value */
284
0
      *param_longp = -1;
285
0
    break;
286
0
  case CURLINFO_PRIMARY_PORT:
287
    /* Return the (remote) port of the most recent (primary) connection */
288
0
    *param_longp = data->info.conn_primary_port;
289
0
    break;
290
0
  case CURLINFO_LOCAL_PORT:
291
    /* Return the local port of the most recent (primary) connection */
292
0
    *param_longp = data->info.conn_local_port;
293
0
    break;
294
0
  case CURLINFO_PROXY_ERROR:
295
0
    *param_longp = (long)data->info.pxcode;
296
0
    break;
297
0
  case CURLINFO_CONDITION_UNMET:
298
0
    if(data->info.httpcode == 304)
299
0
      *param_longp = 1L;
300
0
    else
301
      /* return if the condition prevented the document to get transferred */
302
0
      *param_longp = data->info.timecond ? 1L : 0L;
303
0
    break;
304
0
#ifndef CURL_DISABLE_RTSP
305
0
  case CURLINFO_RTSP_CLIENT_CSEQ:
306
0
    *param_longp = data->state.rtsp_next_client_CSeq;
307
0
    break;
308
0
  case CURLINFO_RTSP_SERVER_CSEQ:
309
0
    *param_longp = data->state.rtsp_next_server_CSeq;
310
0
    break;
311
0
  case CURLINFO_RTSP_CSEQ_RECV:
312
0
    *param_longp = data->state.rtsp_CSeq_recv;
313
0
    break;
314
0
#endif
315
0
  case CURLINFO_HTTP_VERSION:
316
0
    switch(data->info.httpversion) {
317
0
    case 10:
318
0
      *param_longp = CURL_HTTP_VERSION_1_0;
319
0
      break;
320
0
    case 11:
321
0
      *param_longp = CURL_HTTP_VERSION_1_1;
322
0
      break;
323
0
    case 20:
324
0
      *param_longp = CURL_HTTP_VERSION_2_0;
325
0
      break;
326
0
    case 30:
327
0
      *param_longp = CURL_HTTP_VERSION_3;
328
0
      break;
329
0
    default:
330
0
      *param_longp = CURL_HTTP_VERSION_NONE;
331
0
      break;
332
0
    }
333
0
    break;
334
0
  case CURLINFO_PROTOCOL:
335
0
    *param_longp = data->info.conn_protocol;
336
0
    break;
337
0
  default:
338
0
    return CURLE_UNKNOWN_OPTION;
339
0
  }
340
341
0
  return CURLE_OK;
342
0
}
343
344
0
#define DOUBLE_SECS(x) (double)(x)/1000000
345
346
static CURLcode getinfo_offt(struct Curl_easy *data, CURLINFO info,
347
                             curl_off_t *param_offt)
348
0
{
349
#ifdef DEBUGBUILD
350
  char *timestr = getenv("CURL_TIME");
351
  if(timestr) {
352
    unsigned long val = strtol(timestr, NULL, 10);
353
    switch(info) {
354
    case CURLINFO_TOTAL_TIME_T:
355
    case CURLINFO_NAMELOOKUP_TIME_T:
356
    case CURLINFO_CONNECT_TIME_T:
357
    case CURLINFO_APPCONNECT_TIME_T:
358
    case CURLINFO_PRETRANSFER_TIME_T:
359
    case CURLINFO_STARTTRANSFER_TIME_T:
360
    case CURLINFO_REDIRECT_TIME_T:
361
    case CURLINFO_SPEED_DOWNLOAD_T:
362
    case CURLINFO_SPEED_UPLOAD_T:
363
      *param_offt = (curl_off_t)val;
364
      return CURLE_OK;
365
    default:
366
      break;
367
    }
368
  }
369
#endif
370
0
  switch(info) {
371
0
  case CURLINFO_FILETIME_T:
372
0
    *param_offt = (curl_off_t)data->info.filetime;
373
0
    break;
374
0
  case CURLINFO_SIZE_UPLOAD_T:
375
0
    *param_offt = data->progress.uploaded;
376
0
    break;
377
0
  case CURLINFO_SIZE_DOWNLOAD_T:
378
0
    *param_offt = data->progress.downloaded;
379
0
    break;
380
0
  case CURLINFO_SPEED_DOWNLOAD_T:
381
0
    *param_offt = data->progress.dlspeed;
382
0
    break;
383
0
  case CURLINFO_SPEED_UPLOAD_T:
384
0
    *param_offt = data->progress.ulspeed;
385
0
    break;
386
0
  case CURLINFO_CONTENT_LENGTH_DOWNLOAD_T:
387
0
    *param_offt = (data->progress.flags & PGRS_DL_SIZE_KNOWN)?
388
0
      data->progress.size_dl:-1;
389
0
    break;
390
0
  case CURLINFO_CONTENT_LENGTH_UPLOAD_T:
391
0
    *param_offt = (data->progress.flags & PGRS_UL_SIZE_KNOWN)?
392
0
      data->progress.size_ul:-1;
393
0
    break;
394
0
   case CURLINFO_TOTAL_TIME_T:
395
0
    *param_offt = data->progress.timespent;
396
0
    break;
397
0
  case CURLINFO_NAMELOOKUP_TIME_T:
398
0
    *param_offt = data->progress.t_nslookup;
399
0
    break;
400
0
  case CURLINFO_CONNECT_TIME_T:
401
0
    *param_offt = data->progress.t_connect;
402
0
    break;
403
0
  case CURLINFO_APPCONNECT_TIME_T:
404
0
    *param_offt = data->progress.t_appconnect;
405
0
    break;
406
0
  case CURLINFO_PRETRANSFER_TIME_T:
407
0
    *param_offt = data->progress.t_pretransfer;
408
0
    break;
409
0
  case CURLINFO_STARTTRANSFER_TIME_T:
410
0
    *param_offt = data->progress.t_starttransfer;
411
0
    break;
412
0
  case CURLINFO_REDIRECT_TIME_T:
413
0
    *param_offt = data->progress.t_redirect;
414
0
    break;
415
0
  case CURLINFO_RETRY_AFTER:
416
0
    *param_offt = data->info.retry_after;
417
0
    break;
418
0
  case CURLINFO_XFER_ID:
419
0
    *param_offt = data->id;
420
0
    break;
421
0
  case CURLINFO_CONN_ID:
422
0
    *param_offt = data->conn?
423
0
                  data->conn->connection_id : data->state.recent_conn_id;
424
0
    break;
425
0
  default:
426
0
    return CURLE_UNKNOWN_OPTION;
427
0
  }
428
429
0
  return CURLE_OK;
430
0
}
431
432
static CURLcode getinfo_double(struct Curl_easy *data, CURLINFO info,
433
                               double *param_doublep)
434
0
{
435
#ifdef DEBUGBUILD
436
  char *timestr = getenv("CURL_TIME");
437
  if(timestr) {
438
    unsigned long val = strtol(timestr, NULL, 10);
439
    switch(info) {
440
    case CURLINFO_TOTAL_TIME:
441
    case CURLINFO_NAMELOOKUP_TIME:
442
    case CURLINFO_CONNECT_TIME:
443
    case CURLINFO_APPCONNECT_TIME:
444
    case CURLINFO_PRETRANSFER_TIME:
445
    case CURLINFO_STARTTRANSFER_TIME:
446
    case CURLINFO_REDIRECT_TIME:
447
    case CURLINFO_SPEED_DOWNLOAD:
448
    case CURLINFO_SPEED_UPLOAD:
449
      *param_doublep = (double)val;
450
      return CURLE_OK;
451
    default:
452
      break;
453
    }
454
  }
455
#endif
456
0
  switch(info) {
457
0
  case CURLINFO_TOTAL_TIME:
458
0
    *param_doublep = DOUBLE_SECS(data->progress.timespent);
459
0
    break;
460
0
  case CURLINFO_NAMELOOKUP_TIME:
461
0
    *param_doublep = DOUBLE_SECS(data->progress.t_nslookup);
462
0
    break;
463
0
  case CURLINFO_CONNECT_TIME:
464
0
    *param_doublep = DOUBLE_SECS(data->progress.t_connect);
465
0
    break;
466
0
  case CURLINFO_APPCONNECT_TIME:
467
0
    *param_doublep = DOUBLE_SECS(data->progress.t_appconnect);
468
0
    break;
469
0
  case CURLINFO_PRETRANSFER_TIME:
470
0
    *param_doublep = DOUBLE_SECS(data->progress.t_pretransfer);
471
0
    break;
472
0
  case CURLINFO_STARTTRANSFER_TIME:
473
0
    *param_doublep = DOUBLE_SECS(data->progress.t_starttransfer);
474
0
    break;
475
0
  case CURLINFO_SIZE_UPLOAD:
476
0
    *param_doublep = (double)data->progress.uploaded;
477
0
    break;
478
0
  case CURLINFO_SIZE_DOWNLOAD:
479
0
    *param_doublep = (double)data->progress.downloaded;
480
0
    break;
481
0
  case CURLINFO_SPEED_DOWNLOAD:
482
0
    *param_doublep = (double)data->progress.dlspeed;
483
0
    break;
484
0
  case CURLINFO_SPEED_UPLOAD:
485
0
    *param_doublep = (double)data->progress.ulspeed;
486
0
    break;
487
0
  case CURLINFO_CONTENT_LENGTH_DOWNLOAD:
488
0
    *param_doublep = (data->progress.flags & PGRS_DL_SIZE_KNOWN)?
489
0
      (double)data->progress.size_dl:-1;
490
0
    break;
491
0
  case CURLINFO_CONTENT_LENGTH_UPLOAD:
492
0
    *param_doublep = (data->progress.flags & PGRS_UL_SIZE_KNOWN)?
493
0
      (double)data->progress.size_ul:-1;
494
0
    break;
495
0
  case CURLINFO_REDIRECT_TIME:
496
0
    *param_doublep = DOUBLE_SECS(data->progress.t_redirect);
497
0
    break;
498
499
0
  default:
500
0
    return CURLE_UNKNOWN_OPTION;
501
0
  }
502
503
0
  return CURLE_OK;
504
0
}
505
506
static CURLcode getinfo_slist(struct Curl_easy *data, CURLINFO info,
507
                              struct curl_slist **param_slistp)
508
0
{
509
0
  union {
510
0
    struct curl_certinfo *to_certinfo;
511
0
    struct curl_slist    *to_slist;
512
0
  } ptr;
513
514
0
  switch(info) {
515
0
  case CURLINFO_SSL_ENGINES:
516
0
    *param_slistp = Curl_ssl_engines_list(data);
517
0
    break;
518
0
  case CURLINFO_COOKIELIST:
519
0
    *param_slistp = Curl_cookie_list(data);
520
0
    break;
521
0
  case CURLINFO_CERTINFO:
522
    /* Return the a pointer to the certinfo struct. Not really an slist
523
       pointer but we can pretend it is here */
524
0
    ptr.to_certinfo = &data->info.certs;
525
0
    *param_slistp = ptr.to_slist;
526
0
    break;
527
0
  case CURLINFO_TLS_SESSION:
528
0
  case CURLINFO_TLS_SSL_PTR:
529
0
    {
530
0
      struct curl_tlssessioninfo **tsip = (struct curl_tlssessioninfo **)
531
0
                                          param_slistp;
532
0
      struct curl_tlssessioninfo *tsi = &data->tsi;
533
0
#ifdef USE_SSL
534
0
      struct connectdata *conn = data->conn;
535
0
#endif
536
537
0
      *tsip = tsi;
538
0
      tsi->backend = Curl_ssl_backend();
539
0
      tsi->internals = NULL;
540
541
0
#ifdef USE_SSL
542
0
      if(conn && tsi->backend != CURLSSLBACKEND_NONE) {
543
0
        tsi->internals = Curl_ssl_get_internals(data, FIRSTSOCKET, info, 0);
544
0
      }
545
0
#endif
546
0
    }
547
0
    break;
548
0
  default:
549
0
    return CURLE_UNKNOWN_OPTION;
550
0
  }
551
552
0
  return CURLE_OK;
553
0
}
554
555
static CURLcode getinfo_socket(struct Curl_easy *data, CURLINFO info,
556
                               curl_socket_t *param_socketp)
557
0
{
558
0
  switch(info) {
559
0
  case CURLINFO_ACTIVESOCKET:
560
0
    *param_socketp = Curl_getconnectinfo(data, NULL);
561
0
    break;
562
0
  default:
563
0
    return CURLE_UNKNOWN_OPTION;
564
0
  }
565
566
0
  return CURLE_OK;
567
0
}
568
569
CURLcode Curl_getinfo(struct Curl_easy *data, CURLINFO info, ...)
570
0
{
571
0
  va_list arg;
572
0
  long *param_longp = NULL;
573
0
  double *param_doublep = NULL;
574
0
  curl_off_t *param_offt = NULL;
575
0
  const char **param_charp = NULL;
576
0
  struct curl_slist **param_slistp = NULL;
577
0
  curl_socket_t *param_socketp = NULL;
578
0
  int type;
579
0
  CURLcode result = CURLE_UNKNOWN_OPTION;
580
581
0
  if(!data)
582
0
    return CURLE_BAD_FUNCTION_ARGUMENT;
583
584
0
  va_start(arg, info);
585
586
0
  type = CURLINFO_TYPEMASK & (int)info;
587
0
  switch(type) {
588
0
  case CURLINFO_STRING:
589
0
    param_charp = va_arg(arg, const char **);
590
0
    if(param_charp)
591
0
      result = getinfo_char(data, info, param_charp);
592
0
    break;
593
0
  case CURLINFO_LONG:
594
0
    param_longp = va_arg(arg, long *);
595
0
    if(param_longp)
596
0
      result = getinfo_long(data, info, param_longp);
597
0
    break;
598
0
  case CURLINFO_DOUBLE:
599
0
    param_doublep = va_arg(arg, double *);
600
0
    if(param_doublep)
601
0
      result = getinfo_double(data, info, param_doublep);
602
0
    break;
603
0
  case CURLINFO_OFF_T:
604
0
    param_offt = va_arg(arg, curl_off_t *);
605
0
    if(param_offt)
606
0
      result = getinfo_offt(data, info, param_offt);
607
0
    break;
608
0
  case CURLINFO_SLIST:
609
0
    param_slistp = va_arg(arg, struct curl_slist **);
610
0
    if(param_slistp)
611
0
      result = getinfo_slist(data, info, param_slistp);
612
0
    break;
613
0
  case CURLINFO_SOCKET:
614
0
    param_socketp = va_arg(arg, curl_socket_t *);
615
0
    if(param_socketp)
616
0
      result = getinfo_socket(data, info, param_socketp);
617
0
    break;
618
0
  default:
619
0
    break;
620
0
  }
621
622
0
  va_end(arg);
623
624
0
  return result;
625
0
}