HydrogenAudio

Hosted Forums => foobar2000 => Development - (fb2k) => Topic started by: 3dyd on 2018-03-10 10:27:49

Title: http_client: HTTP 403 error accessing GitHub (foobar2000 1.4 beta 7 and 8)
Post by: 3dyd on 2018-03-10 10:27:49
Latest beta 8 gives HTTP 403 error when accessing GitHub API. I believe this problem started to happen in beta 7.

Steps to reproduce:
Code: [Select]
  auto request = static_api_ptr_t<http_client>()->create_request("GET");
  request->run("https://api.github.com", abort_callback_dummy());
This code results in PP::httpRequest::error exception with "Forbidden (403)" message.

Few observations:

Comparing to 1.3.17, HTTP request lacks 'Accept' and 'User-Agent' headers. The latter troubles GitHub (documentation (https://developer.github.com/v3/#user-agent-required)).

The question is: from now on, should components add 'Accept' and 'User-Agent' headers by their own if they need these headers? Or this is something that was just overlooked?

Also, even being invoked with "https://..." URL, http_request in beta 8 first performs request to "http://..." URL (in 1.3.17 it performs request directly to https://...). Is there a reason for that?
Title: Re: http_client: HTTP 403 error accessing GitHub (foobar2000 1.4 beta 7 and 8)
Post by: Peter on 2018-03-10 10:34:07
Noted, thanks for reporting - this will be fixed in the next update.

I switched to a different HTTP client implementation in 1.4 beta 7 - or more specifically, to a different fork of the same implementation.
Title: Re: http_client: HTTP 403 error accessing GitHub (foobar2000 1.4 beta 7 and 8)
Post by: Peter on 2018-03-12 14:40:09
I confirmed and fixed the two first issues: missing "Accept" and "User-Agent".
However I see no trace of plain HTTP requests made instead of HTTPS. Do you have a wireshark log of this?
Title: Re: http_client: HTTP 403 error accessing GitHub (foobar2000 1.4 beta 7 and 8)
Post by: 3dyd on 2018-03-12 19:28:07
It seems, HTTP requests are made when Proxy is set to 'Use Internet Explorer settings' (when it is set to 'No proxy', request goes directly to 443 port). Reproduced on clean beta 8 using 'Add location...' with https://api.github.com. Log is in attach (Fiddler). On 1.3.17 that does not happen (request goes directly to HTTPS). OS is Win 8.1 x64 with all updates.
Title: Re: http_client: HTTP 403 error accessing GitHub (foobar2000 1.4 beta 7 and 8)
Post by: Peter on 2018-03-13 10:48:09
Problem recreated, thanks for the details.
Various proxy server handling bugs are being addressed for beta 9.
Title: Re: http_client: HTTP 403 error accessing GitHub (foobar2000 1.4 beta 7 and 8)
Post by: Peter on 2018-03-14 14:46:11
New beta posted, relevant bugs should be gone.
Title: Re: http_client: HTTP 403 error accessing GitHub (foobar2000 1.4 beta 7 and 8)
Post by: 3dyd on 2018-03-17 10:15:55
Confirmed. All issues are resolved in beta 9. Thank you.