Skip to content

Instantly share code, notes, and snippets.

View bagder's full-sized avatar
🥌
You're absolutely right

Daniel Stenberg bagder

🥌
You're absolutely right
View GitHub Profile
@bagder
bagder / maxage-conn.c
Created June 17, 2019 08:34
verify that libcurl's MAXAGE_CONN option behaves
#include <stdio.h>
#include <unistd.h>
#include <curl/curl.h>
int main(void)
{
CURL *curl;
CURLcode res;
curl = curl_easy_init();
@bagder
bagder / maxage-sharedconn.c
Created June 17, 2019 09:54
test CURLOPT_MAXAGE_CONN with shared connections
#include <stdio.h>
#include <unistd.h>
#include <curl/curl.h>
int main(void)
{
CURL *curl;
CURLcode res;
CURLSH *shobject = curl_share_init();
/***************************************************************************
Attempt to reproduce https://github.com/curl/curl/issues/4043
***************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* somewhat unix-specific */
#include <sys/time.h>
@bagder
bagder / 4043-end-properly.c
Created June 24, 2019 13:02
more 4043 attempts
#include <string.h>
#include <curl/curl.h>
#include <assert.h>
#include <unistd.h>
fd_set wfds;
fd_set rfds;
struct timeval tv;
int maxfd = 0;
@bagder
bagder / authors-over-time.pl
Created August 9, 2019 06:10
script to extra git authors (per year)
#!/usr/bin/perl
my @a = `git log --use-mailmap --reverse --pretty=fuller --no-color --date=short --decorate=full | egrep "^(Author|CommitDate):"`;
my $c=1;
my $year=1999;
for(@a) {
chomp;
my $line = $_;
if(/^CommitDate: (.*)/) {
if($1 =~ /^(\d\d\d\d)/) {
@bagder
bagder / tinycurl.sh
Last active February 9, 2026 11:15
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 \
@bagder
bagder / log.txt
Last active August 19, 2019 21:13
ngtcp2 segfault
$ gdb --args ./src/curl --http3 https://fb.mvfst.net:4433/ --trace-ascii -
run
Starting program: /home/daniel/src/curl/src/curl --http3 https://fb.mvfst.net:4433/ --trace-ascii -
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
== Info: STATE: INIT => CONNECT handle 0x55555574a118; line 1368 (connection #-5000)
== Info: Added connection 0. The cache now contains 1 members
== Info: STATE: CONNECT => WAITRESOLVE handle 0x55555574a118; line 1409 (connection #0)
== Info: Trying 34.226.207.118:4433...
== Info: Connect socket 4 over QUIC to 34.226.207.118:4433
@bagder
bagder / http3.php
Last active July 26, 2023 14:33
HTTP/3 with PHP/CURL
if (!defined('CURL_HTTP_VERSION_3')) {
define('CURL_HTTP_VERSION_3', 30);
}
$ch = curl_init("https://cloudflare-quic.com/");
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_3);
curl_exec($ch);
@bagder
bagder / recipe.md
Last active August 23, 2019 21:16
HTTP/3 callback post problem with ngtcp2 backend

Description

I have to two test setups, one that sends the entire POST body in one go, and another that sends 44 bytes, one byte at a time.

I just can't get test 2 to send me any h3 response at all from the cloudflare server.

Test branch

curl git master (as of 0a5d28fa2ec, merged Aug 23, 2019)

@bagder
bagder / 22-pics.md
Last active February 20, 2020 09:20
22 pictures for curl's 22nd birthday

22 images showing 22 years of curl development

  1. Number of lines of code
  2. Number of contributors
  3. Daniel's share of total commits
  4. Daniel's share per year
  5. Number of command line options
  6. Number of lines in docs/
  7. Number of supported protocols
  8. Number of HTTP versions