From 6541ca9c58fba39cb5c900fcbd1ec14eec0f18f9 Mon Sep 17 00:00:00 2001 From: MilhouseVH Date: Sun, 17 Jun 2018 05:03:13 +0100 Subject: [PATCH] distro-tool: handle binary/octet-stream HEAD responses --- tools/distro-tool | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/distro-tool b/tools/distro-tool index 6fbae988a4..06b8a81c2e 100755 --- a/tools/distro-tool +++ b/tools/distro-tool @@ -1,7 +1,7 @@ #!/bin/bash ################################################################################ # This file is part of LibreELEC - https://libreelec.tv -# Copyright (C) 2016 Team LibreELEC +# Copyright (C) 2016-present Team LibreELEC # # LibreELEC is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -307,8 +307,11 @@ class MyUtility(object): # A content_type of "text/html" indicates we were served an error page of # some kind (eg. iperf) and not the requested file, which would be "application/". # "text/plain" indicates a misconfigured server (eg. libgcrypt, libgpg-error) so accept this. + # Some servers (eg. files.pythonhosted.org) will respond with "binary/octet-stream". if http_code in ["200", "206"] or MyUtility.search_HTTP_OK.search(headers): - result = True if (content_type.startswith("application/") or content_type.startswith("text/plain")) else False + result = True if (content_type.startswith("application/") or \ + content_type.startswith("text/plain") or \ + content_type.startswith("binary/octet-stream")) else False elif http_code == "350" and url.startswith("ftp:"): result = True else: