Spotify.NET/SpotifyAPI/Local/ExtendedWebClient.cs
Daniel Häfele c981b35085 Remove setting the WebClient.Proxy to null
It should be fine in most of the cases to just use the system proxy settings.
If anyone has issues with this approach, we can still make the WebClient.Proxy setting configurable somehow.
2015-11-26 21:17:37 +01:00

25 lines
687 B
C#

using System;
using System.Net;
namespace SpotifyAPI.Local
{
internal class ExtendedWebClient : WebClient
{
public int Timeout { get; set; }
public ExtendedWebClient()
{
Timeout = 2000;
Headers.Add("Origin", "https://embed.spotify.com");
Headers.Add("Referer", "https://embed.spotify.com/?uri=spotify:track:5Zp4SWOpbuOdnsxLqwgutt");
}
protected override WebRequest GetWebRequest(Uri address)
{
WebRequest webRequest = base.GetWebRequest(address);
if (webRequest != null)
webRequest.Timeout = Timeout;
return webRequest;
}
}
}