Merge branch 'feature/14' into dev
ID: 14
Type: feature
Title: add compression support for urllib PkgHandler
Status: done
Priority: high
Created: 2025-06-21
Description: with a proper content-type of the PkgHandler addinfourl object, a
consumer can determine whether the file is compressed or not.
This commit is contained in:
commit
32ae99c5fa
2 changed files with 5 additions and 2 deletions
2
TODO
2
TODO
|
|
@ -200,7 +200,7 @@ Description: change of issue 12 wasn't properly reflected in urllib PkgHandler
|
||||||
ID: 14
|
ID: 14
|
||||||
Type: feature
|
Type: feature
|
||||||
Title: add compression support for urllib PkgHandler
|
Title: add compression support for urllib PkgHandler
|
||||||
Status: in-progress
|
Status: done
|
||||||
Priority: high
|
Priority: high
|
||||||
Created: 2025-06-21
|
Created: 2025-06-21
|
||||||
Description: with a proper content-type of the PkgHandler addinfourl object, a
|
Description: with a proper content-type of the PkgHandler addinfourl object, a
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,10 @@ class PkgHandler(urllib.request.BaseHandler):
|
||||||
size = fh.tell();
|
size = fh.tell();
|
||||||
fh.seek(0);
|
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(
|
headers = email.message_from_string(
|
||||||
'Content-Type: %s\nContent-Length: %d\n' %
|
'Content-Type: %s\nContent-Length: %d\n' %
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue