Coverage Report

Created: 2025-10-30 06:17

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