Fix TLS_CLIENT_AUTHORISED sometimes returning False instead of 0

This commit is contained in:
Michael Lazar 2020-12-24 13:54:39 -05:00
parent 557bd96650
commit 637025c8c3
2 changed files with 5 additions and 3 deletions

View File

@ -6,10 +6,12 @@
- Added support for international domain names using IDN encoding. - 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 - Added py.typed file to indicate that the jetforce python library has support
for type hints. 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) ### v0.7.0 (2020-12-06)
@ -17,7 +19,7 @@
- Requests containing URLs without a scheme are no longer accepted. - Requests containing URLs without a scheme are no longer accepted.
- The server will stop redirecting the root URL "gemini://example.com" to - 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. definition and should both return successful responses.
- The CGI variable TLS_CLIENT_HASH now formats the certificate hash as - The CGI variable TLS_CLIENT_HASH now formats the certificate hash as
"SHA256:\<HASH\>" where \<HASH\> is uppercase hexidecimal. The old base64 "SHA256:\<HASH\>" where \<HASH\> is uppercase hexidecimal. The old base64

View File

@ -216,7 +216,7 @@ class GeminiProtocol(LineOnlyReceiver):
"TLS_CLIENT_NOT_AFTER": cert_data["not_after"], "TLS_CLIENT_NOT_AFTER": cert_data["not_after"],
"TLS_CLIENT_SERIAL_NUMBER": cert_data["serial_number"], "TLS_CLIENT_SERIAL_NUMBER": cert_data["serial_number"],
# Grab the value that was stashed during the TLS handshake # 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 return environ