Coverage Report

Created: 2025-10-10 06:31

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/PROJ/curl/lib/file.c
Line
Count
Source
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
#ifndef CURL_DISABLE_FILE
28
29
#ifdef HAVE_NETINET_IN_H
30
#include <netinet/in.h>
31
#endif
32
#ifdef HAVE_NETDB_H
33
#include <netdb.h>
34
#endif
35
#ifdef HAVE_ARPA_INET_H
36
#include <arpa/inet.h>
37
#endif
38
#ifdef HAVE_NET_IF_H
39
#include <net/if.h>
40
#endif
41
#ifdef HAVE_SYS_IOCTL_H
42
#include <sys/ioctl.h>
43
#endif
44
45
#ifdef HAVE_SYS_PARAM_H
46
#include <sys/param.h>
47
#endif
48
49
#ifdef HAVE_SYS_TYPES_H
50
#include <sys/types.h>
51
#endif
52
53
#ifdef HAVE_DIRENT_H
54
#include <dirent.h>
55
#endif
56
57
#include "urldata.h"
58
#include <curl/curl.h>
59
#include "progress.h"
60
#include "sendf.h"
61
#include "escape.h"
62
#include "file.h"
63
#include "speedcheck.h"
64
#include "getinfo.h"
65
#include "multiif.h"
66
#include "transfer.h"
67
#include "url.h"
68
#include "parsedate.h" /* for the week day and month names */
69
#include "curlx/fopen.h"
70
#include "curlx/warnless.h"
71
#include "curl_range.h"
72
73
/* The last 2 #include files should be in this order */
74
#include "curl_memory.h"
75
#include "memdebug.h"
76
77
#if defined(_WIN32) || defined(MSDOS)
78
#define DOS_FILESYSTEM 1
79
#elif defined(__amigaos4__)
80
#define AMIGA_FILESYSTEM 1
81
#endif
82
83
/* meta key for storing protocol meta at easy handle */
84
0
#define CURL_META_FILE_EASY   "meta:proto:file:easy"
85
86
struct FILEPROTO {
87
  char *path; /* the path we operate on */
88
  char *freepath; /* pointer to the allocated block we must free, this might
89
                     differ from the 'path' pointer */
90
  int fd;     /* open file descriptor to read from! */
91
};
92
93
/*
94
 * Forward declarations.
95
 */
96
97
static CURLcode file_do(struct Curl_easy *data, bool *done);
98
static CURLcode file_done(struct Curl_easy *data,
99
                          CURLcode status, bool premature);
100
static CURLcode file_connect(struct Curl_easy *data, bool *done);
101
static CURLcode file_disconnect(struct Curl_easy *data,
102
                                struct connectdata *conn,
103
                                bool dead_connection);
104
static CURLcode file_setup_connection(struct Curl_easy *data,
105
                                      struct connectdata *conn);
106
107
/*
108
 * FILE scheme handler.
109
 */
110
111
const struct Curl_handler Curl_handler_file = {
112
  "file",                               /* scheme */
113
  file_setup_connection,                /* setup_connection */
114
  file_do,                              /* do_it */
115
  file_done,                            /* done */
116
  ZERO_NULL,                            /* do_more */
117
  file_connect,                         /* connect_it */
118
  ZERO_NULL,                            /* connecting */
119
  ZERO_NULL,                            /* doing */
120
  ZERO_NULL,                            /* proto_pollset */
121
  ZERO_NULL,                            /* doing_pollset */
122
  ZERO_NULL,                            /* domore_pollset */
123
  ZERO_NULL,                            /* perform_pollset */
124
  file_disconnect,                      /* disconnect */
125
  ZERO_NULL,                            /* write_resp */
126
  ZERO_NULL,                            /* write_resp_hd */
127
  ZERO_NULL,                            /* connection_check */
128
  ZERO_NULL,                            /* attach connection */
129
  ZERO_NULL,                            /* follow */
130
  0,                                    /* defport */
131
  CURLPROTO_FILE,                       /* protocol */
132
  CURLPROTO_FILE,                       /* family */
133
  PROTOPT_NONETWORK | PROTOPT_NOURLQUERY /* flags */
134
};
135
136
137
static void file_cleanup(struct FILEPROTO *file)
138
0
{
139
0
  Curl_safefree(file->freepath);
140
0
  file->path = NULL;
141
0
  if(file->fd != -1) {
142
0
    close(file->fd);
143
0
    file->fd = -1;
144
0
  }
145
0
}
146
147
static void file_easy_dtor(void *key, size_t klen, void *entry)
148
0
{
149
0
  struct FILEPROTO *file = entry;
150
0
  (void)key;
151
0
  (void)klen;
152
0
  file_cleanup(file);
153
0
  free(file);
154
0
}
155
156
static CURLcode file_setup_connection(struct Curl_easy *data,
157
                                      struct connectdata *conn)
