Skip to content

Instantly share code, notes, and snippets.

@bagder
Last active October 23, 2023 07:44
Show Gist options
  • Save bagder/1ac99885ab2bbe23543744caa46631d7 to your computer and use it in GitHub Desktop.
Save bagder/1ac99885ab2bbe23543744caa46631d7 to your computer and use it in GitHub Desktop.
A two to three hour libcurl video tutorial

This is going to become a live-stream video "class" done by Daniel in November 2023. Also recorded for Youtube of course.

The exact date/time is pending. This is the tentative agenda. What are you missing from here?

Mastering libcurl

  • The project
  • Getting libcurl
  • API and ABI
  • Architecture
  • Transfers
  • Basics
  • Using
  • Share API
  • TLS
  • Proxies
  • HTTP
  • HTTP header API
  • URL API
  • WebSocket
  • Future

getting it

  • installing
  • building
  • debugging
  • free support
  • paid support

API and ABI

  • compatibility
  • versions
  • the API is for C
  • header files
  • compiling libcurl programs

Architecture

  • C89
  • backends
  • everything is non-blocking

transfers

  • content ignorant
  • URLs
  • callbacks
  • different versions/installs

libcurl basics

  • global init
  • easy handles
  • options
  • easy perform
  • multi handles
  • multi perform
  • multi_socket

Using libcurl

  • verbose debug function tracing
  • curl_version / curl_version_info
  • persistent connections
  • multiplexing
  • Downloads
    • Storing downloads
    • Compression
    • Multiple downloads
    • Maximum file size
    • Resuming and ranges
  • Uploads
    • Multiple uploads
  • Transfer controls
    • Stop slow transfers
    • Rate limiting
  • Connections
    • Name resolve tricks
    • Connection timeout
    • Network interface
    • Local port number
    • Keep alive
  • Timeouts
  • .netrc
  • return codes
  • SCP and SFTP
  • Reading email
  • Sending email
  • --libcurl
  • post transfer meta-data
  • caches
  • some words on threads
  • error handling with libcurl

Share API

  • sharing data between easy handles

TLS

  • ciphers
  • enable TLS
  • verifying server certificates custom checks
  • client certificates
  • on TLS backends
  • SSLKEYLOGFILE

Proxies

  • Proxy type
  • HTTP proxy
  • SOCKS proxy (tor)
  • Authentication
  • HTTPS proxy
  • Proxy environment variables
  • Proxy headers

HTTP

  • Authentication
  • Ranges
  • HTTP versions
  • Conditionals
  • HTTP POST data with callback
  • Multipart formpost
  • Redirects
  • Modify the HTTP request
  • HTTP PUT
  • Cookies
  • Alternative Services
  • HSTS
  • HTTP/2
  • HTTP/3

HTTP header API

  • get specific header field after transfer
  • iterate over many headers

URL API

  • Parse a URL
  • extract components
  • update components
  • URL encoding/decoding
  • IDN encoding/decoding
  • redirects

WebSocket

@bagder
Copy link
Author

bagder commented Sep 30, 2023

Feedback from Mastodon/email to get into the presentation:

  • handling libcurl in threads
  • practical tips on real-world error handling, as often this is hand-waved away during tutorials and blog posts
  • when scripting curl becomes so cumbersome that switching to writing libcurl apps makes more sense instead
  • best companion libs to write async libcurl apps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment