Skip to content

Instantly share code, notes, and snippets.

View xquery's full-sized avatar

James Fuller xquery

View GitHub Profile
<testcase>
<info>
<keywords>
HTTP
HTTP GET
Alt-Svc
HTTP/2
</keywords>
</info>
@xquery
xquery / output
Created April 11, 2020 18:00
stripped down test
HTTP/1.1 400 Bad Request
Server: nghttpx
Content-Length: 129
Date: Sat, 11 Apr 2020 17:58:51 GMT
Content-Type: text/html; charset=UTF-8
Connection: close
<!DOCTYPE html><html lang="en"><title>400 Bad Request</title><body><h1>400 Bad Request</h1><footer>nghttpx</footer></body></html>
@xquery
xquery / gist:2b3eada1c65fae6a625b1d6639a5b822
Created April 10, 2020 06:56
why do I get this output
<testcase>
<info>
<keywords>
HTTP
Alt-Svc
</keywords>
</info>
#
# Server-side
HTTP/1.1 400 Bad Request
Server: nghttpx
Content-Length: 129
Date: Thu, 09 Apr 2020 16:17:15 GMT
Content-Type: text/html; charset=UTF-8
Connection: close
<!DOCTYPE html><html lang="en"><title>400 Bad Request</title><body><h1>400 Bad Request</h1><footer>nghttpx</footer></body></html>
<testcase>
<info>
<keywords>
HTTP
Alt-Svc
</keywords>
</info>
#
# Server-side
<testcase>
<info>
<keywords>
HTTP
Alt-Svc
</keywords>
</info>
#
# Server-side
<testcase>
<info>
<keywords>
HTTP
Alt-Svc
</keywords>
</info>
#
# Server-side
@xquery
xquery / gratuitous_solution_with_assert.py
Last active April 1, 2020 11:33
Sort a list of the strings "a", "bcd", "ef", and "ghij" in descending order of length.
"""
How do you sort a list of the strings "a", "bcd", "ef", and "ghij" in descending order of length?
(https://twitter.com/paulg/status/1244921240227282944)
"""
def sort_desc_by_string_length(data):
''' sorts an array by string length and return in descending order '''
# use python 'sorted' builtin to sort by string length and return in reverse order
# (https://docs.python.org/3.8/library/functions.html?highlight=sorted#sorted)
return sorted(data, key=len, reverse=True)
$ cat <<EOF | tee -a ~/.ssh/known_hosts
example.org ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAvd4U77Q2yK0NjwBrAAVUeRTEvjH/2rnm1Mi3FgX5Y/g9/5h4wZ+FfqtdcSnbBnKN1uSnwqLS8kO3ti6MNf3/nhhXBO5XYBt1zpMggg2KAN63ThJNk62UK9QFjDdilJktOhSfMMhsZmTifX53Mpc44PdTLB53GTg57HD91E74e3UjWtjHnK1ZEjc4czVyfNdLRq9z6JoorSKqPPz9kiHiitwaKENY4kaLM4KN0CGK421G6G7uYDs3t1WyCe6DiiwJJ7r10WnE3KcSQOiow2CSVv7Mk2Ou5MiJHgASg3y+Hre6Y87OOJP0c9Lc300yMNt28hQptRyY9SD5FNsATUuMsw==
invalid-key.example.org ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAvd4UERROR77Q2yK0NjwBrAAVUeRTEvjH/2rnm1Mi3FgX5Y/g9/5h4wZ+FfqtdcSnbBnKN1uSnwqLS8kO3ti6MNf3/nhhXBO5XYBt1zpMggg2KAN63ThJNk62UK9QFjDdilJktOhSfMMhsZmTifX53Mpc44PdTLB53GTg57HD91E74e3UjWtjHnK1ZEjc4czVyfNdLRq9z6JoorSKqPPz9kiHiitwaKENY4kaLM4KN0CGK421G6G7uYDs3t1WyCe6DiiwJJ7r10WnE3KcSQOiow2CSVv7Mk2Ou5MiJHgASg3y+Hre6Y87OOJP0c9Lc300yMNt28hQptRyY9SD5FNsATUuMsw==
empty-key.example.org
too-long.example.org 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678
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, "]:");