feat(urllib.request): add compression support for PkgHandler
This commit is contained in:
parent
981985e51a
commit
2d9fe8b625
1 changed files with 4 additions and 1 deletions
|
|
@ -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' %
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue