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 / simple-doh.c
Created June 18, 2018 11:40
libcurl example using DOH
#include <stdio.h>
#include <curl/curl.h>
int main(void)
{
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
@bagder
bagder / 3324.c
Created December 7, 2018 08:28
Do 22 transfers using 20 parallel handles with libcurl's multi API, an attempt to reproduce curl issue 3324
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#ifndef WIN32
# include <unistd.h>
#endif
#include <curl/multi.h>
/*
* This is meant to do more transfers than total number of handles.
@bagder
bagder / FOSDEMgeddon.md
Last active January 28, 2025 14:01
FOSDEMgeddon, the game

FOSDEMgeddon

(The rules were originally created for FOSDEM 2019)

  • You get one point for each FOSDEM talk you mean to attend but cannot enter because there is a FULL sign on the door.

  • The FOSDEM talk must be a talk in the official program to qualify for points.

  • You are not allowed to hunt down such rooms with the purpose of finding FULL

@bagder
bagder / parallel-tests.md
Last active March 5, 2019 15:37
Parallel curl testing by preloading networking functions

Run curl tests in parallel

preload networking functions

Running real servers for the test suite is tricky when doing curl tests since it involves actual networking. TCP ports are scarce and the TCP stack adds behavior that makes it hard for us to control exactly how data flows to/from the client

Simulate the network

@bagder
bagder / stringify.c
Created February 22, 2019 08:35
convert a given define to a string
#include <stdio.h>
#define xstr(s) str(s)
#define str(s) #s
int main(void)
{
printf("%s\n", xstr(STRING));
return 0;
}
@bagder
bagder / issue-3602.c
Last active February 24, 2019 15:20
An attempt to reproduce curl issue 3602 with a sample written in C
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2019, Daniel Stenberg, <[email protected]>, et al.
*
* This software is licensed as described in the file COPYING, which
@bagder
bagder / cookie.patch
Created February 26, 2019 15:15
flush cookies fix
@bagder
bagder / issue-3629.c
Created February 28, 2019 15:59
source example trying to reproduce curl issue #3629
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2019, Daniel Stenberg, <[email protected]>, et al.
*
* This software is licensed as described in the file COPYING, which
@bagder
bagder / quinq.c
Created March 27, 2019 22:01
attempt to reproduce a POST issue
#include <curl/curl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#define POSTFILE "debugit"
#define synurl "localhost"
#define ctimeout 10L
int main (void)
@bagder
bagder / indent-sample.c
Created May 28, 2019 21:21
this is how I'd do it
{
IF_NAMETOINDEX_FN pIfNameToIndex =
CURLX_FUNCTION_CAST(IF_NAMETOINDEX_FN,
(GetProcAddress(s_hIpHlpApiDll, "if_nametoindex")));
}