forked from JohnnyCrazy/SpotifyAPI-NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExtendedWebClient.cs
More file actions
28 lines (24 loc) · 869 Bytes
/
ExtendedWebClient.cs
File metadata and controls
28 lines (24 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System;
using System.Net;
namespace SpotifyAPI.Local
{
internal class ExtendedWebClient : WebClient
{
public int Timeout { get; set; }
public ExtendedWebClient()
{
// TODO Remove once SSL Issues are resolved #115
ServicePointManager.ServerCertificateValidationCallback = (s, certificate, chain, sslPolicyErrors) => true;
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;
}
}
}