pyodide-http icon indicating copy to clipboard operation
pyodide-http copied to clipboard

responses with transfer-encoding break the urllib handler

Open machineonamission opened this issue 5 months ago • 0 comments

So, yall construct a fake full HTTP response here https://github.com/koenvo/pyodide-http/blob/b5fc794dfd0f6db18304aa9ec4d967e07123b6fc/pyodide_http/_urllib.py#L38-L50 now, some http requests have transfer-encoding, where the data is chunked or zipped or something. problem is, XMLHttpRequest abstracts that away, but leaves the response headers. So JS passes decoded data, but says its chunked, which freaks out python's http lib.

the fix is simple, strip the transfer-encoding header before constructing the response.

this is confirmed working with chunked transferring. i am not 100% sure of gzip and such, but i imagine the same applies.

machineonamission avatar Jul 13 '25 06:07 machineonamission