• Stars
    star
    698
  • Rank 64,612 (Top 2 %)
  • Language
    Rust
  • License
    MIT License
  • Created almost 7 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The practical HTTP client that is fun to use.

Isahc

Say hello to Isahc (pronounced like Isaac), the practical HTTP client that is fun to use.

Formerly known as chttp.

Crates.io Documentation License Minimum supported Rust version Crates.io downloads Maintenance Build codecov

Key features

  • Full support for HTTP/1.1 and HTTP/2.
  • Configurable request timeouts, redirect policies, Unix sockets, and many more settings.
  • Offers an ergonomic synchronous API as well as a runtime-agnostic asynchronous API with support for async/await.
  • Fully asynchronous core, with incremental reading and writing of request and response bodies and connection multiplexing.
  • Sessions and cookie persistence.
  • Automatic request cancellation on drop.
  • Uses the http crate as an interface for requests and responses.

What is Isahc?

Isahc is an acronym that stands for Incredible Streaming Asynchronous HTTP Client, and as the name implies, is an asynchronous HTTP client for the Rust language. It uses libcurl as an HTTP engine inside, and provides an easy-to-use API on top that integrates with Rust idioms.

No, who is Isahc?

Oh, you mean Isahc the dog! He's an adorable little Siberian husky who loves to play fetch with webservers every day and has a very cURLy tail. He shares a name with the project and acts as the project's mascot.

You can pet him all day if you like, he doesn't mind. Though, he prefers it if you pet him in a standards-compliant way!

Documentation

Please check out the documentation for details on what Isahc can do and how to use it. To get you started, here is a really simple, complete example that spits out the response body from https://example.org:

use isahc::prelude::*;

fn main() -> Result<(), isahc::Error> {
    // Send a GET request and wait for the response headers.
    // Must be `mut` so we can read the response body.
    let mut response = isahc::get("https://example.org")?;

    // Print some basic info about the response to standard output.
    println!("Status: {}", response.status());
    println!("Headers: {:#?}", response.headers());

    // Read the response body as text into a string and print it.
    print!("{}", response.text()?);

    Ok(())
}

Click here for documentation on the latest version. You can also click here for built documentation from the latest unreleased master build.

Getting help

Need some help with something Isahc-related? Ask a question on our discussions page, where we are happy to try and answer your questions!

Installation

Install via Cargo by adding to your Cargo.toml file:

[dependencies]
isahc = "1.7"

Minimum supported Rust version

The minimum supported Rust version (or MSRV) for Isahc is stable Rust 1.46 or greater, meaning we only guarantee that Isahc will compile if you use a rustc version of at least 1.46. It might compile with older versions but that could change at any time.

This version is explicitly tested in CI and may only be bumped in new minor versions. Any changes to the supported minimum version will be called out in the release notes.

Project goals

  • Create an ergonomic and innovative HTTP client API that is easy for beginners to use, and flexible for advanced uses.
  • Provide a high-level wrapper around libcurl.
  • Maintain a lightweight dependency tree and small binary footprint.
  • Provide additional client features that may be optionally compiled in.

Non-goals:

  • Support for protocols other than HTTP.
  • Alternative engines besides libcurl. Other projects are better suited for this.

Why use Isahc and not X?

Isahc provides an easy-to-use, flexible, and idiomatic Rust API that makes sending HTTP requests a breeze. The goal of Isahc is to make the easy way also provide excellent performance and correctness for common use cases.

Isahc uses libcurl under the hood to handle the HTTP protocol and networking. Using curl as an engine for an HTTP client is a great choice for a few reasons:

  • It is a stable, actively developed, and very popular library.
  • It is well-supported on a diverse list of platforms.
  • The HTTP protocol has a lot of unexpected gotchas across different servers, and curl has been around the block long enough to handle many of them.
  • It is well optimized and offers the ability to implement asynchronous requests.

Safe Rust bindings to libcurl are provided by the curl crate, which you can use yourself if you want to use curl directly. Isahc delivers a lot of value on top of vanilla curl, by offering a simpler, more idiomatic API and doing the hard work of turning the powerful multi interface into a futures-based API.

When would you not use Isahc?

Not every library is perfect for every use-case. While Isahc strives to be a full-featured and general-purpose HTTP client that should work well for many projects, there are a few scenarios that Isahc is not well suited for:

  • Tiny binaries: If you are creating an application where tiny binary size is a key priority, you might find Isahc to be too large for you. While Isahc's dependencies are carefully curated and a number of features can be disabled, Isahc's core feature set includes things like async which does have some file size overhead. You might find something like ureq more suitable.
  • WebAssembly support: If your project needs to be able to be compiled to WebAssembly, then Isahc will probably not work for you. Instead you might like an HTTP client that supports multiple backends such as Surf.

