regression test test/issues/el-get-issue-1920.el revealed that Git HTTP smart host detection is broken. Not all hosts support the HEAD HTTP request method. For example, github.com for HEAD
Other hosts like git.sr.ht do support HEAD, of course.
Furthermore, the HTTP status code wasn't checked, that's why hosts like github.com would be classified as "dumb" hosts.
This commit checks the HTTP status code, and if the status is not 200 or 304 for the HEAD HTTP request method, it tries GET. HEAD is tried first, because GET might be more expensive for big repositories.
regression test test/issues/el-get-issue-1920.el revealed that Git HTTP smart host detection is broken. Not all hosts support the HEAD HTTP request method. For example, github.com for HEAD
responds
while for GET
responds
Other hosts like git.sr.ht do support HEAD, of course.
Furthermore, the HTTP status code wasn't checked, that's why hosts like github.com would be classified as "dumb" hosts.
This commit checks the HTTP status code, and if the status is not 200 or 304 for the HEAD HTTP request method, it tries GET. HEAD is tried first, because GET might be more expensive for big repositories.
The regression test is adapted as well.