10.2.2 Notes about HTTPS and FTPS file access

CFITSIO depends upon the availability of the libcurl library in order to perform HTTPS/FTPS file access. (This should be the development version of the library, as it contains the curl.h header file required by the CFITSIO code.) The CFITSIO 'configure' script will search for this library on your system, and if it finds it it will automatically be incorporated into the build.

Note that if you have this library package on your system, you will also have the 'curl-config' executable. You can run the 'curl-config' executable with various options to learn more about the features of your libcurl installation.

If the CFITSIO 'configure' succeeded in finding a usable libcurl, you will see the flag '-DCFITSIO_HAVE_CURL=1' in the CFITSIO Makefile and in the compilation output. If 'configure' is unable to find a usable libcurl, CFITSIO will still build but it won't have HTTPS/FTPS capability.

The libcurl package is normally included as part of Xcode on Macs. However on Linux platforms you may need to manually install it. This can be easily done on Ubuntu Linux using the 'apt get' command to retrieve the libcurl4-openssl-dev or the libcurl4-gnutls-dev packages.

When accessing a file with HTTPS or FTPS, the default CFITSIO behavior is to attempt to verify both the host name and the SSL certificate. If it cannot, it will still perform the file access but will issue a warning to the terminal window.

The user can override this behavior to force CFITSIO to only allow file transfers when the host name and SSL certificate have been successfully verified. This is done by setting the CFITSIO_VERIFY_HTTPS environment variable to 'True'. ie. in a csh shell:


the default setting for this is 'False'.

CFITSIO has 3 functions which apply specifically to HTTPS/FTPS access: fits_init_https, fits_cleanup_https, and fits_verbose_https. It is recommended that you call the init and cleanup functions near the beginning and end of your program respectively. For more information about these functions, please see the 'FITS File Access Routines' section in the preceding chapter ('Specialized CFITSIO Interface Routines').