SlideShare a Scribd company logo
1 of 41
Download to read offline
@bagder
curl with rust
Daniel Stenberg – January 27, 2022
Daniel Stenberg
@bagder
https://daniel.haxx.se
Daniel Stenberg
@bagder
@bagder
Agenda
curl is C
Stable API and ABI
Backends
Making an HTTP backend
… and other backends
Challenges
Current status
Future
@bagder
@bagder
Q&A
Immediately
following
@bagder
@bagder
curl is C
@bagder
@bagder
When curl started there
was no choice
C89
Only now alternatives
appear for libraries
C keeps curl extremely
portable
C code will remain a build
option
@bagder
@bagder
Stable API and ABI
@bagder
@bagder
Reliable and predictable
libcurl is forwards API compatible
libcurl does not break the ABI – ever
libcurl exists everywhere
Compiled code from 2001 still works
The armored front we can’t tamper with
@bagder
10,000,000,000
installations
@bagder
Vulnerabilities
50% of past curl vulnerabilities are “C mistakes”
Memory-safe languages could help
Also doing other things to reduce risk
The future is more Internet-connected devices
@bagder
@bagder
Backends and third parties
@bagder
@bagder
Backends
(Build-time) selectable alternative
implementations
@bagder
@bagder
Backends
Backends are selectable and deselectable
Often platform dependent
Often use 3rd
party libraries
… which can differ in features, licensing and maturity
Can be done in other programming languages
The internal APIs are never exposed externally
@bagder
third party world map February 2022
I/O layer
URL parser libidn2
winidn
HTTP
TLS
OpenSSL
gskit
mbedTLS
wolfSSL
Schannel
Secure
Transport
GnuTLS
NSS
boringssl
libressl
AmiSSL
SFTP SCP LDAP
WinLDAP
OpenLDAP
RTMP
librtmp
Name resolver c-ares
compression
libz brotli
cookies
libpsl
IMAP SMTP POP3
HTTP/2
nghttp2
authentication
winsspi Heimdal
MIT
kerberos
HTTP/3
quiche
ngtcp2
HTTP/1
SSH
wolfSSH
libssh2
libssh
@bagder
BearSSL
nghttp3
zstd
FTP
Hyper
FTPS IMAPS POP3S SMBS SMTPS
GOPHERS HTTPS LDAPS RTMPS
libgsasl
rustls
@bagder
Many different backends
IDN
Name resolving
TLS
SSH
HTTP/3
HTTP content encoding
HTTP
@bagder
@bagder
The making of an HTTP backend
libcurl API
Generic transfer engine
HTTP
Creating and reusing connections
@bagder
HTTP involves a lot of things
Authentication
Creating a set of headers
Proxy specifics
Parsing content headers
Parsing transfer headers
HTTP/1 and HTTP/2 transmission
@bagder
Hyper is transmission-focused
Authentication
Creating a set of headers
Proxy specifics
Parsing content headers
Parsing transfer headers
HTTP/1 and HTTP/2 transmission
@bagder
Splitting up HTTP
Authentication
Creating a set of headers
Proxy specifics
Parsing content headers
Parsing transfer headers
HTTP/1 and HTTP/2 transmission
Parsing transfer headers
HTTP/1 and HTTP/2 transmission
Hyper Built-in + nghttp2
@bagder
build curl with hyper
$ ./configure --with-hyper=...
https://github.com/curl/curl/blob/master/docs/HYPER.md
@bagder
HTTP backends
libcurl API
Generic transfer engine
High-level HTTP
Creating and reusing connections
built-in
HTTP/1
nghttp2
HTTP/2
Hyper
HTTP/1 + 2
@bagder
libcurl backends application
HTTP
API
libcurl
Public API
Hyper
built-in
nghttp2
@bagder
rustls
@bagder
@bagder
rustls provides a C API in rustls-ffi
curl builds with different TLS libraries
build curl to use rustls-ffi
… profit!
another TLS backend
@bagder
quiche
@bagder
@bagder
quiche provides a C API
curl builds with different QUIC libraries
build curl to use quiche
… profit!
another HTTP/3 and QUIC backend
@bagder
libcurl backends
libidn2
winidn
Hyper
built-in
threaded
c-ares
sync
quiche
ngtcp2 +
nghttp3
libssh2
wolfSSH
libssh
BearSSL
Gskit
GnuTLS
mbedSSL NSS
OpenSSL Schannel
wolfSSL
Secure Transport
rustls
application
HTTP
API
TLS
API
IDN API
SSH API
HTTP/3
API
Resolver
API
Public API
libcurl
Content encoding
API
brotli
zstd
zlib
= just one
= one or more
nghttp2
@bagder
libcurl backends
libidn2
winidn
Hyper
built-in
threaded
c-ares
sync
quiche
ngtcp2 +
nghttp3
libssh2
wolfSSH
libssh
BearSSL
Gskit
GnuTLS
mbedSSL NSS
OpenSSL Schannel
wolfSSL
Secure Transport
rustls
application
HTTP
API
TLS
API
IDN API
SSH API
HTTP/3
API
Resolver
API
Public API
libcurl
Content encoding
API
brotli
zstd
zlib
= just one
= one or more
nghttp2
@bagder
Challenges
@bagder
@bagder
Using hyper
First user of the Hyper C API
Headers-only, no C docs yet
Splitting HTTP for built-in + Hyper took thinking
Keeping behavior with different API paradigms
Memory leaks are tricky to hunt down
Rust use is mostly seamless (and not the first use)
@bagder
@bagder
Using rustls
Early user of rustls-ffi
Headers-only, no C docs yet
Mostly done by others so easier for me!
The TLS backend situation was already mature
Not yet feature-complete
@bagder
@bagder
Using quiche
Early user of quiche
Headers-only, no C docs yet
Messy TLS situation (for QUIC)
Not yet feature-complete
@bagder
@bagder
Using rust
Updating rust and cargo “all the time”
Suitable for replacing one-component-at-a-time
I am a total rust rookie
@bagder
@bagder
Current status
@bagder
@bagder
Status
Using curl and Hyper from main dev branches
“experimental” and opt-in
HTTP/1 and HTTP/2
HTTP and HTTPS (TLS backend agnostic)
HTTP(S) proxies
Identical HTTP requests over the wire
98% test case success rate (~800 test cases)
@bagder
@bagder
Status now
hyper
“experimental” and opt-in
HTTP/1 and HTTP/2
HTTP and HTTPS (TLS backend agnostic)
HTTP(S) proxies
Identical HTTP requests over the wire
98% test case success rate (~800 test cases)
@bagder
rustls
“experimental” and opt-in
12 test cases disabled
no IP-addresses in cert?
quiche
“experimental” and opt-in
no HTTP/3 tests yet
QUIC and HTTP/3 are not “there” yet anyway
rust in curl
works perfectly well
depends entirely on the C APIs
… which are under-documented still
no stable OOM == panic (will abort)
You can
help!
@bagder
Future
@bagder
@bagder
Coming up
Make all test cases succeed
Verify libcurl API corner cases
Encourage users and developers to use rust backends
Provide binary builds
Enable by default?
More rust components?
More backend flavors?
@bagder
more curl!
Commercial curl support!
@bagder
Daniel Stenberg
@bagder
https://daniel.haxx.se/
Thank you!
Questions?

