Skip to content

Instantly share code, notes, and snippets.

View bagder's full-sized avatar
⌨️
mostly typos

Daniel Stenberg bagder

⌨️
mostly typos
View GitHub Profile
@bagder
bagder / h3-server-howto.md
Last active March 10, 2024 21:13
Setup an HTTP/3 test server

Setup a local HTTP/3 test server

... to toy with and run curl against it.

This is not advice on how to run anything in production. This is for development and experimenting.

Preqreqs

An existing local HTTP/1.1 server that hosts files. Preferably also a few huge ones.

@bagder
bagder / curl-in-two-hours-agenda.md
Last active February 17, 2024 12:08
Master curl in two hours. A video course by Daniel

The idea is to make a two and a half hour (give or take) video course explaining and detailing curl, the command line tool. How it works, how to use it, from the basics to some more advanced uses. This will be done by Daniel Stenberg, founder and lead developer of the curl project.

The recording and live-stream is scheduled for August 31, 2023. In the US morning and Euro evening.

See blog post for details.

The project (10 min)

@bagder
bagder / tinycurl.sh
Last active January 9, 2024 08:57
build a tiny curl (on Linux)
#!/bin/sh
export CFLAGS="-Os -ffunction-sections -fdata-sections -fno-unwind-tables -fno-asynchronous-unwind-tables -flto"
export LDFLAGS="-Wl,-s -Wl,-Bsymbolic -Wl,--gc-sections"
./configure \
--disable-cookies \
--disable-crypto-auth \
--disable-dict \
--disable-file \
--disable-ftp \
--disable-gopher \
#include <stdio.h>
#include <stdlib.h>
#include <poll.h>
#include <uv.h>
static void on_close(uv_handle_t* handle);
static void on_connect(uv_connect_t* req, int status);
static void on_write(uv_write_t* req, int status);
static void on_alloc(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf)
@bagder
bagder / scorecard.md
Created December 7, 2023 12:09
perf-testing #12468

icing-cw-part5+h2

scoring h2
TLS Handshake
  curl.se...ipv4...ipv6...ok.
  google.com...ipv4...ipv6...ok.
  cloudflare.com...ipv4...ipv6...ok.
  nghttp2.org...ipv4...ipv6...ok.
httpd downloads
@bagder
bagder / urlgen.pl
Last active November 22, 2023 22:27
perl script to generate URL variations for URL parser tests and benchmarks
#!/usr/bin/perl
# [scheme][divider][userinfo][hostname][port number][path][query][fragment]
my $num = $ARGV[0];
sub get_part
{
my ($part, $g) = @_;
my @a;
@bagder
bagder / compare.md
Last active November 17, 2023 16:01
URL parsers compared. libcurl vs ada
@bagder
bagder / speedada.cpp
Last active November 17, 2023 15:55
measure ada URL parsing the same way speedparse does
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
@bagder
bagder / speedparse.c
Created November 17, 2023 14:58
measure libcurl URL parsing speed
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
@bagder
bagder / scheme2num.c
Last active November 17, 2023 10:46
generate a perfect hash for curl scheme matching
#include <stdio.h>
#include <curl/curl.h>
struct detail {
const char *n;
const char *ifdef;
};
static const struct detail scheme[] = {
{"dict", "#ifndef CURL_DISABLE_DICT" },