diff --git a/TODO b/TODO index 20427a8..9b0c012 100644 --- a/TODO +++ b/TODO @@ -200,7 +200,7 @@ Description: change of issue 12 wasn't properly reflected in urllib PkgHandler ID: 14 Type: feature Title: add compression support for urllib PkgHandler -Status: in-progress +Status: done Priority: high Created: 2025-06-21 Description: with a proper content-type of the PkgHandler addinfourl object, a diff --git a/src/byteb4rb1e/utils/urllib/request.py b/src/byteb4rb1e/utils/urllib/request.py index 3f9ee20..2408d94 100644 --- a/src/byteb4rb1e/utils/urllib/request.py +++ b/src/byteb4rb1e/utils/urllib/request.py @@ -22,7 +22,10 @@ class PkgHandler(urllib.request.BaseHandler): size = fh.tell(); fh.seek(0); - mtype, _ = mimetypes.guess_type(req.selector) + mtype, compression = mimetypes.guess_type(req.selector) + + if compression and mtype: + mtype = f"{mtype}+{compression}" headers = email.message_from_string( 'Content-Type: %s\nContent-Length: %d\n' %