From 637025c8c333514f8bd7563243ffd20191d25226 Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Thu, 24 Dec 2020 13:54:39 -0500 Subject: [PATCH] Fix TLS_CLIENT_AUTHORISED sometimes returning False instead of 0 --- CHANGELOG.md | 6 ++++-- jetforce/protocol.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e05c55b..16276fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,10 +6,12 @@ - Added support for international domain names using IDN encoding. -#### Features +#### Bug Fixes - Added py.typed file to indicate that the jetforce python library has support for type hints. +- Fixed a bug where TLS_CLIENT_AUTHORISED would sometimes be set to + ``True``/``False`` instead of ``1``/``0``. ### v0.7.0 (2020-12-06) @@ -17,7 +19,7 @@ - Requests containing URLs without a scheme are no longer accepted. - The server will stop redirecting the root URL "gemini://example.com" to - "gemini://example.com/". These URLs are cannonically the same per the url RFC + "gemini://example.com/". These URLs are canonically the same per the url RFC definition and should both return successful responses. - The CGI variable TLS_CLIENT_HASH now formats the certificate hash as "SHA256:\" where \ is uppercase hexidecimal. The old base64 diff --git a/jetforce/protocol.py b/jetforce/protocol.py index 03c9146..1a65265 100644 --- a/jetforce/protocol.py +++ b/jetforce/protocol.py @@ -216,7 +216,7 @@ class GeminiProtocol(LineOnlyReceiver): "TLS_CLIENT_NOT_AFTER": cert_data["not_after"], "TLS_CLIENT_SERIAL_NUMBER": cert_data["serial_number"], # Grab the value that was stashed during the TLS handshake - "TLS_CLIENT_AUTHORISED": getattr(conn, "authorised", False), + "TLS_CLIENT_AUTHORISED": int(getattr(conn, "authorised", 0)), } ) return environ