Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
Stuart D. Gathman
720d276f40 headers.get_all() not in python2.6 2017-11-22 19:36:24 -05:00

View file

@ -1,9 +1,9 @@
diff -up ./acme_tiny.py.chain ./acme_tiny.py
--- ./acme_tiny.py.chain 2017-05-16 03:57:46.000000000 -0400
+++ ./acme_tiny.py 2017-11-22 12:18:56.963653336 -0500
+++ ./acme_tiny.py 2017-11-22 15:14:19.270485351 -0500
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
+#!/usr/bin/python
import argparse, subprocess, json, os, sys, base64, binascii, time, hashlib, re, copy, textwrap, logging
try:
from urllib.request import urlopen # Python 3
@ -73,14 +73,14 @@ diff -up ./acme_tiny.py.chain ./acme_tiny.py
+ certchain = [result]
+ if chain:
+ def parse_link_header(line):
+ m = re.search(r"^<([^>]*)>(?:\s*;\s*(.*))?$", line)
+ m = re.search(r"^Link:\s*<([^>]*)>(?:\s*;\s*(.*))?\r\n$", line)
+ return (m.group(1), dict([(a[0],a[1].strip('"'))
+ for a in [attr.split("=")
+ for attr in m.group(2).split("\s*;\s*")]]))
+
+ up = [
+ link for link, attr in [
+ parse_link_header(l) for l in headers.get_all("Link")
+ parse_link_header(l) for l in headers.getallmatchingheaders("Link")
+ ] if attr['rel'] == 'up'
+ ]
+ certchain += [urlopen(url).read() for url in up]