Skip to content

🥌 HTTP client library for mulle-objc

Notifications You must be signed in to change notification settings

MulleWeb/MulleCurl

Repository files navigation

MulleCurl

🥌 HTTP client library for mulle-objc

Uses libcurl to GET and POST NSData from URLs. It uses the easy interface of libcurl. The curl library is compiled for HTTP(S) only.

Written in and for mulle-objc.

Note

On linux ensure, that openssl is available: sudo apt-get install libssl-dev (debian/ubuntu)

Release Version Release Notes
Mulle kybernetiK tag Build Status RELEASENOTES

Usage

This example fetches a text file and prints it out.

#import <MulleCurl/MulleCurl.h>

#include <stdio.h>

static NSString   *URL = @"https://www.mulle-kybernetik.com/weblog/2019/mulle_objc_0_16_release.html";


int  main( void)
{
   MulleCurl   *curl;
   NSData      *data;
   NSError     *error;

   curl = [[MulleCurl new] autorelease];
   [curl setOptions:@{
                       @"CURLOPT_SSL_VERIFYPEER": @(NO),
                       @"CURLOPT_SSL_VERIFYHOST": @(NO)
                     }];
   data = [curl dataWithContentsOfURLWithString:URL];
   if( ! data)
   {
      error = [NSError mulleExtractError];
      fprintf( stderr, "%s\n", [[error description] UTF8String]);
      return( 1);
   }

   printf( "%.*s", (int) [data length], [data bytes]);
   return( 0);
}

Notable is the simple interface. Instead of -dataWithContentsOfURL:error: it is just -dataWithContentsOfURLWithString:. You don't have to wrap the string into an NSURL and the NSError can be retrieved later if desired.

MulleWeb adds a NSURL interface for convenience.

You are here

Overview

Add

Use mulle-sde to add MulleCurl to your project:

mulle-sde add github:MulleWeb/MulleCurl

Install

Install with mulle-sde

Use mulle-sde to build and install MulleCurl and all dependencies:

mulle-sde install --prefix /usr/local \
   https://github.com//MulleCurl/archive/latest.tar.gz

Manual Installation

Install the requirements:

Requirements Description
openssl
curl
MulleFoundationBase 🧱 MulleFoundationBase amalgamates Foundations projects
MulleZlib 🐘 Zlib compression for mulle-objc
mulle-objc-list 📒 Lists mulle-objc runtime information contained in executables.

Download the latest tar or zip archive and unpack it.

Install MulleCurl into /usr/local with cmake:

cmake -B build \
      -DCMAKE_INSTALL_PREFIX=/usr/local \
      -DCMAKE_PREFIX_PATH=/usr/local \
      -DCMAKE_BUILD_TYPE=Release &&
cmake --build build --config Release &&
cmake --install build --config Release

Platforms and Compilers

All platforms and compilers supported by mulle-c11.

Author

Nat! for Mulle kybernetiK