Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
CCurlFile::Exists() to fallback to GET if 405 is returned #14586
I found this issue as as the iPhone App (JSON RPC) did not show any covers that where not cached by kodi.
There can be the case that the webserver does not support the HEAD request.
If there can be other cases where a fallback to GET would be good, let me know.
How Has This Been Tested?
Yes, tested on MacOS.
Types of change
Thx for your contribtion, but we should avoid adding magic at this place.
If you have a 1GB file behind your URL, GET is a bad choice for HEAD replacement.
@peak3d I agree that magic behind the scenes can be an issue. But it can also be an issue if people do not implement the correct behaviour.
@wsnipex thanks for the insight!
I went ahead and updated the code to include the timeout via advancedsettings and the CURLOPT_XFERINFOFUNCTION and CURLOPT_NOPROGRESS from the Stat function.
There can be the case that the webserver does not support the HEAD request. In this case we can fall back to a GET request to check if the file exists. Using the range hander to only return 1 byte of the file if supported by the server.