From 38fe3a49c1c26292da54dbb30540f1b661694c30 Mon Sep 17 00:00:00 2001 From: s3lph Date: Mon, 24 Jul 2023 01:49:40 +0200 Subject: [PATCH] feat: add support for application/tlsrpt+gzip --- tlsrpt_exporter/__main__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tlsrpt_exporter/__main__.py b/tlsrpt_exporter/__main__.py index 187f60b..b0fea1c 100644 --- a/tlsrpt_exporter/__main__.py +++ b/tlsrpt_exporter/__main__.py @@ -2,6 +2,7 @@ import argparse import os import dataclasses +import gzip import json from datetime import datetime @@ -47,7 +48,7 @@ class Reporter(bottle.Bottle): bottle.response.add_header('Accept', 'application/tlsrpt+gzip') bottle.response.add_header('Accept', 'application/tlsrpt+json') if 'application/tlsrpt+gzip' in bottle.request.content_type: - self.handle(self.decompress(bottle.request.body)) + self.handle(json.load(gzip.open(bottle.request.body))) elif 'application/tlsrpt+json' in bottle.request.content_type: self.handle(json.load(bottle.request.body)) else: