Skip to content

Commit ab09696

Browse files
committed
Fix bugs
1 parent 1a2ba68 commit ab09696

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

main.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from requests import Session
66
import sys
77

8-
ca_url_pattern = re.compile(r'CA Issuers \- URI:(\S+)\n')
8+
ca_url_pattern = re.compile(r'CA Issuers - URI:(\S+)')
99

1010
class CertChainBuilder:
1111
def get_next_cert_url(self, cert_data: bytes):
@@ -46,7 +46,7 @@ def feed(self, inital_cert: bytes):
4646
next_url = self.get_next_cert_url(inital_cert)
4747
while next_url:
4848
if self.verbose:
49-
print(f"Fetching next certificate from {next_url}", file=sys.stderr)
49+
print(f"Fetching next certificate from {next_url}")
5050
next_cert = self.get_cert_from_url(next_url)
5151
next_url = self.get_next_cert_url(next_cert)
5252

@@ -59,6 +59,7 @@ def build_chain(self) -> str:
5959
# Intermediate Certs: Highest -> Lowest (in the context of self.certs, this means from higher indices to lower)
6060
# Initial: self.certs[0]
6161
# Root: self.certs[-1]
62+
assert len(self.certs) >= 2
6263
chain = [self.get_cert_pem(self.certs[0])]
6364
for cert in self.certs[-2:0:-1]: # Starts from the second highest index and goes to the second lowest index
6465
chain.append(self.get_cert_pem(cert))

0 commit comments

Comments
 (0)