More Related Content

What's hot

Brkmpl 2333
Brkmpl 2333Brkmpl 2333
Brkmpl 2333
ronsito
 
Ciena Overview
Ciena OverviewCiena Overview
Ciena Overview
Szen Chew
 

What's hot (20)

Introducing the elastic 8.0 release a new era of speed, scale, relevance, and...
Introducing the elastic 8.0 release a new era of speed, scale, relevance, and...Introducing the elastic 8.0 release a new era of speed, scale, relevance, and...
Introducing the elastic 8.0 release a new era of speed, scale, relevance, and...
 
Cycloudのストレージ紹介と歴史
Cycloudのストレージ紹介と歴史Cycloudのストレージ紹介と歴史
Cycloudのストレージ紹介と歴史
 
NOSQLの基礎知識(講義資料)
NOSQLの基礎知識(講義資料)NOSQLの基礎知識(講義資料)
NOSQLの基礎知識(講義資料)
 
AnyConnect Secure Mobility
AnyConnect Secure MobilityAnyConnect Secure Mobility
AnyConnect Secure Mobility
 
『 イドラ ファンタシースターサーガ 』を支える GCP | Google Cloud INSIDE Games & Apps
『 イドラ ファンタシースターサーガ 』を支える GCP | Google Cloud INSIDE Games & Apps 『 イドラ ファンタシースターサーガ 』を支える GCP | Google Cloud INSIDE Games & Apps
『 イドラ ファンタシースターサーガ 』を支える GCP | Google Cloud INSIDE Games & Apps
 