158
0
{
159
0
  struct FILEPROTO *filep;
160
0
  (void)conn;
161
  /* allocate the FILE specific struct */
162
0
  filep = calloc(1, sizeof(*filep));
163
0
  if(!filep ||
164
0
     Curl_meta_set(data, CURL_META_FILE_EASY, filep, file_easy_dtor))
165
0
    return CURLE_OUT_OF_MEMORY;
166
167
0
  return CURLE_OK;
168
0
}
169
170
/*
171
 * file_connect() gets called from Curl_protocol_connect() to allow us to
172
 * do protocol-specific actions at connect-time. We emulate a
173
 * connect-then-transfer protocol and "connect" to the file here
174
 */
175
static CURLcode file_connect(struct Curl_easy *data, bool *done)
176
0
{
177
0
  char *real_path;
178
0
  struct FILEPROTO *file = Curl_meta_get(data, CURL_META_FILE_EASY);
179
0
  int fd;
180
#ifdef DOS_FILESYSTEM
181
  size_t i;
182
  char *actual_path;
183
#endif
184
0
  size_t real_path_len;
185
0
  CURLcode result;
186
187
0
  if(!file)
188
0
    return CURLE_FAILED_INIT;
189
190
0
  if(file->path) {
191
    /* already connected.
192
     * the handler->connect_it() is normally only called once, but
193
     * FILE does a special check on setting up the connection which
194
     * calls this explicitly. */
195
0
    *done = TRUE;
196
0
    return CURLE_OK;
197
0
  }
198
199
0
  result = Curl_urldecode(data->state.up.path, 0, &real_path,
200
0
                          &real_path_len, REJECT_ZERO);
201
0
  if(result)
202
0
    return result;
203
204
#ifdef DOS_FILESYSTEM
205
  /* If the first character is a slash, and there is
206
     something that looks like a drive at the beginning of
207
     the path, skip the slash. If we remove the initial
208
     slash in all cases, paths without drive letters end up
209
     relative to the current directory which is not how
210
     browsers work.
211
212
     Some browsers accept | instead of : as the drive letter
213
     separator, so we do too.
214
215
     On other platforms, we need the slash to indicate an
216
     absolute pathname. On Windows, absolute paths start
217
     with a drive letter.
218
  */
219
  actual_path = real_path;
220
  if((actual_path[0] == '/') &&
221
      actual_path[1] &&
222
     (actual_path[2] == ':' || actual_path[2] == '|')) {
223
    actual_path[2] = ':';
224
    actual_path++;
225
    real_path_len--;
226
  }
227
228
  /* change path separators from '/' to '\\' for DOS, Windows and OS/2 */
229
  for(i = 0; i < real_path_len; ++i)
230
    if(actual_path[i] == '/')
231
      actual_path[i] = '\\';
232
    else if(!actual_path[i]) { /* binary zero */
233
      Curl_safefree(real_path);
234
      return CURLE_URL_MALFORMAT;
235
    }
236
237
  fd = curlx_open(actual_path, O_RDONLY | CURL_O_BINARY);
238
  file->path = actual_path;
239
#else
240
0
  if(memchr(real_path, 0, real_path_len)) {
241
    /* binary zeroes indicate foul play */
242
0
    Curl_safefree(real_path);
243
0
    return CURLE_URL_MALFORMAT;
244
0
  }
245
246
  #ifdef AMIGA_FILESYSTEM
247
  /*
248
   * A leading slash in an AmigaDOS path denotes the parent
249
   * directory, and hence we block this as it is relative.
250
   * Absolute paths start with 'volumename:', so we check for
251
   * this first. Failing that, we treat the path as a real Unix
252
   * path, but only if the application was compiled with -lunix.
253
   */
254
  fd = -1;
255
  file->path = real_path;
256
257
  if(real_path[0] == '/') {
258
    extern int __unix_path_semantics;
259
    if(strchr(real_path + 1, ':')) {
260
      /* Amiga absolute path */
261
      fd = curlx_open(real_path + 1, O_RDONLY);
262
      file->path++;
263
    }
264
    else if(__unix_path_semantics) {
265
      /* -lunix fallback */
266
      fd = curlx_open(real_path, O_RDONLY);
267
    }
268
  }
269
  #else
270
0
  fd = curlx_open(real_path, O_RDONLY);
271
0
  file->path = real_path;
272
0
  #endif
273
0
#endif
274
0
  free(file->freepath);
275
0
  file->freepath = real_path; /* free this when done */
276
277
0
  file->fd = fd;
278
0
  if(!data->state.upload && (fd == -1)) {
279
0
    failf(data, "Couldn't open file %s", data->state.up.path);
280
0
    file_done(data, CURLE_FILE_COULDNT_READ_FILE, FALSE);
281
0
    return CURLE_FILE_COULDNT_READ_FILE;
282
0
  }
283
0
  *done = TRUE;
284
285
0
  return CURLE_OK;
286
0
}
287
288
static CURLcode file_done(struct Curl_easy *data,
289
                          CURLcode status, bool premature)
