Skip to content

Instantly share code, notes, and snippets.

View xquery's full-sized avatar

James Fuller xquery

View GitHub Profile
@xquery
xquery / gist:9a34041070679793886994296300da20
Created February 3, 2020 14:14
perf stat curl httpbin.org/get
# Samples: 27 of event 'cpu-clock:pppH'
# Event count (approx.): 6750000
#
# Overhead Command Shared Object Symbol
# ........ ....... ................... ..........................
#
7.41% curl [kernel.kallsyms] [k] arch_local_irq_enable
7.41% curl [kernel.kallsyms] [k] arch_local_irq_restore
7.41% curl ld-musl-x86_64.so.1 [.] _dlstart
3.70% curl [kernel.kallsyms] [k] __neigh_event_send
@xquery
xquery / gist:dcff4e5e295cb18001d1d5bffc6d3a56
Created February 4, 2020 17:14
declaring http3 victory
curl -v --http3 https://localhost:81
* Trying ::1:81...
* Immediate connect fail for ::1: Address not available
* Trying 127.0.0.1:81...
* Connect socket 5 over QUIC to 127.0.0.1:81
* QUIC handshake is completed
* Using HTTP/3 Stream ID: 0 (easy handle 0x5633c5d491a0)
> GET / HTTP/3
> Host: localhost:81
> user-agent: curl/7.69.0-DEV
@xquery
xquery / gist:e29009ab6c24be1fa7f9f45e78aca42b
Created February 4, 2020 19:41
hack dockerfile that builds patched openssl, nghttp3, ngtcp2, curl and sets up aoiquic, runs server on port 81 and we get success with curl -v --http3 https://localhost:81
FROM registry.hub.docker.com/library/alpine
###############################################################
# build curl
###############################################################
# install deps and use latest curl release source
RUN \
apk add \
build-base \
emacs \
bash-5.0# curl -v --http3 https://f0bc1400606e:82
* Trying 172.27.0.4:82...
* Connect socket 5 over QUIC to 172.27.0.4:82
* QUIC handshake is completed
* Using HTTP/3 Stream ID: 0 (easy handle 0x557010d671a0)
> GET / HTTP/3
> Host: f0bc1400606e:82
> user-agent: curl/7.69.0-DEV
> accept: */*
>
curl -v --http3 https://quic.tech:8443
* Trying 185.92.221.97:8443...
* Connect socket 5 over QUIC to 185.92.221.97:8443
* QUIC handshake is completed
* Using HTTP/3 Stream ID: 0 (easy handle 0x55610fc751a0)
> GET / HTTP/3
> Host: quic.tech:8443
> user-agent: curl/7.69.0-DEV
> accept: */*
>
@xquery
xquery / gist:21f032a4707736d4f29dfc1680d22a9e
Created February 6, 2020 18:53
initial perf runs on curl http3 usage
perf stat -r 100 curl --silent --http3 https://server-aioquic:443 -o /dev/null
Performance counter stats for 'curl --silent --http3 https://server-aioquic:443 -o /dev/null' (100 runs):
15.54 msec task-clock # 0.766 CPUs utilized ( +- 1.42% )
13 context-switches # 0.855 K/sec ( +- 11.32% )
0 cpu-migrations # 0.010 K/sec ( +- 24.68% )
369 page-faults # 0.024 M/sec ( +- 0.04% )
<not supported> cycles
<not supported> instructions
@xquery
xquery / gist:d8b931d618d9104354ae03ede50483a3
Created February 28, 2020 14:31
primitive scraping links
curl httpbin.org | \
sed 's/href=/\nhref=/g' | \
grep href=\" | \
sed 's/.*href="//g;s/".*//g'
buildconf: autoconf version 2.69 (ok)
buildconf: autom4te version 2.69 (ok)
buildconf: autoheader version 2.69 (ok)
buildconf: automake version 1.15 (ok)
buildconf: aclocal version 1.15 (ok)
buildconf: libtoolize version 2.4.6 (ok)
buildconf: GNU m4 version 1.4.17 (ok)
@@ -694,6 +694,9 @@ static CURLcode ssh_force_knownhost_key_type(struct connectdata *conn)
while(!libssh2_knownhost_get(sshc->kh, &store, store)) {
/* For non-standard ports, the name will be enclosed in */
/* square brackets, followed by a colon and the port */
+ if(store == NULL)
+ found = false;
+ break;
if(store->name[0] == '[') {
kh_name_end = strstr(store->name, "]:");
if(!kh_name_end) {
diff --git a/lib/vssh/libssh2.c b/lib/vssh/libssh2.c
index 8e043747e..b349d7ba7 100644
--- a/lib/vssh/libssh2.c
+++ b/lib/vssh/libssh2.c
@@ -694,25 +694,27 @@ static CURLcode ssh_force_knownhost_key_type(struct connectdata *conn)
while(!libssh2_knownhost_get(sshc->kh, &store, store)) {
/* For non-standard ports, the name will be enclosed in */
/* square brackets, followed by a colon and the port */
- if(store->name[0] == '[') {
- kh_name_end = strstr(store->name, "]:");