Skip to content

Instantly share code, notes, and snippets.

🎩
typos and segfaults

Daniel Stenberg bagder

🎩
typos and segfaults
Block or report user

Report or block bagder

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bagder
bagder / recipe.md
Last active Aug 23, 2019
HTTP/3 callback post problem with ngtcp2 backend
View recipe.md

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 / http3.php
Last active Aug 20, 2019
HTTP/3 with PHP/CURL
View http3.php
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 / log.txt
Last active Aug 19, 2019
ngtcp2 segfault
View log.txt
$ 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 / tinycurl.sh
Created Aug 19, 2019
build a tiny curl (on Linux)
View tinycurl.sh
#!/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 / authors-over-time.pl
Created Aug 9, 2019
script to extra git authors (per year)
View authors-over-time.pl
#!/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)/) {
View 4043-end-properly.c
#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;
View 4043.c
/***************************************************************************
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 / maxage-sharedconn.c
Created Jun 17, 2019
test CURLOPT_MAXAGE_CONN with shared connections
View maxage-sharedconn.c
#include <stdio.h>
#include <unistd.h>
#include <curl/curl.h>
int main(void)
{
CURL *curl;
CURLcode res;
CURLSH *shobject = curl_share_init();
@bagder
bagder / maxage-conn.c
Created Jun 17, 2019
verify that libcurl's MAXAGE_CONN option behaves
View maxage-conn.c
#include <stdio.h>
#include <unistd.h>
#include <curl/curl.h>
int main(void)
{
CURL *curl;
CURLcode res;
curl = curl_easy_init();
@bagder
bagder / indent-sample.c
Created May 28, 2019
this is how I'd do it
View indent-sample.c
{
IF_NAMETOINDEX_FN pIfNameToIndex =
CURLX_FUNCTION_CAST(IF_NAMETOINDEX_FN,
(GetProcAddress(s_hIpHlpApiDll, "if_nametoindex")));
}
You can’t perform that action at this time.