290
0
{
291
0
  struct FILEPROTO *file = Curl_meta_get(data, CURL_META_FILE_EASY);
292
0
  (void)status;
293
0
  (void)premature;
294
295
0
  if(file)
296
0
    file_cleanup(file);
297
298
0
  return CURLE_OK;
299
0
}
300
301
static CURLcode file_disconnect(struct Curl_easy *data,
302
                                struct connectdata *conn,
303
                                bool dead_connection)
304
0
{
305
0
  (void)dead_connection;
306
0
  (void)conn;
307
0
  return file_done(data, CURLE_OK, FALSE);
308
0
}
309
310
#ifdef DOS_FILESYSTEM
311
#define DIRSEP '\\'
312
#else
313
0
#define DIRSEP '/'
314
#endif
315
316
static CURLcode file_upload(struct Curl_easy *data,
317
                            struct FILEPROTO *file)
318
0
{
319
0
  const char *dir = strchr(file->path, DIRSEP);
320
0
  int fd;
321
0
  int mode;
322
0
  CURLcode result = CURLE_OK;
323
0
  char *xfer_ulbuf;
324
0
  size_t xfer_ulblen;
325
0
  curl_off_t bytecount = 0;
326
0
  struct_stat file_stat;
327
0
  const char *sendbuf;
328
0
  bool eos = FALSE;
329
330
  /*
331
   * Since FILE: does not do the full init, we need to provide some extra
332
   * assignments here.
333
   */
334
335
0
  if(!dir)
336
0
    return CURLE_FILE_COULDNT_READ_FILE; /* fix: better error code */
337
338
0
  if(!dir[1])
339
0
    return CURLE_FILE_COULDNT_READ_FILE; /* fix: better error code */
340
341
0
  mode = O_WRONLY|O_CREAT|CURL_O_BINARY;
342
0
  if(data->state.resume_from)
343
0
    mode |= O_APPEND;
344
0
  else
345
0
    mode |= O_TRUNC;
346
347
#if (defined(ANDROID) || defined(__ANDROID__)) && \
348
  (defined(__i386__) || defined(__arm__))
349
  fd = curlx_open(file->path, mode, (mode_t)data->set.new_file_perms);
350
#else
351
0
  fd = curlx_open(file->path, mode, data->set.new_file_perms);
352
0
#endif
353
0
  if(fd < 0) {
354
0
    failf(data, "cannot open %s for writing", file->path);
355
0
    return CURLE_WRITE_ERROR;
356
0
  }
357
358
0
  if(data->state.infilesize != -1)
359
    /* known size of data to "upload" */
360
0
    Curl_pgrsSetUploadSize(data, data->state.infilesize);
361
362
  /* treat the negative resume offset value as the case of "-" */
363
0
  if(data->state.resume_from < 0) {
364
0
    if(fstat(fd, &file_stat)) {
365
0
      close(fd);
366
0
      failf(data, "cannot get the size of %s", file->path);
367
0
      return CURLE_WRITE_ERROR;
368
0
    }
369
0
    data->state.resume_from = (curl_off_t)file_stat.st_size;
370
0
  }
371
372
0
  result = Curl_multi_xfer_ulbuf_borrow(data, &xfer_ulbuf, &xfer_ulblen);
373
0
  if(result)
374
0
    goto out;
375
376
0
  while(!result && !eos) {
377
0
    size_t nread;
378
0
    ssize_t nwrite;
379
0
    size_t readcount;
380
381
0
    result = Curl_client_read(data, xfer_ulbuf, xfer_ulblen, &readcount, &eos);
382
0
    if(result)
383
0
      break;
384
385
0
    if(!readcount)
386
0
      break;
387
388
0
    nread = readcount;
389
390
    /* skip bytes before resume point */
391
0
    if(data->state.resume_from) {
392
0
      if((curl_off_t)nread <= data->state.resume_from) {
393
0
        data->state.resume_from -= nread;
394
0
        nread = 0;
395
0
        sendbuf = xfer_ulbuf;
396
0
      }
397
0
      else {
398
0
        sendbuf = xfer_ulbuf + data->state.resume_from;
399
0
        nread -= (size_t)data->state.resume_from;
400
0
        data->state.resume_from = 0;
401
0
      }
402
0
    }
403
0
    else
404
0
      sendbuf = xfer_ulbuf;
405
406
    /* write the data to the target */
407
0
    nwrite = write(fd, sendbuf, nread);
408
0
    if((size_t)nwrite != nread) {
409
0
      result = CURLE_SEND_ERROR;
410
0
      break;
411
0
    }
412
413
0
    bytecount += nread;
414
415
0
    Curl_pgrsSetUploadCounter(data, bytecount);
416
417
0
    if(Curl_pgrsUpdate(data))
418
0
      result = CURLE_ABORTED_BY_CALLBACK;
419
0
    else
420
0
      result = Curl_speedcheck(data, curlx_now());
421
0
  }
422
0
  if(!result && Curl_pgrsUpdate(data))
423
0
    result = CURLE_ABORTED_BY_CALLBACK;
424
425
0
out:
426
0
  close(fd);
427
0
  Curl_multi_xfer_ulbuf_release(data, xfer_ulbuf);
428
429
0
  return result;
430
0
}
431
432
/*
433
 * file_do() is the protocol-specific function for the do-phase, separated
434
 * from the connect-phase above. Other protocols merely setup the transfer in
435
 * the do-phase, to have it done in the main transfer loop but since some
436
 * platforms we support do not allow select()ing etc on file handles (as
437
 * opposed to sockets) we instead perform the whole do-operation in this
438
 * function.
439
 */
