comparison sat/plugins/plugin_comp_ap_gateway/http_server.py @ 3982:74f7c10a48bc

component AP gateway: properly close the HTTP connection on `checkSignature` exception: if something is going wrong during `checkSignature` (other than signature verification failing), a `500 Internal Server Error` code is returned, and the connection is properly closed.
author Goffi <goffi@goffi.org>
date Tue, 15 Nov 2022 18:10:33 +0100
parents acc9dfc8ba8d
children 31c3d6652115
comparison
equal deleted inserted replaced
3981:acc9dfc8ba8d 3982:74f7c10a48bc
1044 except exceptions.EncryptionError as e: 1044 except exceptions.EncryptionError as e:
1045 self.responseCode( 1045 self.responseCode(
1046 request, 1046 request,
1047 http.FORBIDDEN, 1047 http.FORBIDDEN,
1048 f"invalid signature: {e}" 1048 f"invalid signature: {e}"
1049 )
1050 request.finish()
1051 return
1052 except Exception as e:
1053 self.responseCode(
1054 request,
1055 http.INTERNAL_SERVER_ERROR,
1056 f"Can't check signature: {e}"
1049 ) 1057 )
1050 request.finish() 1058 request.finish()
1051 return 1059 return
1052 1060
1053 request.setResponseCode(http.ACCEPTED) 1061 request.setResponseCode(http.ACCEPTED)