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 / h2-paused.md
Last active February 17, 2020 13:31
An h2 pausing and window size quirk

Test app

We use nghttp2's auto handling of window sizes.

Start out with window size set to 500K and we do two h2 streams (multiple megabytes) over a single connection from a local server.

  1. The first stream (1) is paused as soon as data arrives.
  2. The second stream (3) goes through and when it is done, unpauses the stream 1 transfer.
@bagder
bagder / common-libcurl-mistakes.md
Last active March 27, 2020 13:45
A list of common mistakes when using libcurl

Common libcurl mistakes

I'm planning a talk (video) on this topic and here I'm collecting the most common mistakes we've seen reported, discussed and revealed in recent years. What other mistakes do you see happen repeatedly?

  1. Skipping the documentation!
  2. Failure to check return codes
  3. Forgetting the verbose option
  4. There's a global init function
    • that isn't thread-safe
@bagder
bagder / 4919.patch
Created April 7, 2020 09:16
take two for 4919
From 0376e727e813a76ddd034d23bfe6b9ee4fece452 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Mon, 6 Apr 2020 00:02:13 +0200
Subject: [PATCH] http: fix EAGAIN handling when sending huge request
---
lib/http.c | 2 +-
lib/transfer.c | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
@bagder
bagder / logfile.txt
Created April 20, 2020 06:24
test 358 torture fail
test 0358...[HTTPS GET translated by alt-svc lookup to HTTP/2 GET]
237 functions to make fail
valgrind ERROR ==2932677== 72 (40 direct, 32 indirect) bytes in 1 blocks are definitely lost in loss record 2 of 3
==2932677== at 0x4838B65: calloc (vg_replace_malloc.c:762)
==2932677== by 0x166D77: curl_dbg_calloc (memdebug.c:205)
==2932677== by 0x154482: Curl_add_buffer_init (http.c:1136)
==2932677== by 0x1575FF: Curl_http (http.c:2575)
==2932677== by 0x170E56: multi_do (multi.c:1380)
==2932677== by 0x171E8A: multi_runsingle (multi.c:1854)
==2932677== by 0x172FEE: curl_multi_perform (multi.c:2363)
@bagder
bagder / logfile.txt
Created April 22, 2020 09:46
gcc-10 -fanalyze complaint on version.c
CC libcurl_la-version.lo
version.c: In function ‘curl_version’:
version.c:216:16: warning: use of uninitialized value ‘<unknown>’ [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
216 | size_t n = strlen(src[j]);
| ^~~~~~~~~~~~~~
‘curl_version’: events 1-9
|
| 215 | for(j = 0; j < i; j++) {
| | ^~~
| | |
@bagder
bagder / run-httpsproxy.sh
Created May 13, 2020 08:37
run stunnel in front of the HTTP proxy to make you a HTTPS proxy
#!/bin/sh
cat <<EOF | stunnel -fd 0
cert = $HOME/src/curl/tests/stunnel.pem
pid = `pwd`/stunnel.pid
foreground = yes
output = https-proxy.log
[https-proxy]
connect = 127.0.0.1:80
accept = 127.0.0.1:8843
@bagder
bagder / pidfile.patch
Created June 5, 2020 20:59
patch to fix armv7 test server crash
diff --git a/tests/server/util.c b/tests/server/util.c
index 75f3cb1b6..414d7194f 100644
--- a/tests/server/util.c
+++ b/tests/server/util.c
@@ -288,11 +288,11 @@ int write_pidfile(const char *filename)
*/
pid += 65536;
#endif
fprintf(pidfile, "%" CURL_FORMAT_CURL_OFF_T "\n", pid);
fclose(pidfile);
@bagder
bagder / test360.diff
Created October 5, 2020 05:53
fix for jfuller's test360
--- data/test360~ 2020-10-05 07:44:59.291501064 +0200
+++ data/test360 2020-10-05 07:51:34.882694526 +0200
@@ -44,7 +44,7 @@
CURL_ALTSVC_HTTP="yeah"
</setenv>
<command>
---http2 --alt-svc "log/altsvc-360" "http://%HOSTIP:%HTTPSPORT/360" "http://%HOSTIP:%HTTPSPORT/360"
+--http2 --alt-svc "log/altsvc-360" "http://%HOSTIP:%HTTP2PORT/360" "http://%HOSTIP:%HTTP2PORT/360"
</command>
@bagder
bagder / valgrind.patch
Created October 15, 2020 16:07
valgrind.supp fix for zstd
diff --git a/tests/valgrind.supp b/tests/valgrind.supp
index 10b07314a..4aaeac5b4 100644
--- a/tests/valgrind.supp
+++ b/tests/valgrind.supp
@@ -1,5 +1,13 @@
+{
+ zstd_decompression-1.3.3
+ Memcheck:cond
+ fun:ZSTD_decompressStream
+ obj:/usr/lib/x86_64-linux-gnu/libzstd.so.1.3.3
@bagder
bagder / http.log
Created January 21, 2021 13:37
test server response
HTTP/1.1 200 OK
Date: Thu, 21 Jan 2021 13:35:13 GMT
Server: Apache/2.4.46 (Debian)
Upgrade: h2c
Connection: Upgrade
Last-Modified: Fri, 20 May 2016 19:39:55 GMT
ETag: "20000000-5334b41606420"
Accept-Ranges: bytes
Content-Length: 536870912