440
static CURLcode file_do(struct Curl_easy *data, bool *done)
441
0
{
442
  /* This implementation ignores the hostname in conformance with
443
     RFC 1738. Only local files (reachable via the standard file system)
444
     are supported. This means that files on remotely mounted directories
445
     (via NFS, Samba, NT sharing) can be accessed through a file:// URL
446
  */
447
0
  struct FILEPROTO *file = Curl_meta_get(data, CURL_META_FILE_EASY);
448
0
  CURLcode result = CURLE_OK;
449
0
  struct_stat statbuf; /* struct_stat instead of struct stat just to allow the
450
                          Windows version to have a different struct without
451
                          having to redefine the simple word 'stat' */
452
0
  curl_off_t expected_size = -1;
453
0
  bool size_known;
454
0
  bool fstated = FALSE;
455
0
  int fd;
456
0
  char *xfer_buf;
457
0
  size_t xfer_blen;
458
459
0
  *done = TRUE; /* unconditionally */
460
0
  if(!file)
461
0
    return CURLE_FAILED_INIT;
462
463
0
  if(data->state.upload)
464
0
    return file_upload(data, file);
465
466
  /* get the fd from the connection phase */
467
0
  fd = file->fd;
468
469
  /* VMS: This only works reliable for STREAMLF files */
470
0
  if(fstat(fd, &statbuf) != -1) {
471
0
    if(!S_ISDIR(statbuf.st_mode))
472
0
      expected_size = statbuf.st_size;
473
    /* and store the modification time */
474
0
    data->info.filetime = statbuf.st_mtime;
475
0
    fstated = TRUE;
476
0
  }
477
478
0
  if(fstated && !data->state.range && data->set.timecondition &&
479
0
     !Curl_meets_timecondition(data, data->info.filetime))
480
0
    return CURLE_OK;
481
482
0
  if(fstated) {
483
0
    time_t filetime;
484
0
    struct tm buffer;
485
0
    const struct tm *tm = &buffer;
486
0
    char header[80];
487
0
    int headerlen;
488
0
    static const char accept_ranges[]= { "Accept-ranges: bytes\r\n" };
489
0
    if(expected_size >= 0) {
490
0
      headerlen =
491
0
        curl_msnprintf(header, sizeof(header),
492
0
                       "Content-Length: %" FMT_OFF_T "\r\n", expected_size);
493
0
      result = Curl_client_write(data, CLIENTWRITE_HEADER, header, headerlen);
494
0
      if(result)
495
0
        return result;
496
497
0
      result = Curl_client_write(data, CLIENTWRITE_HEADER,
498
0
                                 accept_ranges, sizeof(accept_ranges) - 1);
499
0
      if(result != CURLE_OK)
500
0
        return result;
501
0
    }
502
503
0
    filetime = (time_t)statbuf.st_mtime;
504
0
    result = Curl_gmtime(filetime, &buffer);
505
0
    if(result)
506
0
      return result;
507
508
    /* format: "Tue, 15 Nov 1994 12:45:26 GMT" */
509
0
    headerlen =
510
0
      curl_msnprintf(header, sizeof(header),
511
0
                     "Last-Modified: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n",
512
0
                     Curl_wkday[tm->tm_wday ? tm->tm_wday-1 : 6],
513
0
                     tm->tm_mday,
514
0
                     Curl_month[tm->tm_mon],
515
0
                     tm->tm_year + 1900,
516
0
                     tm->tm_hour,
517
0
                     tm->tm_min,
518
0
                     tm->tm_sec);
519
0
    result = Curl_client_write(data, CLIENTWRITE_HEADER, header, headerlen);
520
0
    if(!result)
521
      /* end of headers */
522
0
      result = Curl_client_write(data, CLIENTWRITE_HEADER, "\r\n", 2);
523
0
    if(result)
524
0
      return result;
525
    /* set the file size to make it available post transfer */
526
0
    Curl_pgrsSetDownloadSize(data, expected_size);
527
0
    if(data->req.no_body)
528
0
      return CURLE_OK;
529
0
  }
530
531
  /* Check whether file range has been specified */
532
0
  result = Curl_range(data);
533
0
  if(result)
534
0
    return result;
535
536
  /* Adjust the start offset in case we want to get the N last bytes
537
   * of the stream if the filesize could be determined */
538
0
  if(data->state.resume_from < 0) {
539
0
    if(!fstated) {
540
0
      failf(data, "cannot get the size of file.");
541
0
      return CURLE_READ_ERROR;
542
0
    }
543
0
    data->state.resume_from += (curl_off_t)statbuf.st_size;
544
0
  }
545
546
0
  if(data->state.resume_from > 0) {
547
    /* We check explicitly if we have a start offset, because
548
     * expected_size may be -1 if we do not know how large the file is,
549
     * in which case we should not adjust it. */
550
0
    if(data->state.resume_from <= expected_size)
551
0
      expected_size -= data->state.resume_from;
552
0
    else {
553
0
      failf(data, "failed to resume file:// transfer");
554
0
      return CURLE_BAD_DOWNLOAD_RESUME;
555
0
    }
556
0
  }
557
558
  /* A high water mark has been specified so we obey... */
559
0
  if(data->req.maxdownload > 0)
560
0
    expected_size = data->req.maxdownload;
561
562
0
  if(!fstated || (expected_size <= 0))
563
0
    size_known = FALSE;
564
0
  else
565
0
    size_known = TRUE;
566
567
  /* The following is a shortcut implementation of file reading
568
     this is both more efficient than the former call to download() and
569
     it avoids problems with select() and recv() on file descriptors
570
     in Winsock */
571
0
  if(size_known)
572
0
    Curl_pgrsSetDownloadSize(data, expected_size);
573
574
0
  if(data->state.resume_from) {
575
0
    if(!S_ISDIR(statbuf.st_mode)) {
576
#if defined(__AMIGA__) || defined(__MINGW32CE__)
577
      if(data->state.resume_from !=
578
          lseek(fd, (off_t)data->state.resume_from, SEEK_SET))
579
#else
580
0
      if(data->state.resume_from !=
581
0
          lseek(fd, data->state.resume_from, SEEK_SET))
582
0
#endif
583
0
        return CURLE_BAD_DOWNLOAD_RESUME;
584
0
    }
585
0
    else {
586
0
      return CURLE_BAD_DOWNLOAD_RESUME;
587
0
    }
588
0
  }
589
590
0
  result = Curl_multi_xfer_buf_borrow(data, &xfer_buf, &xfer_blen);
591
0
  if(result)
592
0
    goto out;
593
594
0
  if(!S_ISDIR(statbuf.st_mode)) {
595
0
    while(!result) {
596
0
      ssize_t nread;
597
      /* Do not fill a whole buffer if we want less than all data */
598
0
      size_t bytestoread;
599
600
0
      if(size_known) {
601
0
        bytestoread = (expected_size < (curl_off_t)(xfer_blen-1)) ?
602
0
          curlx_sotouz(expected_size) : (xfer_blen-1);
603
0
      }
604
0
      else
605
0
        bytestoread = xfer_blen-1;
606
607
0
      nread = read(fd, xfer_buf, bytestoread);
608
609
0
      if(nread > 0)
610
0
        xfer_buf[nread] = 0;
611
612
0
      if(nread <= 0 || (size_known && (expected_size == 0)))
613
0
        break;
614
615
0
      if(size_known)
616
0
        expected_size -= nread;
617
618
0
      result = Curl_client_write(data, CLIENTWRITE_BODY, xfer_buf, nread);
619
0
      if(result)
620
0
        goto out;
621
622
0
      if(Curl_pgrsUpdate(data))
623
0
        result = CURLE_ABORTED_BY_CALLBACK;
624
0
      else
625
0
        result = Curl_speedcheck(data, curlx_now());
626
0
      if(result)
627
0
        goto out;
628
0
    }
629
0
  }
630
0
  else {
631
0
#ifdef HAVE_OPENDIR
632
0
    DIR *dir = opendir(file->path);
633
0
    struct dirent *entry;
634
635
0
    if(!dir) {
636
0
      result = CURLE_READ_ERROR;
637
0
      goto out;
638
0
    }
639
0
    else {
640
0
      while((entry = readdir(dir))) {
641
0
        if(entry->d_name[0] != '.') {
642
0
          result = Curl_client_write(data, CLIENTWRITE_BODY,
643
0
                   entry->d_name, strlen(entry->d_name));
644
0
          if(result)
645
0
            break;
646
0
          result = Curl_client_write(data, CLIENTWRITE_BODY, "\n", 1);
647
0
          if(result)
648
0
            break;
649
0
        }
650
0
      }
651
0
      closedir(dir);
652
0
    }
653
#else
654
    failf(data, "Directory listing not yet implemented on this platform.");
655
    result = CURLE_READ_ERROR;
656
#endif
657
0
  }
658
659
0
  if(Curl_pgrsUpdate(data))
660
0
    result = CURLE_ABORTED_BY_CALLBACK;
661
662
0
out:
663
0
  Curl_multi_xfer_buf_release(data, xfer_buf);
664
0
  return result;
665
0
}
666
667
#endif