Sponsors

Special thanks to sponsors of my open-source work!

License

This project's source code and documentation are licensed under the MIT license. See the LICENSE file for details.

The Isahc logo and related assets are licensed under a Creative Commons Attribution 4.0 International License. See LICENSE-CC-BY for details.

More Repositories

1

slack-client

A better Slack client, with RTM API support.
PHP
193
star
2

castaway

Safe, zero-cost downcasting for limited compile-time specialization.
Rust
145
star
3

sluice

Asynchronous byte buffers and pipes for concurrent I/O programming.
Rust
98
star
4

rote

Automate everything.
Rust
67
star
5

threadfin

A thread pool for running multiple tasks on a configurable group of threads.
Rust
50
star
6

tmux-zen

Achieve true terminal zen with tmux and Oh My Fish.
Shell
45
star
7

docker-swarm-deploy-action

Deploy a stack to a remote Docker swarm.
Shell
37
star
8

retest

Command-line regular expression tester
Rust
30
star
9

riptide

The Riptide Programming Language: Shell scripting redesigned.
Rust
29
star
10

stability

Rust API stability attributes for the rest of us.
Rust
26
star
11

slackyboy

A helpful, programmable chat bot for Slack
PHP
22
star
12

dockerfiles

Repository for my public Docker images.
Dockerfile
21
star
13

mathpad

Interactive scratchpad calculator for VS Code
TypeScript
21
star
14

atom-gtk-dark-theme

Toggles the dark theme variant for Atom windows on GTK+3
JavaScript
18
star
15

dotfiles

Dotfiles for my personal UNIX-based machines
Shell
16
star
16

windows-registry

A small library for accessing and manipulating the Windows registry.
PHP
14
star
17

eguikit

A small library of assorted, reusable widgets for egui.
Rust
14
star
18

wakeful

Utilities to aid implementing wakers and working with tasks.
Rust
13
star
19

evflow

Main Evflow event loop library
PHP
12
star
20

respk

Manage resource files using a fast, custom open format designed especially for use in games.
Rust
12
star
21

pushbullet-gnome

[ABANDONED] GNOME extension for sending and receiving Pushbullet notifications
JavaScript
9
star
22

edmunds-sdk

An implementation of an Edmunds SDK for PHP.
PHP
8
star
23

git-pocket

Save and sync uncommitted changes in a working directory
Shell
6
star
24

naru

Cross platform, intuitive file archiver command.
Rust
6
star
25

blog

My personal website and blog.
HTML
5
star
26

appimagezip

Rust implementation of the AppImage specification that uses Zip as the backing image file system.
Rust
5
star
27

fmbq-timer

Timer app tailored for Free Methodist Bible Quizzing
TypeScript
5
star
28

sqs-pull

Move AWS SQS messages from one queue to another quickly with filtering
Rust
4
star
29

walrus

A lightweight compiler for the Decaf programming language
C
4
star
30

robo-ftp

[ABANDONED] FTP(S) task for Robo
PHP
3
star
31

imagen

A random image generator.
Rust
3
star
32

autoclipper

An automatic Evernote article clipper that accepts an article URL
PHP
3
star
33

environ

Simple package for getting environment and platform information. [Unmaintained]
PHP
3
star
34

clogger

Simple console logger that is configurable at runtime for command line apps.
Rust
2
star
35

plugin-termux

Make Termux less broken
Shell
2
star
36

libnntp

Asynchronous implementation of the NNTP news protocol
PHP
2
star
37

android-wakelock

Safe and ergonomic Rust bindings to the Android WakeLock API
Rust
2
star
38

switchbox

[ABANDONED] Quick and extensible configuration library that can load and save in JSON, YAML, INI, and more
PHP
2
star
39

evernote-gnome-client

[ABANDONED] Client for Evernote Web that integrates nicely with GNOME
JavaScript
2
star
40

ingots

Ingots provides a standard interface between Rust web applications and web servers.
Rust
2
star
41

ddns-update

A small utility to update a DNS record with a public IP
C#
1
star
42

cs460-chat-server

Chat server
Python
1
star
43

websnip

Self-hosted web service to save any web article as a clean PDF
Rust
1
star
44

smplinfo

Command-line WAV file metadata reader/writer for samplers
Rust
1
star
45

sagebind

Experiment (ab)using GitHub Actions for syncing social media data
JavaScript
1
star