CR2RE Pipeline Reference Manual 1.6.8
Functions
Download from the Internet.

This module contains functions to download information from the internet. It is based on libcurl (the multiprotocol file transfer library), a free and easy-to-use client-side URL transfer library. For detailed informations see https://curl.se/libcurl. More...

Functions

char * hdrl_download_url_to_buffer (const char *url, size_t *data_length)
 Downloads a url into a c data buffer.
 
cpl_error_code hdrl_download_url_to_file (const char *url, const char *filename)
 Downloads a url into a file on disc.
 

Detailed Description

This module contains functions to download information from the internet. It is based on libcurl (the multiprotocol file transfer library), a free and easy-to-use client-side URL transfer library. For detailed informations see https://curl.se/libcurl.

 ***************************************************************************
 *                                  _   _ ____  _
 *  Project                     ___| | | |  _ \| |
 *                             / __| | | | |_) | |
 *                            | (__| |_| |  _ <| |___
 *                             \___|\___/|_| \_\_____|
 *
 * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
 *
 * This software is licensed as described in the file COPYING, which
 * you should have received as part of this distribution. The terms
 * are also available at https://curl.se/docs/copyright.html.
 *
 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
 * copies of the Software, and permit persons to whom the Software is
 * furnished to do so, under the terms of the COPYING file.
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
 * KIND, either express or implied.
 *
 ***************************************************************************

Function Documentation

◆ hdrl_download_url_to_buffer()

char * hdrl_download_url_to_buffer ( const char *  url,
size_t *  data_length 
)

Downloads a url into a c data buffer.

Parameters
urlThe url to download from
data_lengthThe length of the downloaded data buffer
Returns
The downloaded data buffer or NULL in case of error.

For the supported protocols please see the https://curl.se/libcurl

Warning
This function is not threadsafe, to the extent that it may only be called from the main thread, with no other threads running. So as long as esorex or alike is not using threads it still may be called from within a recipe before the the recipe itself, or hdrl launches any additional threads.

Definition at line 160 of file hdrl_download.c.

◆ hdrl_download_url_to_file()

cpl_error_code hdrl_download_url_to_file ( const char *  url,
const char *  filename 
)

Downloads a url into a file on disc.

Parameters
urlThe url to download from
filenameThe name of the file where the url is downloaded
Returns
CPL_ERROR_NONE if everything is ok, an error code otherwise

For the supported protocols please see the https://curl.se/libcurl

Warning
This function is not threadsafe, to the extent that it may only be called from the main thread, with no other threads running. So as long as esorex or alike is not using threads it still may be called from within a recipe before the the recipe itself, or hdrl launches any additional threads.

Definition at line 276 of file hdrl_download.c.