Merge pull request #2778 from MilhouseVH/le90_distro_tool_octet_stream

distro-tool: handle binary/octet-stream HEAD responses
This commit is contained in:
Lukas Rusak 2018-06-16 21:21:43 -07:00 committed by GitHub
commit 226395f257
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
################################################################################ ################################################################################
# This file is part of LibreELEC - https://libreelec.tv # 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 # LibreELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # 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 # 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/<something>". # some kind (eg. iperf) and not the requested file, which would be "application/<something>".
# "text/plain" indicates a misconfigured server (eg. libgcrypt, libgpg-error) so accept this. # "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): 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:"): elif http_code == "350" and url.startswith("ftp:"):
result = True result = True
else: else: