Download html when web server returns binary data?

42 views
Skip to first unread message

Bill Stewart

unread,
Jul 9, 2026, 12:13:38 PM (8 days ago) Jul 9
to innosetup
It seems some web servers use compression to deliver content; e.g. see:


I'm testing using DownloadTemporaryFile for html pages on www.python.org, and indeed I am getting binary data rather than text/html.

Invoke-WebRequest in PowerShell works correctly and retrieves the html.

How can we download such pages as text/html?

Martijn Laan - Inno Setup

unread,
Jul 10, 2026, 1:31:12 AM (7 days ago) Jul 10
to innosetup
Hi,

I suppose you could save the download as a .gz and then use ExtractArchive.

Suppose it's a HTTP header which one should read to auto-detect this? DownloadTemporaryFile  uses regular Windows HttpClient.

Greetings,
Martijn

Op 9-7-2026 om 18:13 schreef 'Bill Stewart' via innosetup:
--
You received this message because you are subscribed to the Google Groups "innosetup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to innosetup+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/innosetup/0c9e7df3-a07a-4319-be62-d4e28790b748n%40googlegroups.com.

Gavin Lambert

unread,
Jul 12, 2026, 8:06:32 PM (4 days ago) Jul 12
to innosetup
On Friday, July 10, 2026 at 5:31:12 PM UTC+12 Martijn Laan - Inno Setup wrote:
Suppose it's a HTTP header which one should read to auto-detect this? DownloadTemporaryFile  uses regular Windows HttpClient.

The response header is Content-Encoding.  The server is allowed to use any encoding if the client doesn't explicitly express a preference with Accept-Encoding, but most clients seem to be implemented such that they expect the server to never use an encoding unless explicitly requested, for some reason.

I asked an AI to suggest the code changes needed for THttpClient and it said:

    Client.AutomaticDecompression := [THTTPCompressionMethod.GZip, THTTPCompressionMethod.Deflate];

I haven't tested this, so YMMV.  In some versions you might need to set AcceptEncoding and parse ContentEncoding and do the decompression manually.
Reply all
Reply to author
Forward
0 new messages