VPNはもう卒業!FIDO2認証で次世代リモートアクセス
VPNはもう卒業!FIDO2認証で次世代リモートアクセスVPNはもう卒業!FIDO2認証で次世代リモートアクセス
VPNはもう卒業!FIDO2認証で次世代リモートアクセス
 
Brkmpl 2333
Brkmpl 2333Brkmpl 2333
Brkmpl 2333
 
事例で学ぶApache Cassandra
事例で学ぶApache Cassandra事例で学ぶApache Cassandra
事例で学ぶApache Cassandra
 
URLLC for 5G and Beyond: Physical, MAC, and Network Solutions
URLLC for 5G and Beyond: Physical, MAC, and Network SolutionsURLLC for 5G and Beyond: Physical, MAC, and Network Solutions
URLLC for 5G and Beyond: Physical, MAC, and Network Solutions
 
オフラインWebアプリケーションのつくりかた
オフラインWebアプリケーションのつくりかたオフラインWebアプリケーションのつくりかた
オフラインWebアプリケーションのつくりかた
 
Spanner から GKE、Spinnaker、そして SRE まで、コロプラが今挑戦していること[Google Cloud INSIDE Games ...
Spanner から GKE、Spinnaker、そして SRE まで、コロプラが今挑戦していること[Google Cloud INSIDE Games ...Spanner から GKE、Spinnaker、そして SRE まで、コロプラが今挑戦していること[Google Cloud INSIDE Games ...
Spanner から GKE、Spinnaker、そして SRE まで、コロプラが今挑戦していること[Google Cloud INSIDE Games ...
 
NetflixにおけるPresto/Spark活用事例
NetflixにおけるPresto/Spark活用事例NetflixにおけるPresto/Spark活用事例
NetflixにおけるPresto/Spark活用事例
 
マルチクラウド時代に求められる ID & シングル・サインオン(SSO)基盤とは?
マルチクラウド時代に求められる ID & シングル・サインオン(SSO)基盤とは?マルチクラウド時代に求められる ID & シングル・サインオン(SSO)基盤とは?
マルチクラウド時代に求められる ID & シングル・サインオン(SSO)基盤とは?
 
Transform your enterprise branch with secure sd-wan
Transform your enterprise branch with secure sd-wanTransform your enterprise branch with secure sd-wan
Transform your enterprise branch with secure sd-wan
 
How to build high performance 5G networks with vRAN and O-RAN
How to build high performance 5G networks with vRAN and O-RANHow to build high performance 5G networks with vRAN and O-RAN
How to build high performance 5G networks with vRAN and O-RAN
 
Breaking the Edge -- A Journey Through Cloud, Edge and Fog Computing
Breaking the Edge -- A Journey Through Cloud, Edge and Fog ComputingBreaking the Edge -- A Journey Through Cloud, Edge and Fog Computing
Breaking the Edge -- A Journey Through Cloud, Edge and Fog Computing
 
ZigBee/IEEE802.15.4について調べてみた
ZigBee/IEEE802.15.4について調べてみたZigBee/IEEE802.15.4について調べてみた
ZigBee/IEEE802.15.4について調べてみた
 
AWS_reInforce_2022_reCap_Ja.pdf
AWS_reInforce_2022_reCap_Ja.pdfAWS_reInforce_2022_reCap_Ja.pdf
AWS_reInforce_2022_reCap_Ja.pdf
 
Vpn site to site
Vpn site to siteVpn site to site
Vpn site to site
 
Ciena Overview
Ciena OverviewCiena Overview
Ciena Overview
 

Similar to Curl with rust

Legacy of Void*
Legacy of Void*Legacy of Void*
Legacy of Void*
Adam Crain
 

Similar to Curl with rust (20)

HTTP/3 in curl - curl up 2022
HTTP/3 in curl - curl up 2022HTTP/3 in curl - curl up 2022
HTTP/3 in curl - curl up 2022
 
curl roadmap 2020
curl roadmap 2020curl roadmap 2020
curl roadmap 2020
 
mastering the curl command line.pdf
mastering the curl command line.pdfmastering the curl command line.pdf
mastering the curl command line.pdf
 
HTTP/3 is next generation HTTP
HTTP/3 is next generation HTTPHTTP/3 is next generation HTTP
HTTP/3 is next generation HTTP
 
mastering libcurl part 1
mastering libcurl part 1mastering libcurl part 1
mastering libcurl part 1
 
REST in Peace. Long live gRPC!
REST in Peace. Long live gRPC!REST in Peace. Long live gRPC!
REST in Peace. Long live gRPC!
 
HTTP/3 in curl 2020
HTTP/3 in curl 2020HTTP/3 in curl 2020
HTTP/3 in curl 2020
 
HTTP/3 in curl
HTTP/3 in curlHTTP/3 in curl
HTTP/3 in curl
 
Legacy of Void*
Legacy of Void*Legacy of Void*
Legacy of Void*
 
Build DynamoDB-Compatible Apps with Python
Build DynamoDB-Compatible Apps with PythonBuild DynamoDB-Compatible Apps with Python
Build DynamoDB-Compatible Apps with Python
 
Kernel load-balancing for Docker containers using IPVS
Kernel load-balancing for Docker containers using IPVSKernel load-balancing for Docker containers using IPVS
Kernel load-balancing for Docker containers using IPVS
 
Scalable Cloud-Native Masterless Puppet, with PuppetDB and Bolt, Craig Watson...
Scalable Cloud-Native Masterless Puppet, with PuppetDB and Bolt, Craig Watson...Scalable Cloud-Native Masterless Puppet, with PuppetDB and Bolt, Craig Watson...
Scalable Cloud-Native Masterless Puppet, with PuppetDB and Bolt, Craig Watson...
 
Cloud native IPC for Microservices Workshop @ Containerdays 2022
Cloud native IPC for Microservices Workshop @ Containerdays 2022Cloud native IPC for Microservices Workshop @ Containerdays 2022
Cloud native IPC for Microservices Workshop @ Containerdays 2022
 
Docker cloud hybridation & orchestration
Docker cloud hybridation & orchestrationDocker cloud hybridation & orchestration
Docker cloud hybridation & orchestration
 
Scientific Computing @ Fred Hutch
Scientific Computing @ Fred HutchScientific Computing @ Fred Hutch
Scientific Computing @ Fred Hutch
 
HTTP/3 for everyone
HTTP/3 for everyoneHTTP/3 for everyone
HTTP/3 for everyone
 
Breaking Bad Habits with GitLab CI
Breaking Bad Habits with GitLab CIBreaking Bad Habits with GitLab CI
Breaking Bad Habits with GitLab CI
 
Scale out, with Kubernetes (k8s)
Scale out, with Kubernetes (k8s)Scale out, with Kubernetes (k8s)
Scale out, with Kubernetes (k8s)
 
REST in Peace. Long live gRPC!
REST in Peace. Long live gRPC!REST in Peace. Long live gRPC!
REST in Peace. Long live gRPC!
 
Communication Amongst Microservices: Kubernetes, Istio, and Spring Cloud with...
Communication Amongst Microservices: Kubernetes, Istio, and Spring Cloud with...Communication Amongst Microservices: Kubernetes, Istio, and Spring Cloud with...
Communication Amongst Microservices: Kubernetes, Istio, and Spring Cloud with...
 

More from Daniel Stenberg

More from Daniel Stenberg (20)

curl security by Daniel Stenberg from curl up 2024
curl security by Daniel Stenberg from curl up 2024curl security by Daniel Stenberg from curl up 2024
curl security by Daniel Stenberg from curl up 2024
 
rust in curl by Daniel Stenberg from- curl up 2024
rust in curl by Daniel Stenberg from- curl up 2024rust in curl by Daniel Stenberg from- curl up 2024
rust in curl by Daniel Stenberg from- curl up 2024
 
trurl 2024 by Daniel Stenberg from curl up 2024
trurl 2024 by Daniel Stenberg from curl up 2024trurl 2024 by Daniel Stenberg from curl up 2024
trurl 2024 by Daniel Stenberg from curl up 2024
 
curl future 2024 by Daniel Stenberg from curl up 2024
curl future 2024 by Daniel Stenberg from curl up 2024curl future 2024 by Daniel Stenberg from curl up 2024
curl future 2024 by Daniel Stenberg from curl up 2024
 
The state of curl 2024 by Daniel Stenberg from curl up 2024
The state of curl 2024 by Daniel Stenberg from curl up 2024The state of curl 2024 by Daniel Stenberg from curl up 2024
The state of curl 2024 by Daniel Stenberg from curl up 2024
 
mastering libcurl part 2
mastering libcurl part 2mastering libcurl part 2
mastering libcurl part 2
 
curl - openfourm europe.pdf
curl - openfourm europe.pdfcurl - openfourm europe.pdf
curl - openfourm europe.pdf
 
curl experiments - curl up 2022
curl experiments - curl up 2022curl experiments - curl up 2022
curl experiments - curl up 2022
 
curl security - curl up 2022
curl security - curl up 2022curl security - curl up 2022
curl security - curl up 2022
 
The state of curl 2022
The state of curl 2022The state of curl 2022
The state of curl 2022
 
Let me tell you about curl
Let me tell you about curlLet me tell you about curl
Let me tell you about curl
 
Getting started with libcurl
Getting started with libcurlGetting started with libcurl
Getting started with libcurl
 
Landing code in curl
Landing code in curlLanding code in curl
Landing code in curl
 
Testing curl for security
Testing curl for securityTesting curl for security
Testing curl for security
 
common mistakes when using libcurl
common mistakes when using libcurlcommon mistakes when using libcurl
common mistakes when using libcurl
 
The state of curl 2020
The state of curl 2020The state of curl 2020
The state of curl 2020
 
curl better
curl bettercurl better
curl better
 
HTTP/3, QUIC and streaming
HTTP/3, QUIC and streamingHTTP/3, QUIC and streaming
HTTP/3, QUIC and streaming
 
HTTP/3 over QUIC. All is new but still the same!
HTTP/3 over QUIC. All is new but still the same!HTTP/3 over QUIC. All is new but still the same!
HTTP/3 over QUIC. All is new but still the same!
 
Just curl it!
Just curl it!Just curl it!
Just curl it!
 

Recently uploaded

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Recently uploaded (20)

Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data PlatformLess Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data Science
 
Decarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational PerformanceDecarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational Performance
 
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfHow to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cf
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 

Curl with rust