Fix HTTP/0.9 when not allowed errors (#253)

* Fix `HTTP/0.9 when not allowed` errors

* tweak retry callback

* throw ex in debug mode
This commit is contained in:
Brahim Hadriche authored and GitHub committed 2024-01-07 11:17:05 -05:00
1 parent 575935f5ac
commit 86d5710969
3 files changed
+48 -1

No files matched your search

@@ -123,6 +123,21 @@ namespace Invidious
request.CacheSeconds(60 * 60 * 5)
request.Cancellation(cancellation)
request.TryCount(2)
request.RetryCallback(function(context as object) as boolean
response = context.response
' In some cases, video info requests return "HTTP/0.9 when not allowed" errors.
' Retrying should usually fix the issue.
if response.StatusCode() = HttpClient.CurlErrors.CURLE_UNSUPPORTED_PROTOCOL
errorMessage = response.ErrorMessage()
if errorMessage.Contains("HTTP/0.9")
return true
end if
end if
return false
end function)
return request.Await()
end function