cURL support for Perfect.


Get Involed with Perfect!

Star Perfect On Github Stack Overflow Follow Perfect on Twitter Join the Perfect Slack

Swift 3.0 Platforms OS X | Linux License Apache PerfectlySoft Twitter Slack Status

cURL support for Perfect

This project provides a Swift wrapper around the libcurl.

This package builds with Swift Package Manager and is part of the Perfect project. It was written to be stand-alone and so does not require PerfectLib or any other components.

Ensure you have installed and activated the latest Swift 3.0 tool chain.


We are transitioning to using JIRA for all bugs and support related issues, therefore the GitHub issues has been disabled.

If you find a mistake, bug, or any other helpful suggestion you'd like to make on the docs please head over to and raise it.

A comprehensive list of open issues can be found at

Example usage:

func testCURLAsync() {
    let url = ""
    let curl = CURL(url: url)
    // set an option
    let _ = curl.setOption(CURLOPT_SSL_VERIFYPEER, int: 0)
    // check the url
    XCTAssert(curl.url == url)
    // perform the request
    curl.perform {
        code, header, body in
        // check the result code, http response code, header and body bytes
        XCTAssert(0 == code, "Request error code \(code)")
        let response = curl.responseCode
        XCTAssert(response == 200, "\(response)")
        XCTAssert(header.count > 0)
        XCTAssert(body.count > 0)

Linux Build Notes

Ensure that you have installed libcurl.

sudo apt-get install libcurl4-openssl-dev


Add this project as a dependency in your Package.swift file.

.Package(url: "", majorVersion: 2, minor: 0)

Further Information

For more information on the Perfect project, please visit


  • Swift Tools 3.1.0
View More Packages from this Author


Last updated: Thu Mar 23 2023 04:03:06 GMT-0500 (GMT-05:00)